[linux-lvm] Aligning PVs on SSDs?

Roy Sigurd Karlsbakk roy at karlsbakk.net
Sat Jul 11 10:23:37 UTC 2009


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?


> ...
> 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
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.

More information about the linux-lvm mailing list