[mythtv-users] An LVM'd drive died! What do I do...

Martin Ebourne lists at ebourne.me.uk
Thu Oct 27 05:22:45 EDT 2005


On Wednesday, October 26, 2005 10:35 PM, Bryan Halter wrote:
> As far as I know if you lose a disk in an LVM dies you're SOL. 

Wrong. At least for the LVM, obviously you've lost that disk.

On Thu, 27 Oct 2005 13:41:28 +0900, David Bennett wrote:
> I have seen the same article about reducing the size on LVM... I guess I'm
> just unclear about what I would lose if I lost an LVM'd drive (stemming
> from the fact i dont know how LVM data is stored.) Are bits of one file
> stored across multiple drives, or would the loss of a drive result in the
> loss of complete files?
> 
> I'd be curious to know if anyone has lost any an LVM drive with their Myth
> video directory and what happened...

If a disk goes down in an LVM set this is what happens:

1. Your machine will probably not boot because the volume group is
incomplete. Make sure you've got a rescue CD to boot off for this
eventuality.

An alternative that I use (my server has lots of disks, but
no CD) is to have two separate volume groups on different disks, each with
a root logical volume on. Thus I can boot into either LVM and none of the
disks are shared between volume groups, so one will always boot.

2. Having booted from the rescue CD you need to activate your LVM:

vgchange -ay -P

That activates all logical volumes except any on a missing disk. This is
the key command to get the system up again. -P is for partial volume group.

At this point any logical volumes entirely on a good disk are totally safe
and fully functional. Any logical volumes entirely on the bad disk are
gone of course. Any logical volumes partially on the bad disk are there,
but the filesystem will be broken due to it missing a chunk. Best bet is
to try to fsck it, mount it readonly, and get the data off quick. YMMV

3. Your system should reboot fine now, but without the disk and its
logical volumes.

Key points to learn from this to save your data:

1. Rescue CD or other means of booting

2. Don't stripe volumes. The default is not to, so if you didn't do this
intentionally you're ok.

3. Don't split logical volumes over physical volumes unless you absolutely
have to.

Here I've got 10 logical volumes in 2 volume groups (main and backup),
over 5 physical volumes (disks). All but one of those logical volumes are
on one disk only, and the one that's split over disks is only split
because it's bigger than any of the disks.

You can find out how your logical volumes are split by using:

lvdisplay -m

That lists the mapping to physical volumes.

You can give a physical volume name to lvcreate and lvextend to control
the placement in future. You can use pvmove to fix any split logical
volumes you already have. (Assuming sufficient disk space to move stuff
around.)

Cheers,

Martin.



More information about the mythtv-users mailing list