0

I think my snap folders in root and home are swapped. Indeed, according to the answer of this post, all the configuration files of my snaps should be in the snap folder stored in /home while there should only be mount points in the one stored in /root. However, it seems to be the other way round (18GB of memory used in root and 1.3GB in /home):

/snap hard drive usage

/home/{username}/snap hard drive usage

Q1: How can I swap these two folders? (I guess simply moving them won't work)

Q2: I also have a folder snapd in /var/lib which is 7gb. Is this normal?

Q3: I noticed that two versions of each snap are stored: can I safely remove the older ones to save space?

infos: Ubuntu 20.04, Dell XPS 15

Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26
  • Please edit your question and use copy and paste of your text instead of screenshots. Also, what is the output of lsblk | grep snap? I think you will see that all the mounted snaps reside in the /snap folder and not the ~/snap folder. From looking at your pics, your folders seem to be correct. The size of the snapd depends on how many snaps you have installed. – Terrance Dec 28 '20 at 01:49
  • Also see https://askubuntu.com/questions/1036633/how-to-remove-disabled-unused-snap-packages-with-a-single-line-of-command if you want to remove the extra unused snaps. – Terrance Dec 28 '20 at 01:51
  • This answer might be of interest for you too. – mook765 Dec 28 '20 at 01:59

1 Answers1

1

Indeed, according to the answer of this post, all the configuration files of my snaps should be in the snap folder stored in home while there should only be mount points in the one stored in root. However, it seems to be the other way round [...].

This point is correct, but you're neglecting the fact that du doesn't care that something is mounted there. You asked it to tell you how big the files are in a specific location, and it told you. Check the output of the mount command and you'll notice that nearly everything in the /snap directory is just a mount point. Everything else in there is just a symlink. What you're seeing is correct, don't worry! You don't want to swap anything.

Q2: I also have a folder snapd in /var/lib which is 7gb. Is this normal?

Yes, this is where the individual snaps are stored (from where they're mounted into /snap/ somewhere). This is normal.

Q3: I noticed that two versions of each snap are stored: can I safely remove the older ones to save space?

You may; the reason snapd keeps old snaps around is in case you need to revert to an older one. You can see them all with snap list <snap name> --all. If you're confident you don't need old revisions, you can remove them using sudo snap remove <snap name> --revision=<snap revision>. Note that you can change the snapd configuration to retain a different number of snaps:

$ snap set system refresh.retain=<number>
kyrofa
  • 7,346
  • 1
  • 32
  • 26