JP Vossen on 9 Dec 2011 13:49:20 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Lost gigabytes?

Date: Thu, 8 Dec 2011 15:47:29 -0500
> From: Rich Freeman > <>


Your one partition is further divided up using LVM, and so root is
just a portion of it.  LVM does allow for resizing so you can shuffle
things around - IF YOU KNOW WHAT YOU ARE DOING!!!!!!!!!  You may need
to shrink existing filesystems and then their corresponding logical
volumes - then increase other logical volumes and their corresponding

If you also mirror disks (I do), then this is really nice because you can migrate to bigger disks while the system is running, except for 2 reboots for hardware swaps! I have done this a few times (e.g., 2010-11 for my MythTV server), it's awesome.

To oversimplify quite a bit:
	0) Make sure your mirror is in sync
	1) Down and swap in bigger drive as #2
		# Save original drive #2, it's your backup!
	2) Re-mirror #1 to new bigger #2
	3) Down and swap in bigger drive as #1
	4) Resize (enlarge) the RAID and LVM devices
	5) Re-mirror #2 to new bigger #1 (don't screw this up!)

Aside from the reboots, all of this happens while the system is live, though of course it'll run slower.

Some of the re-size commands:
	mdadm -v --grow /dev/md1 --bitmap none
		# Bitmaps BAD when resizing!
	mdadm -v --grow /dev/md1 --size max
	mdadm -v --wait /dev/md1
		# Waits until re-synced, takes hours
	lvresize --verbose -l +297350 /dev/vg_mythtv-be-01/lv_root
	resize2fs -p /dev/vg_mythtv-be-01/lv_root

If this is on a laptop might not hurt to bring it to a PLUG meeting or
otherwise work with somebody who is familiar with LVM.  Or you can
learn about it online, but make sure you understand what is going on
or (ideally and) have good backups.

The other nice thing about LVM is that it allows for "snapshots." Maybe. The capability is there, but to actually use it requires that you have some "free extents" which you will not have if you did a guided setup in Ubuntu. (I filed a bug about that a long time ago.) Basically, if you create a snapshot, the CoW (copy on write) data has to go somewhere, and if all space is already used, you're toast.

I set up LVM with about 2-3% of space free, so that I can use snapshots for backup purposes if I want to. Having said that, I've never actually gotten around to *doing* that. But the plumbing is all there, all I'd need to do script it. :-)

As I understand it, all of the LVM type stuff will eventually go away if/when btrfs goes fully production. But that's years out, as discussed elsewhere.

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --