Home ...

Home directory growing

Ragavendra B.N.
Ragavendra B.N.

In today's world a lot of applications are written with a goal in mind and not necessarily thinking about the disk usage. Like say for example I know one app which can use a lot of extension. One interesting thing I found is that it whenever there is a newer version of an extension, the newer version is copied over, but the older one is still lingering around. Haa, if the extension was in kbs it could probably be ignored but for some even in mbs can be a lot.

Using filelight I found that there are some directories like say ~/.npm, ~/.dotnet, ~/.nuget, ~/.wine which were using quite a large chunk of my root or the home partition. I could have moved the whole home directory to another partition using usermod whoami -d /new/parition/home but however there is one main issue with this. When the system starts it loads the graphical manager or the gdm and other important applications which exist in the home directory. At that point, there is more likely that the non root partitions are not loaded unless you installed your home directory in a separate partition during the installation or update your fstab with the user mount option, which is one of those things. Before doing this, I would suggest to close all the relevant apps so that it does not cause any issues with the open files and wait until it is closed completely.

Let us begin by moving the big (if I may) directories to the new partition or like so.

// move the directory
$ mv ~/.npm /run/media/userName/newPart/userName/

// make the symbolic link to the new path
$ ln -s /run/media/userName/newPart/userName/.npm ~

// repeat for others
$ mv ~/.dotnet /run/media/userName/newPart/userName/
$ ln -s /run/media/userName/newPart/userName/.dotnet/ ~

Now, if you check the disk either using filelight or du -hs ~/, you must notice a considerable amount of disk space saved. When working with docker this can be done as well, but it may cause issue with permissions as well and I assume there is a cleaner way to do it as well.