If I start with three physical devices in a volume group and stripe a logical volume across all three physical disks, can I later add a fourth disk to the vg and re-stripe it across all four disks? I've been trying to divine this from various docs and it is unclear.
Actually, you would do the following:
1) Unmount the file system that mounts the volume.
2) Use pvcreate to initialize the device to be added to the volume group.
3) Use vgextend to add that device into the volume group.
4) then you would use lvresize to increase logical volume if necess
5) Then you would run e2fsck -f on the file system, as you cannot resize it without running that command.
6) Then you would execute resize2fs command on the file system.
7) Finally, you will remount the file system.
So partly from memory, assuming that /dev/sda/b/c are the drives under volume group vg with a lvm group lv and d is your new drive and that is mounted under /mnt/l:
umount /mnt/l pvcreate /dev/sdd vgextend vg /dev/sdd lvresize -L +5000 lv e2fsck -dev /dev/vg/lv resize2fs /dev/vg/lv mount /dev/vg/lv /mnt/l
On every be sure to run pvdisplay (to very that the physical volumes are added), vgdisplay (to verify that the volume group has been extended) and lvdisplay (to verify that logical volumes have been extended).
Thanks. To be clear, this can be used to not only extend an lv across disks in a concatenated fashion, but, specifically, to increase from a three-disk stripe set to being striped across four disks, etc?– NJ01Jul 23, 2011 at 0:30
You can use -i to specify the number of stripes when extending the disk. If you are still not sure, you can always backup the data, remove and then recreate the LV volume if you are not sure.– RilindoJul 23, 2011 at 2:50
Yes, the command is lvextend. After extending the volume, you need to extend the file system as well. So, your question is more like if you can extend the file system, as you do not specify what you use.