[linux-lvm] Re: Aligning PVs on SSDs?

Mike Snitzer snitzer at redhat.com
Sat Jul 11 13:51:44 UTC 2009


You want to use: pvcreate --dataalignment 128k /dev/sdXX

This will guarantee that the start of the data area (pe_start) is
aligned on a 128k boundary.


On Sat, Jul 11 2009 at  6:23am -0400,
Roy Sigurd Karlsbakk <roy at karlsbakk.net> wrote:

> Hi
> I came across an article on 
> http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/ 
>  about filesystem alignment. This mentions some issues about aligning  
> PVs in 128k bounderies. See snipped-out text from the article below.
> Are there flags like these or similar in helping admins using SSDs more 
> efficiently?
> roy
>> ...
>> So I created a 1 gigabyte /boot partition as /dev/sdb1, and allocated 
>> the rest of the SSD for use by LVM as /dev/sdb2. And that’s where I ran 
>> into my next problem. LVM likes to allocate 192k for its header 
>> information, and 192k is not a multiple of 128k. So if you are creating 
>> file systems as logical volumes, and you want those volume to be 
>> properly aligned you have to tell LVM that it should reserve slightly 
>> more space for its meta-data, so that the physical extents that it 
>> allocates for its logical volumes are properly aligned. Unfortunately, 
>> the way this is done is slightly baroque:
>> # pvcreate –metadatasize 250k /dev/sdb2
>> Physical volume “/dev/sdb2″ successfully created
>> Why 250k and not 256k? I can’t tell you — sometimes the LVM tools  
>> aren’t terribly intuitive. However, you can test to make sure that  
>> physical extents start at the proper offset by using:
>> # pvs /dev/sdb2 -o+pe_start
>> PV         VG   Fmt  Attr PSize  PFree  1st PE
>> /dev/sdb2       lvm2 –   73.52G 73.52G 256.00K
>> If you use a metadata size of 256k, the first PE will be at 320k  
>> instead of 256k. There really ought to be an –pe-align option to  
>> pvcreate, which would be far more user-friendly, but, we have to work 
>> with the tools that we have. Maybe in the next version of the LVM 
>> support tools….
>> ...
> --
> Roy Sigurd Karlsbakk
> (+47) 97542685
> roy at karlsbakk.net
> http://blogg.karlsbakk.net/
> --
> I all pedagogikk er det essensielt at pensum presenteres intelligibelt. 
> Det er et elementært imperativ for alle pedagoger å unngå eksessiv 
> anvendelse av idiomer med fremmed opprinnelse. I de fleste tilfeller 
> eksisterer adekvate og relevante synonymer på norsk.
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

More information about the linux-lvm mailing list