Ubuntu系统根分区已满,如何从/home分区扩容根分区?
Absolutely doable, and you’re smart to hold off on reinstalling while you’re in the middle of NVIDIA/CUDA driver debugging—let’s walk through the safe way to reallocate that space without disrupting your setup.
Critical Pre-Requisite: Backup Your Data
Partition operations carry inherent risk (e.g., power loss mid-process can corrupt files). Backup all important data from your /home partition first. You can use an external drive and run this command from your active system (before booting into live mode):
rsync -av /home/ /path/to/external-drive/home-backup/
This creates an exact copy of your home directory, so you’ll have a fallback if anything goes wrong.
Step 1: Create a Ubuntu Live USB
You can’t modify mounted partitions (your root and /home are mounted while the system is running), so you’ll need to boot from a live environment:
- Download the same Ubuntu version you’re using
- Use the built-in Startup Disk Creator (search for it in your applications menu) to make a bootable USB drive
Step 2: Boot into the Live Environment
- Restart your computer and select the USB drive as the boot device (press F12, F2, or Del to access the boot menu, depending on your motherboard)
- Choose the "Try Ubuntu" option (don’t select "Install Ubuntu")
Step 3: Use GParted to Resize Partitions
GParted is a user-friendly graphical partition editor pre-installed in the live session:
- Open GParted (search for it in the live session’s application menu)
- Select your main disk from the top-right dropdown (usually
/dev/sdafor HDDs or/dev/nvme0n1for SSDs) - Shrink the /home partition:
- Right-click your /home partition (look for the "home" label) and select Unmount (you can’t resize a mounted partition)
- Right-click again and choose Resize/Move
- Drag the right edge of the partition bar left to free up ~100GB of unallocated space
- Click the green checkmark (Apply) to run the shrink operation
- Expand the root partition:
- Find your root partition (labeled "/" or no label, usually the first partition)
- Right-click it and select Unmount
- Right-click again and choose Resize/Move
- Drag the right edge of the partition bar all the way right to absorb the unallocated space
- Click Apply to run the expand operation
- Wait for all operations to finish—don’t interrupt the process!
Step 4: Verify and Reboot
- Once GParted confirms all tasks are done, close the program
- Reboot your computer and remove the USB drive
- Log back into your system, then run this command to check the new partition sizes:
df -h
You should see your root partition now has ~120GB of space, and /home has ~100GB left.
Edge Case Note
If your partitions use LVM (Logical Volume Manager), the steps will differ slightly—you’ll need to use lvresize commands instead of GParted. Let me know if that’s your setup and I can walk you through it.
内容的提问来源于stack exchange,提问作者Joel Andersson

