Can a volume group have partitions from different disks?

0

I have two disks /dev/sdb and /dev/sdc, and I have a VG (vg00)

The volume group vg00 contains the LVM /dev/sdb1 but today I've extended the VG using vgextend and added /dev/sdc1 too.

It worked, but is this supposed to work? Will it cause errors in the future?

Thanks!

Mario

Posted 2019-09-18T12:38:30.593

Reputation: 63

It is supposed to work. – None – 2019-09-18T13:07:03.827

Answers

0

Yes, this is supposed to work.

One of the original purposes of a logical volume manager was so that you could create volume spanning multiple physical storage devices, so it would actually be kind of strange if you couldn't create volume groups spanning multiple disks.

As far as whether this may cause issues in the future, probably not. At least, not any more than you would normally expect from using multiple physical disks. LVM on Linux is actually pretty smart, and if you lose a single disk out of a volume group, you'll still be able to access any logical volumes in that volume group which were not on that missing disk (depending on the exact type of LV, you may be able to access some that were on that disk too).

There are a couple of important points to remember though:

  • All existing LV's will remain where they were when you extend a volume group. So, unless you've created new LV's or manually moved existing ones, all your data is still on/dev/sdb1.
  • The rules LVM uses when picking where to place newly created LV's are sometimes unintuitive. As a result, it's generally considered best practice to explicitly tell LVM where to put any newly created LV's. You can do this by putting the partition name you want the LV to be on at the end of the lvcreate command.
  • Once you extent a volume group, you can move data between partitions using LVM's pvmove command. This works on-line, without having to unmount any LV's it's operating on first, and can move either an entire physical volume, or selectively move the blocks for a single LV.

Austin Hemmelgarn

Posted 2019-09-18T12:38:30.593

Reputation: 4 345