Is LVM safe?
With a 'standard' disk partition (ext3, etc.) I can be confident that if I have the partition I have the data: I can always just move the disk to another system and mount it. Is the same true for LVM?
I am concerned that the LVM system also seems to need some information kept on the host files system in /etc/lvm* and that if I lose that I'm in serious trouble.
John
Quoted 7 lines · John Rowe
With a 'standard' disk partition (ext3, etc.) I can be confident that if I have the partition I have the data: I can always just move the disk to another system and mount it. Is the same true for LVM?
I am concerned that the LVM system also seems to need some information kept on the host files system in
/etc/lvm*and that if I lose that I'm in serious trouble.
The main difference between a partition and lvm is in my eyes that in lvm you usually do not have a single disk where your data is on. Instead you will have a bunch of disks and possibly your data are spread across all of these disks (depending on the setup of your volumegroups).
So if you want to move your disk to another system you will have to move all disks that have been part of the lvm structure. Since lvm scans all disks to build up the volumegroups and logical volumes it should also work after you moved your disks to another system.
If you modified you /etc/lvm/lvm.conf file you probably will have to take a look at this file on the old and new system to get things right since you can for example determine which of the systems disks are scanned for physical volumes and volumegroups. Since there might be a different set of disks in the old and new system (aside from the disks you moved) the configuration could need an update in this case.
Have a nice day
Rainer
Signature · 6 lines
--------------------------------------------------------------------------- Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022 Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312 Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html ---------------------------------------------------------------------------
Quoted 8 lines · Rainer Krienke
The main difference between a partition and lvm is in my eyes that in lvm you
usually do not have a single disk where your data is on. Instead you will have a bunch of disks and possibly your data are spread across all of these
disks (depending on the setup of your volumegroups).
(snip)
Hmm.
The thought just crossed my mind that the failure rate of the LVM would be the sum of the failure rates of all the disks in your LVM.
Quoted 2 lines · Erik Ohrnberger
The thought just crossed my mind that the failure rate of the LVM would be the sum of the failure rates of all the disks in your LVM.
You can run LVM on top of software RAID... (or indeed hardware RAID of course)
Thanks for the reply but this doesn't answer my question:
If I have a Physical Volume which is the only Physical Volume in a Volume Group, can I always recover the recover the Volume Group if I have absolutely nothing else just like I can with an ext3 partition?
It seems to me that the only possible answers are "yes" or "no", with "yes, but it's difficult" somewhere in between!
Thanks again.
John
Quoted 3 lines · John Rowe
If I have a Physical Volume which is the only Physical Volume in a Volume Group, can I always recover the recover the Volume Group if I have absolutely nothing else just like I can with an ext3 partition?
Yes, it's easy. You just need a kernel with DM-Support and the LVM2-Tools.
A simple
vgscan
vgchangs -ay
And you have your "Partitions" back.
Thanks, this is more or less what I've been trying:
#vgscan --mknodes -vv
Setting global/locking_type to 1
Setting global/locking_dir to /var/lock/lvm File-based locking enabled.
Wiping cache of LVM-capable devices
Wiping internal cache
Reading all physical volumes. This may take a while...
Finding all volume groups
/dev/md0: size is 0 sectors
/dev/hda1: size is 417627 sectors /dev/hda1: No label detected
/dev/hda2: size is 40965750 sectors /dev/hda2: No label detected
/dev/hda3: size is 6136830 sectors /dev/hda3: No label detected
/dev/hda4: size is 265056435 sectors /dev/hda4: lvm2 label detected
/dev/cdrom: open failed: No medium found
Finding all logical volumes
# vgchange -ay -vv
Setting global/locking_type to 1
Setting global/locking_dir to /var/lock/lvm
File-based locking enabled.
Finding all volume groups
/dev/hda1: No label detected
/dev/hda2: No label detected
/dev/hda3: No label detected
/dev/hda4: lvm2 label detectedBut it doesn't seem to find anything!
John
Quoted 9 lines · Philipp Riegger
Quoted 3 lines · John Rowe
If I have a Physical Volume which is the only Physical Volume in a Volume Group, can I always recover the recover the Volume Group if I have absolutely nothing else just like I can with an ext3 partition?
Yes, it's easy. You just need a kernel with DM-Support and the LVM2-Tools.
Quoted 6 lines
A simple
vgscan
vgchangs -ayAnd you have your "Partitions" back.
Well, it's not quite that simple - if something scribbles over your LVM metadata (i've never seen this happen where it wasn't user error), you need to do quite a bit more work to get things back so you can activate your LVs so you can fsck your ext3 partition. It usually involves at least running a vgcfgrestore against the backup file in /etc/lvm/backup. So yes, it can be more complicated if the lvm metadata gets broken - but this is similar to what happens if the partition table gets busted on a normal disk.
Signature · 8 lines
AJ Lewis Voice: 612-638-0500 Red Hat Inc. E-Mail: [email protected] One Main Street SE, Suite 209 Minneapolis, MN 55414 Current GPG fingerprint = D9F8 EDCE 4242 855F A03D 9B63 F50C 54A8 578C 8715 Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the many keyservers out there...
Quoted 5 lines
Quoted 2 lines
Yes, it's easy. You just need a kernel with DM-Support and the
But this is similar to what
happens if the partition table gets busted on a normal disk.
So the previous poster's "Yes" actually means "No". And a broken partition table will zap a disk with an LVM partition too won't it? So the bottom line is that if I want to move an LVM partition to a different system I have to hold my breath and pray.
The idea that a disk partition needs Unix file to be able to read it is absolutely astonishing.
John
Quoted 10 lines · John Rowe
Quoted 5 lines
Quoted 2 lines
Yes, it's easy. You just need a kernel with DM-Support and the
But this is similar to what
happens if the partition table gets busted on a normal disk.So the previous poster's "Yes" actually means "No". And a broken partition table will zap a disk with an LVM partition too won't it? So the bottom line is that if I want to move an LVM partition to a different system I have to hold my breath and pray.
No - that should just work. You just need to have the device-mapper kernel modules and the lvm2 tools. Then you do a 'vgscan && vgchange -ay' and it will be there.
Quoted 2 lines
The idea that a disk partition needs Unix file to be able to read it is absolutely astonishing.
What?
Signature · 8 lines
AJ Lewis Voice: 612-638-0500 Red Hat Inc. E-Mail: [email protected] One Main Street SE, Suite 209 Minneapolis, MN 55414 Current GPG fingerprint = D9F8 EDCE 4242 855F A03D 9B63 F50C 54A8 578C 8715 Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the many keyservers out there...
Quoted 6 lines
Quoted 4 lines
The idea that a disk partition needs Unix file to be able to read it is absolutely astonishing.
What?
I'm getting two different answers here. One person says I don't need /etc/lvm.*, the other says I do!
FWIW, I'm running Linux version 2.6.9-5.0.5.EL having 'upgraded' from RedHat9 to Scientific Linux 4 (a RedHat Enterprise clone), and I can't see my LVM..
Of course I have backups but it worries me for the future.
John
Quoted 9 lines · John Rowe
Quoted 6 lines
Quoted 4 lines
The idea that a disk partition needs Unix file to be able to read it is absolutely astonishing.
What?
I'm getting two different answers here. One person says I don't need
/etc/lvm.*, the other says I do!
Ok, so the only time you *need* /etc/lvm/* is if you have to recover from bad metadata. Every PV in your VG has a complete copy of the metadata for that VG, so you have multiple copies of the layout - if you have one of these, you can recover your LVM setup.
Quoted 3 lines
FWIW, I'm running Linux version 2.6.9-5.0.5.EL having 'upgraded' from RedHat9 to Scientific Linux 4 (a RedHat Enterprise clone), and I can't see my LVM..
Seeing the output of 'vgscan -vvv' and 'vgchange -ay -vvv' would be helpful - maybe you could toss it up on pastebin.com?
Quoted 1 line
Of course I have backups but it worries me for the future.
Signature · 8 lines
AJ Lewis Voice: 612-638-0500 Red Hat Inc. E-Mail: [email protected] One Main Street SE, Suite 209 Minneapolis, MN 55414 Current GPG fingerprint = D9F8 EDCE 4242 855F A03D 9B63 F50C 54A8 578C 8715 Grab the key at: http://people.redhat.com/alewis/gpg.html or one of the many keyservers out there...
Quoted 10 lines · John Rowe
Quoted 5 lines
Quoted 2 lines
Yes, it's easy. You just need a kernel with DM-Support and the
But this is similar to what
happens if the partition table gets busted on a normal disk.So the previous poster's "Yes" actually means "No". And a broken partition table will zap a disk with an LVM partition too won't it? So the bottom line is that if I want to move an LVM partition to a different system I have to hold my breath and pray.
No, it means "Yes" just like he said. There is a condition that you didn't explicitly state in the original question. If the LVM metadata is messed up somehow (which doesn't generally happen unless you do something stupid), you can't recover the LVM volumes without a filesystem backup of the metadata.
Quoted 2 lines
The idea that a disk partition needs Unix file to be able to read it is absolutely astonishing.
Umm, try this sometime...
dd if=/dev/zero of=/dev/hda bs=512 count=1
Then just try to resurrect the partition.
Unless you've created a backup of your partition table into a Unix file, then you aren't going to recover the partition table, period.
So, poof, there, you have a disk partition that needs a Unix file to be able to read it.
Since LVM maintains backups of all of this metadata in files, it's signficantly better for recovery than Unix partitions are.
*sigh*,
Signature · 4 lines
"It does me no injury for my neighbor to say there are twenty gods or no God. It neither picks my pocket nor breaks my leg." --- Thomas Jefferson "Go to Heaven for the climate, Hell for the company." -- Mark Twain -- Eric Hopper ([email protected] http://www.omnifarious.org/~hopper) --