0

My Ubuntu LTS box is partitioned as shown in this GParted screenshot. There are separate ext4 partitions for root, usr, home, and a couple of ntfs data partitions (for Windows/Mac VM disk images). /, /usr, and /home partitions are adjacent to each other in this order.

Now it turns out that the /usr partition would be better off being larger than it is - during a recent update I an error message that it was out of space (there's ~2gb free).

root has some unused space but not enough to simply move the files in /usr. But,/home does have enough space to move all the files in /usr.

So I want /usr to have more space. I see two ways -

  1. basically merge / and /usr. Copy (cp -a) all the files in /usr to /home, then delete the usr partition and expand / to include the unused space. Then move the /usr files from home to root. Is it enough to simply move/copy the contents to another partition?

  2. shrink / and add space to /usr. I am not sure if doing this is straightforward. Is it?

I am not sure which is the better option, and if my approaches make sense. I plan to do it using GParted off a live boot USB. Please advice, if you know how to go about this and which option above is better.

This question here was very helpful but not quite enough.

enter image description here

7
  • 1
    I wouldn't use cp to do this; maybe old prejudice from broken historical versions of cp that corrupt permissions, but you don't need to create the files on /home anyway. Instead, use tar (as root) and save the files together as a single tar file and unpack that onto the new merged partition.
    – user10489
    Commented Jun 18, 2022 at 4:45
  • 1
    I suggest something like tar cf /home/tmpsave.tar --one-file-system / /usr
    – user10489
    Commented Jun 18, 2022 at 4:47
  • Ok, so just to reiterate for safety - I tarball the entire /usr, put it somewhere safe, then delete the partition containing /usr and extend the partition containing / into the now unused/empty space, and finally unpack the tarball into the all new spacious /. Right? I understand your paranoia about cp, tar is indeed safer.
    – ahron
    Commented Jun 18, 2022 at 5:25
  • 1
    The 3 partitions on the disk total 32GB of free space, so you could unify all three to have that much free space. In addition, the swap space might be too large if you never run out of RAM space. For example, this article recommends for RAM of 8GB–64GB the amount of 4G to 0.5X RAM, and when using hibernation the amount of 1.5X RAM.
    – harrymc
    Commented Jun 18, 2022 at 7:31
  • 1
    ...and of course, deleting and recreating the partitions will require booting from a live disk...
    – user10489
    Commented Jun 18, 2022 at 12:11

1 Answer 1

0

The 3 partitions on the disk, / and /usr and /home, total 32GB of free space, so unifying all three will result in one partition that has that much of free space.

In addition, the swap space might be too large if you never run out of RAM space.

For example, this article recommends for RAM of 8GB–64GB the amount of only 4G to 0.5X RAM, and if using hibernation the amount of 1.5X RAM.

If your RAM is 16GB and you use hibernation, then 24GB swap is enough, which will free additional 5GB. And if you don't use hibernation and allocate, say, 8GB of swap, then you gain rather about 20GB.

All in all, it's possible to arrive at having about 53GB of free space.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .