LVM rocks!

I knew my persistence with using LVM would pay off one day. Despite the little mishap I had last year :-)

For a shiny new install of 64-bit Debian I chose to let the installer partition up my entire harddisk and instructed it to use LVM. This morning I noticed that the root partition was down to only 25% free space and during an upgrade it ran out of space. Not really a good thing. So, shut down the machine and out with the extra harddisk I’ve been putting off sticking in the machine. Here’s what I did after booting:

  1. Create a single large partition and make it of type Linux LVM (8e) using cfdisk.

  2. Prepare the new partition for use with LVM:

     # pvcreate /dev/sdb1
  3. Add the new ‘physical volume’ into the ‘virtual group’:

     # vgextend mainvg /dev/sdb1
  4. Extend the ‘logical volume’ where root lives:

     # lvextend --extents +50%LV /dev/mainvg/root
  5. Then it turns out that Ext3 has no problem with extending a mounted filesystem so the last step was easy, but a little nerve wrecking since it was my root partition:

     # resize2fs /dev/mainvg/root

All done!

⟸ Continuing with continuations Why is constant improvement such an alien concept in large organisations? ⟹

Stefan Monnier

Just a note about spreading a volume group over several disks: be careful that the volumes you create in this volume group are not spread over 2 disks, otherwise, if you lose one of the disks, you’ll lose the whole filesystem.

Leave a comment