The question is not very clear, but I will try to answer anyway.
First thing is that VG itself cannot store data (OK, it can, but there are little chances that you are using it this way). Second thing - LVM does not see disks, but physical volumes.
Usually data is stored on partitions defined under logical volumes. One VG can contain many LVs on many PVs. An image from Wikimedia may help:
Now it depends on how have you configured your LVs - as linear, stripped or mirrored volumes. Also, normally LVs are placed on PVs in order, but you may force LVM to place them on specific PVs.
If a disk containig a PV will fail, there are two main things that can happen:
- if a PV contained no LV, LVM will shout that it cannot find that PV, but data stored on other LVs will be safe
- if there was at least a part of a logical volume on the missing PV, the filesystem defined on that LV will certainly be corrupted. Now it depends on the filesystem used how many data you will lose and how hard it will be to recover the remaining part.
Of course if you have configured LVM in stripped mode, most probably every single disk that fails will make all filesystems on all LVs corrupted.
If you want to read more about LVM internals, there is a good article in RedHat magazine:
http://www.redhat.com/magazine/009jul05/features/lvm2/
I am not aware of any requirement that swap space be contiguous on disk under Linux, with LVM or otherwise. I have never arranged for my swap LVs to be contiguous and have never run into any problem (it's possible that all my swap LVs just happened to be contiguous, I've never looked).
Linux supports non-contiguous swap files, it would be odd to have such a restriction on LVM volumes. I can't find any reference to this in any official documentation or anyone explaning why swap LVs should be contiguous. This has all the hallmarks of an urban legend.
The origin may lie in HP-UX, which Linux's LVM is partly inspired from, and which did (does?) require swap space to be contiguous. I don't know that this has ever been the case on Linux.
There may be a perceived performance benefit, but with 4MB extents, I very much doubt there is any performance benefit, and I can't find any benchmark.
If you have volume groups that span over multiple disks, you may want to constrain what PV the swap LV is on. But I wouldn't require a contiguous volume.
Best Answer
If you pass a
-vv
flag to thepvcreate
command it makes the command more verbose and you will see that pvcreate creates a metadata area on the disk.I am not aware of a command that you can use to view the metadata, but the command
vgcfgbackup
can be used to backup the metadata and you can open a backup file thus created to view the metadatavgcfgbackup -f /path/of/your/choice/file <your_vg_name>
The
/path/of/your/choice/file
created by the above command will contain the PV, VG and LVM metadata. One of the sections will look like below:I suggest you take a look at the contents of the directory
/etc/lvm
and the output of the commandlvm dumpconfig
Yes, you can.
You can migrate Volume Groups to another host. Though its not exactly plug-and-play, the procedure to do this is pretty straight-forward. There are dozens of tutorials available online how to do this.
This serverfault thread discusses about moving an LVM partition to another host using the
dd
command.