размер экстента на LVM2

327
piotrek

в LVM1 был предел 65 тыс. расширений. Таким образом, размер экстента должен был тщательно выбираться между потерянным пространством на разделах (в большой степени) и максимально возможным размером логического тома (слишком малый экстент). в lvm2 (согласно http://docstore.mik.ua/manuals/hp-ux/en/5992-4589/apa.html ) ограничение составляет ~ 16 миллионов экстентов. поэтому размер по умолчанию 4 МБ дает ~ 60 ТБ размера LV.

так есть ли смысл делать экстент больше 4-16мб на рабочем столе? есть ли снижение производительности или другие затраты, связанные с большим количеством экстентов?

0

1 ответ на вопрос

0
Cristian Ciupitu

From the vgcreate(8) man page:

If the volume group metadata uses lvm1 format, extents can vary in size from 8KiB to 16GiB and there is a limit of 65534 extents in each logical volume. The default of 4 MiB leads to a maximum logical volume size of around 256GiB.

If the volume group metadata uses lvm2 format those restrictions do not apply, but having a large number of extents will slow down the tools but have no impact on I/O performance to the logical volume. The smallest PE is 1KiB.

So there's no performance degradation for I/O if you have many extents. Reading or writing take the same time independent of the extents size. Though it should probably be at least 4KiB so there are no issues with hard-disks using Advanced Format.

On the other hand tools like pvmove will have to deal with more extents so there might be tiny slowdown. Though for a home user, a delay of probably 5 seconds shouldn't be a big deal.

A reason for using large extents might be that they make the logical volumes less prone to fragmentation in time after moving and resizing them several times. For example if the PE is small, a PV containing LVs o and x could look this:

xoooxxooxooxxxxxxxxxxxxoxxxxoxxxxxxoxooxxoxxoxxxxooxxxooxxoo 

But if the PE is large, it could look more like this:

ooooxxxxxxxxxxxxxxxxxxxxxxxxooooxxxxxxxxooooooooxxxxxxxxoooo 

Of course there's nothing stopping you from choosing manually what PEs are allocated to what LVs, but I think a lot of people prefer using LVM's default.

Похожие вопросы