Force Contiguous Extents in LVM

By | 03/10/2009

This afternoon I was doing a little reading about the best method for installing Arch Linux on LVM.  The process is easy if you’re familiar with LVM–if you’ve setup LVM manually.  If you don’t understand how LVM works or if you’ve only ever done automated or graphical LVM creation it’ll be more work.  It has to be done manually and outside of the main setup utility.  In any event, an explanation of LVM is for another post.  During the reading I did learn a little tip about how to force your logical volumes to use contiguous partitions/disks/extents.

In situations where disk performance is critical, forcing your logical volumes to use contiguous extents (or not span multiple physical drives, in the case) can be beneficial.  To force your logical volume to use contiguous extents at creation you need to use the -C option.  Example:

lvcreate -C y -L 10G VolGroup -n swap

I’ll break down this command for those that aren’t familiar.

lvcreate is the command used to create a logical volume from a volume group. In this case the group is called “VolGroup” and we’re giving the new volume the name (-n) “swap”. We’ve given it 10G worth of space, and the -C y tells it to use contiguous extents, yes.

Remember, this command and this option are for initial creation of logical volumes.  I’m not familiar with any method of tuning existing logical volumes to the same end.  If anyone is familiar with such an option I’d be very interested.

Perhaps I’ll do a post regarding how to manually create some basic logical volumes for use with an Arch installation.  Until then, I’m back to my reading.

One thought on “Force Contiguous Extents in LVM

  1. Aziz

    I tried the command on my running opensuse 11.1 setup.

    The switch can be turned off/on using the command lvchange.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *