Image of the glider from the Game of Life by John Conway
Skip to content

LVM FYI

When creating logical volumes, you may want to backup your data before you run 'pvcreate'. Take it from me, who is sitting at his computer at 1 in the morning pulling his hair out, as he lost a *lot* of data, and is currently reinstalling Ubuntu 7.10. Yeah, I know all about version control and keeping backups. I don't want to hear it. Just FYI- backup your data *before* running 'pvcreate'.

That is all.

{ 5 } Comments

  1. Dennis Krul using Firefox 2.0.0.10 on Ubuntu | January 9, 2008 at 2:35 am | Permalink

    Uhm.. If you want to create a logical volume you have to use the lvcreate command. The pvcreate command creates a physical volume.

    Only use pvcreate on empty disks! And then use vgcreate to create a volume group on it (or vgextend to extend an existing one). After that use lvcreate to create a logical volume on the volume group.

    That being said, in most cases you can recover from a broken LVM configuration. Boot from a rescue cd. Find your backups in /etc/lvm/backup and you can look up the disk id's and write them back to your physical disk using pvcreate --uuid [id-from-lvm-backup] /dev/disk. Then reactivate your volumegroup (vgchange -a y /dev/vgname) and mount your logical volumes like nothing happened.

    That is ofcourse a bit more complicated when /etc resides on the volume group you're trying to recover ;)

  2. Serge van Ginderacht using Firefox 2.0.0.11 on Ubuntu | January 9, 2008 at 3:04 am | Permalink

    Can you elaborate on what exactly happens? Is this a known bug? What is crashing exactly? The whole LVM system? The current volume group? thx

  3. Serge van Ginderacht using Firefox 2.0.0.11 on Ubuntu | January 9, 2008 at 3:09 am | Permalink

    Ouch, I read over the exact statements. Like Dennis says, 'pvcreate' only a diskpartition which is not in use yet :-)

  4. dbr using Camino 1.5.3 on Mac OS | January 9, 2008 at 8:43 am | Permalink

    2/Serge van Ginderacht:
    It's as big a bug as rm -rf /, really. It just wipes the disc because you told it to create a LVM volume on that disc.

    One thing, although probably too late if you're installing stuff back over it. If you created a new partition on the disc, chances are you've not actually destroyed the data, just the refernces too it (I.e it's still on the disc)

    The author of the http://www.linux.com/articles/56588 article has more or less the same problem as you (wiped data accidently), and includes a fairly detail description of how he recovered the data.

  5. Tony Yarusso using Firefox 2.0.0.5 on Windows XP | January 9, 2008 at 1:03 pm | Permalink

    I've been trying to diligently do backups to avoid this sort of thing, but I've been disappointed in what's out there. However, sbackup ("Simple Backup Suite") is really close - all I ask is the addition of scp so that it can make use of passwordless SSH-key-enabled authentication rather than storing passwords in config files.

Post a Comment

Your email is never published nor shared.

Switch to our mobile site