0

I'm on Arch Linux and this is the overview of the current disk layout:

❯ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 476,9G  0 disk
├─nvme0n1p1 259:1    0     1G  0 part /boot
├─nvme0n1p2 259:2    0   300G  0 part /
└─nvme0n1p3 259:3    0 175,9G  0 part /home
❯ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  295G   82G  198G  30% /
/dev/nvme0n1p3  173G   87G   77G  53% /home
/dev/nvme0n1p1 1022M   84M  939M   9% /boot

Since I found out that I may have allocated too much space to the root partition and too little to the home partition, I would like to know if it is possible to transfer some available space from one to the other. I have thought of the following steps:

  1. Backup the whole system
  2. Boot from live arch usb
  3. Resize the root partition (this will give me some unallocated space)
  4. Delete the current /home partition
  5. Create and format a new home partition on nvme0n1/nvme0n1p3
  6. Transfer the old /home files to the newly created part

Supposing these steps so far are sound, there are some more steps to be followed of course. What do I have to do exactly to restore the old system without making much of a mess? I'd like to avoid reinstalling from 0 and preserve installed programs, docker images, etc.

Also, while I'm at it, I'd like to ask:

  • Which are some good root - home size considering I use docker a lot and potentially will install a decent number of programs in the future (right now I've used ~82G)?
  • Do you have any suggestions for an exclude_files list for rsync when cloning the /home partition (like caches, node_modules, site_packages, etc.)?
5
  • This is about Ubuntu's /home, not sure how similar Arch is: askubuntu.com/questions/545655/… & askubuntu.com/questions/40992/… & stackoverflow.com/questions/8270519/…
    – oldfred
    Jun 7, 2023 at 2:38
  • Just to clarify, this comment is referring to the second point of the post scriptum section. "Do you have any suggestions for an exclude_files list for rsync when cloning the /home partition (like caches, node_modules, site_packages, etc.)?" Jun 7, 2023 at 7:54
  • do you actually need / and /home to be separate partitions? unless you've got a good reason for that, you're probably better off with just a / partition, with /home being a sub-directory on /.
    – cas
    Jun 8, 2023 at 2:13
  • @cas I do since it's way more flexible IMO: askubuntu.com/questions/142695/… Jun 8, 2023 at 8:06
  • It's flexible in some ways, inflexible in others. Your question indicates that you've run into one of the ways that it is inflexible - you have to guess in advance how much space you think each partition might need and hope you got it right. Space allocation is one of the reasons I prefer ZFS datasets instead of partitions or LVs - all datasets have access to all available space in the entire pool (unless I set the quota or reservation properties for them - either of which can be changed at any time with one simple command - no need to move files around or re-partition any drives).
    – cas
    Jun 8, 2023 at 10:08

1 Answer 1

-1

First, you must boot from a Live USB. You can only modify a disk when none of the disk's partitions is mounted.

Read man gparted resize2fs before you start.

IDK if gparted is on the Arch Live USB, but a Live Gparted USB is available.

Run gparted. Be SURE to select the right disk!.

Select nvme0n1p2, shrink it (to 100GB? YMMV), by reducing its upper limit. This will create unallocated space between nvme0n1p2 and nvme0n1p3.

Select nvme0n1p3. Adjust the lower limit to consume the unallocated space.

Click on Apply at the bottom of the page to have gparted actually make the changes.

Wait until gparted completes. It has a lot to do.

Remove the Live USB, and reboot

Read man gparted resize2fs before you start.

Yes, the above paragraph is repeated. IMHO, the reading of msn pages is a sacred duty.

1
  • I knew about this procedure and if I understood correctly what gparted is doing under the hood is moving the unallocated part on the right of the home partition before being able to extend the old partition. But I've also read around that this process (depending on the sizes of course) may take a really long time and it's prone to system breaks. That's way I was actually going after a complete /home remove and reallocation, leveraging the fact the the root part is independent. Jun 6, 2023 at 23:32

You must log in to answer this question.

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