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

Nir Soffer nsoffer at redhat.com
Tue Mar 5 16:29:31 UTC 2019

On Tue, Mar 5, 2019 at 11:30 AM Ilia Zykov <mail at izyk.ru> 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.
> 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.

I don't this way of thinking is useful. If we go in this way, then write()
should not
let you write data, and later maybe the disk controller should avoid this?

LVM is not a low level tool like dd. It is high level tool for managing
device mapper,
and providing high level tools to create user level abstractions. We can
expect it
to prevent system administrator from doing the wrong thing.

Maybe LVM should let you mix PVs with different logical block size, but it
require --force.

David, what do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20190305/dbea40a8/attachment.htm>

More information about the linux-lvm mailing list