Linux – Physical and logical extents size

linuxlvmperformance

I have created a partition with 36TB (/dev/sdb1) in rhel 6.6.
Now I want use this for LVM.

  • What is recommended size for Physical Extents, Volume Extents and Logical Extents?
  • How important PE, VE and LE size to define while creating?

I want to create LV size of 10TB, 10TB, 6TB.
I am using for file sharing through NFS and samba. Performance should be good. Please guide me for this…

Best Answer

First off, you're confused about what some of those are. You can set the physical extent size with a fair bit of flexibility (vgcreate -s <size-of-PE>). But it doesn't matter, you should just go with the default. To quote the manpage:

The default is 4 MiB.… [H]aving a large number of extents will slow down the tools but have no impact on I/O performance to the logical volume.

When they say "no impact on I/O performance", they mean that literally. LVM is a wrapper around device-mapper and the LVM tools do not expose the physical extent size to device-mapper. The actual kernel code doing the I/O is unaware of the extent size. So it doesn't matter, unless you need to run lvcreate (etc.) all the time as part of your workload.

(Note it can influence data alignment; see below.)

The size in logical extents (set with lvcreate -l «number-of-extents») is just a way to specify the size of the logical volume. LV size = physical extent size * number of extents. Generally though you'd use -L «size» because that does the math for you, and let's you specify human-friendly sizes like 10T

I'm not sure what you mean by "volume extents", unless you mean the same as the above. Or maybe you mean the length of a physical volume in extents, but that'd also just be another way to specify the size.

What you should care about

At 36TB, your sdb is very unlikely to be a plain old disk. You should find out its alignment requirements and make sure you get everything aligned correctly. This is easiest if data_alignment_offset_detection (see man 5 lvm.conf) works in your setup—then the LVM tools will handle this all for you. Allocation (of a logical volume) is done in entire physical extent chunks, so you probably want the PE size to be a multiple of your alignment size. But at 4MiB, it probably already is. Misalignment will kill I/O performance, especially of writes.

You should also ensure that you're using an appropriate RAID level for your workload. Consider also battery-backed cache.

Related Question