I don’t need to actually shrink the MBR partition, just the logical volume that contains the root “/” filesystem. It’s ~200GB now, and I need to shrink it to ~150GB to make room for a new logical volume. How do I go about this?
Any partition and LV resizing should be done on unmounted partitions, so you have to boot from Ubuntu installation disk or USB stick, run it as live CD, connect to Internet, install lvm2
sudo apt-get install lvm2
...or you can use any Linux rescue CD which already has lvm2 available. Then make sure, that your root LV is not installed, by
and unmount it when necessary, then do filesystem check
on this LV. Then shrink filesystem
and reduce LV
Reboot to your system, Enjoy!
BEFORE YOU CHANGE ANYTHING MAKE SURE YOU HAVE A CURRENT BACKUP. This all worked for me, but it might not work for you. If it blows up for some reason, you don’t want to lose anything that you can’t recover. Continuing on…
It is not possible (to my knowledge) to shrink a filesystem while it is mounted, so we need to do the actual resizing from a Live CD. All the following instructions assume you have booted off of the 11.10 Desktop Install CD.
After the Live CD boots up to the desktop, open up the Terminal.
The LVM tool are not built-in to the Live CD, so first we must install them:
Find the name of the Volume Group (henceforth “somevg”) that contains the root Logical Volume:
(If it’s not showing up, try running
If you run
Since we haven’t mounted the root filesystem, it should be safe to resize. Proceed to perform the actual resizing of the Logical Volume. Note that this command (
(My Logical Volume is called “root”, but yours may be named something different.)
This command will first shrink the filesystem, then shrink the Logical Volume that contains it, which is the only safe way to do it.
You can now restart the system and boot into your now-resized root filesystem.
|show 1 more comment|