0

I've got dual boot Ubuntu 20.04 in my computer and some days ago I'm frequently getting the "free up disk space" advice in my root partition (20GB).

When I check the disk usage, I can see /usr directory is using 7.2GB /var is using 6.1GB and /opt is using 1.1GB.

When I installed Ubuntu I didn't know how much space assign to root and home partitions so I followed tutorials and I've done 20GB to the first one and 130GB to the second one, now I have 92% usage on root and 13% on home, so I want to either give the root partition more of the space that home partition is not using or, in the other hand, move the /usr (/var and /opt too) inside the /home directory, in order to get /home/usr; home/var and home/opt structure.

I've just seen this post How to move /usr to a new partition? that is the unique available with sort of the same problem, but I don't want to create a new partition for usr, so I just copied the directory but I'm afraid to go on with the next steps.

I don't want to risk my OS with simply directly moving the directory due it seems dangerous from another forums; and clearly I don't want to preserve a copy in "/" because I need to free up space there.

I've already cleaned up older kernel versions and useless installed packages following other posts, but it isn't enough; currently I cannot go on with any Live CD solution since I don't have usb stick with me.

¿What could I do?

1 Answers1

0

The fundamental solution would be to resize your partitions.

Still, several parts of the system could be moved to a separate partition and then replaced by a symbolic link. The symbolic links ensure that the conventional Filesystem Hierarchy Standard is preserved.

This is not as strange as it may sound. Historically, linux systems booted from very small partitions. Links were used to point to system files stored on separate partitions. For example, the entire /usr directory was mounted at a different partition. However, /usr in particular should nowadays not be moved because essential binaries (/bin) and libraries (/lib) have been moved to /usr/bin.

The separate partition should be formatted with a file system that supports linux permissions and be automatically mounted at boot. Your /home partition fulfills these conditions. The move should be done such that all file properties and permissions are preserved.

In principle, any files that are not used early in the boot process could be moved. You could very likely replace /opt by a symlink. Also /tmp and /var/tmp can be replaced by a symlink. Also /snap or /var/lib/flatpak likely can be replaced by a symlink, and probably others, but you will need to test this.

vanadium
  • 97,564