1

I just set up my swap to use LVM, with a volume group that contains two physical volumes: one partition on an SSD and one partition on an HDD (because the space available on my SSD wasn't large enough for the swap partition I want).

Now, I would like my swap to use the SSD partition until it's full, and only use the HDD part when necessary. Is there any way to specify such a preference in LVM? I use lvm2.

0

This is all I found in lvm doku:

To create a logical volume to be allocated from a specific physical volume in the volume group, specify the physical volume or volumes at the end at the lvcreate command line. The following command creates a logical volume named testlv in volume group testvg allocated from the physical volume /dev/sdg1,

lvcreate -L 1500 -ntestlv testvg /dev/sdg1

You can specify which extents of a physical volume are to be used for a logical volume. The following example creates a linear logical volume out of extents 0 through 25 of physical volume /dev/sda1 and extents 50 through 125 of physical volume /dev/sdb1 in volume group testvg.

lvcreate -l 100 -n testlv testvg /dev/sda1:0-25 /dev/sdb1:50-125`

The following example creates a linear logical volume out of extents 0 through 25 of physical volume /dev/sda1 and then continues laying out the logical volume at extent 100.

 lvcreate -l 100 -n testlv testvg /dev/sda1:0-25:100-
1
  • Thanks; but wouldn't that essentially be the same as not using LVM, but using only that partition for swap? Meaning that it can't grow larger than the partition (physical volume) that is specified when doing lvcreate? Aug 21 '14 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.