2

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.

1 Answers1

1

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-
Loki
  • 13