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

Ingo Franzki ifranzki at linux.ibm.com
Tue Mar 5 11:42:52 UTC 2019

On 05.03.2019 10:29, Ilia Zykov wrote:
> Hello.
>>> THAT is a crucial observation.  It's not an LVM bug, but the filesystem
>>> trying to read 1024 bytes on a 4096 device.  
>> Yes that's probably the reason. Nevertheless, its not really the FS's fault, since it was moved by LVM to a 4069 device.
>> The FS does not know anything about the move, so it reads in the block size it was created with (1024 in this case).
>> I still think LVM should prevent one from mixing devices with different physical block sizes, or at least warn when pvmoving or lvextending onto a PV with a larger block size, since this can cause trouble.
> In this case, "dd" tool and others should prevent too.

Well, no, its LVM's pvmove who moves the data from a 512 block size to 4096 block size device.
So its not dd that's causing the problem, but pvmove. 

> Because after:
> dd if=/dev/DiskWith512block bs=4096 of=/dev/DiskWith4Kblock
> You couldn't mount the "/dev/DiskWith4Kblock" with the same error ;)
> /dev/DiskWith512block has ext4 fs with 1k block.
> P.S.
> LVM,dd .. are low level tools and doesn't know about hi level anything.
> And in the your case and others cases can't know. You should test(if you
> need) the block size with other tools before moving or copying.
> Not a lvm bug.
Well, maybe not a bug, but I would still like to see that LVM's pvmove/lvextend and/or vgextend issues at least a warning when you have mixed block sizes. 

LVM knows the block sizes of the PVs it manages and it also knows when it changes the block size of an LV due to a pvmove or lvextend. So it can issue a warning (better a confirmation prompt) when this happens.
> Thank you.

Ingo Franzki
eMail: ifranzki at linux.ibm.com  
Tel: ++49 (0)7031-16-4648
Fax: ++49 (0)7031-16-3456
Linux on IBM Z Development, Schoenaicher Str. 220, 71032 Boeblingen, Germany

IBM Deutschland Research & Development GmbH / Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM DATA Privacy Statement: https://www.ibm.com/privacy/us/en/

More information about the linux-lvm mailing list