I currently have several logical volumes (LVs) on a volume group (VG). This VG is hosted on a single physical volume (PV). I have a spare drive which I can use to shuffle data around on.
I also now have a new drive which matches my original PV drive. I would like to move the existing LVs around and end up with the LVs being striped across the two PVs. Is this possible? How do you do it?
Best Answer
It seems this is not possible from the commandline.
striping
is quite different from the defaultlinear
allocation scheme. So while you can grow a file system across multiple physical volumes (PV
), you do not get the "load balancing" advantages of striping.To grow the filesystem, you would do something like this:
In the above example,
md2_crypt
is a crypto volume on top of a RAID-1 array, but it could be any device.crypto
is the volume group (VG
) andcrypto-srv
is the logical volume that holds the filesystem mounted on/srv
.This will not make the
/srv
partition striped across the PVs. This is because there are no userland tools to supportlinear
tostriped
conversions. Logically, this would be in thelvconvert
command, but that only supports moving fromlinear
tomirror
mode and back, for example. And with all the new development going into BTRFS, I would be surprised if this ever documented.One thing you can do however, is have the new data on the drive be striped. That is rather tricky, but it can be done. Let's assume we want to stripe
crypto-tmp
, the LV for/tmp
. We first need to free up space for the stripes in the first PV:This will reallocate the LV across the PVs, in my case it moved it all to the second PV:
Now you can grow the filesystem (say we double its size) and tell LVM to stripe the new data:
Now the new data for
/tmp
is striped across the two PVs:But the original data is still in
linear
mode. It may be possible to move the filesystem to the striped extents, but consider that an exercise to the reader at this point. :)See also Growing a LVM volume with striping and Redhat LVM changing stripes?.
Also note that the reverse (converting
striped
tolinear
) is possible, however: Is it possible to convert striped logical volume to linear logical volume?.