Re: Any way in LVM to deal with 512e vs 4Kn physical devices?

Zdenek Kabelac <[email protected]> Wed, 17 Jan 2024 11:36:24 +0100
Newsgroups gmane.linux.lvm.general
Message-ID <[email protected]>
Dne 16. 01. 24 v 21:17 Andy Smith napsal(a):
> Hi,
> 
> On Tue, Jan 16, 2024 at 10:30:36PM +0300, Ilia Zykov wrote:
>> Sorry, I could be wrong, but I was encountered this problem a long time ago.
>> You cannot transfer ext4 from a device with a phys sector 512 bite to a
>> device with phys 4k sector device.
> 
> I have read several other accounts which agree with this. I will
> test just directly putting an ext4 fs on an LV that's backed by 512e
> drives and then copying an image of that to an LV that is backed by
> 4Kn drives, just to see what happens, though.
> 
>> In datasheet for you model tells:
>> * 512e models can be converted to 4Kn format and
>> vice versa.
>> I don't understand what is it mean, but maybe you can try convert to 512e if
>> possible.
> 
> I think it means that using hdparm to set its sector size to 512 is
> possible, though that would invalidate all the data currently on
> the drive (which is fine in this case).
> 
> There would of course also be vendor tools to change the sector
> size, but I think hdparm should work if the data sheet says the
> procedure is possible.
> 
> I'll let you know!
> 

Some words from lvm2 perspective.

Lvm tool as such doesn't really have any problems with mixing 4K and 512b 
disks within a single VG - however there are number of issues that will rise 
when an LV starts to be 'mixed' and using such 2 different devices together. 
This is confusing number of filesystem (XFS is one of those), where it 
suddenly starts to fall apart - as devices have different level of write 
atomicity - so it may severely corrupt your filesystem.

So in lvm2 we rather decided to disable the mixed usasge - if the user is 
skilled enough to deal with troubles, such protection can be disabled (see 
allow_mixed_block_size in lvm.conf).

Regards

Zdenek