[linux-lvm] Filesystem corruption with LVM's pvmove onto a PV with a larger physical block size

Stuart D. Gathman stuart at gathman.org
Thu Feb 28 01:52:04 UTC 2019


On Thu, 28 Feb 2019, Cesare Leonardi wrote:

> Not to be pedantic, but what do you mean with physical block? Because with 
> modern disks the term is not always clear. Let's take a mechanical disk with 
> 512e sectors, that is with 4k sectors but exposed as 512 byte sectors. Fdisk 
> will refer to it with these terms:
> Sector size (logical/physical): 512 bytes / 4096 bytes
>
> What you are referring as physical size is actually the logical size reported 
> by fdisk, right? And if it's correct, I guess that should be safe to add the 
> above disk with 512e sectors to an LVM storage composed only by disks with 
> real 512 byte sectors. I expect that from the LVM point of view this should 
> not be even considered a mixed sector size setup, even if the real physical 
> sector size of the added disk is 4096 byte.
>
> Do you agree or do you think it would be better to test this specific setup?

I would definitely test it, using the same test script that reproduces the 
problem with loopback devices.

That said, I believe you are right - it should definitely work.  Most of
my drives are 512/4096 logical/phys.  If you actually write a single 512
byte sector, however, the disk firmware will have to do a
read/modify/write cycle - which can tank performance.

hdparm will report logical and physical sector size - but there doesn't
seem to be an option to set logical sectory size.  There really is no
need once you already support a smaller logical sector size, as the
performance hit can be avoided by aligned filesystems with 4k+ block
size (most modern filesystems).

Once I encountered a bug in drive firmware where the R/M/W did not
work correctly with certain read/write patterns (involving unaligned
multi sector writes).  I do not wish that on anyone.  (don't worry,
that drive model is long gone...).

-- 
 	      Stuart D. Gathman <stuart at gathman.org>
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list