Can I control which physical volume(s) in a volume group will be used first?

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.

Supernormal

Posted 2014-08-21T12:13:29.303

Reputation: 111

Answers

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-

Loki

Posted 2014-08-21T12:13:29.303

Reputation: 3

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? – Supernormal – 2014-08-21T18:53:17.987