On 01.03.2019 02:24, Cesare Leonardi wrote: > On 28/02/19 09:41, Ingo Franzki wrote: >> Well, there are the following 2 commands: >> >> Get physical block size: >> blockdev --getpbsz <device> >> Get logical block size: >> blockdev --getbsz <device> > > I didn't know the blockdev command and, to recap, we have: > --getpbsz: physical sector size > --getss: logical sector size > --getbsz: blocksize used internally by the kernel > > getpbsz/getss correspond to physical/logical sector size reported by fdisk, > smartctl, etc. > >> Filesystems seem to care about the physical block size only, not the logical >> block size. >> >> So as soon as you have PVs with different physical block sizes (as reported >> by blockdev --getpbsz) I would be very careful... > > I've done the test suggested by Stuart and it seems to contradict this. > I have pvmoved data from a 512/512 (logical/physical) disk to a newly added > 512/4096 disk but I had no data corruption. Unfortunately I haven't any > native 4k disk to repeat the same test.
Hmm, maybe the size of the volume plays a role as Bernd has pointed out. ext4 may use -b 4K by default on larger devices. Once the FS uses 4K block anyway you wont see the problem. Use tune2fs -l <device> after you created the file system and check if it is using 4K blocks on your 512/512 device. If so, then you won't see the problem when moved to a 4K block size device. > > Here is what I've done. > /dev/sdb: SSD with 512/512 sector size > /dev/sdc: mechanical disk with 512/4096 sector size > > # blockdev -v --getss --getpbsz --getbsz /dev/sdb > get logical block (sector) size: 512 > get physical block (sector) size: 512 > get blocksize: 4096 > > # blockdev -v --getss --getpbsz --getbsz /dev/sdc > get logical block (sector) size: 512 > get physical block (sector) size: 4096 > get blocksize: 4096 > > # pvcreate /dev/sdb4 > # vgcreate vgtest /dev/sdb4 > # lvcreate -L 1G vgtest /dev/sdb4 > # mkfs.ext4 /dev/mapper/vgtest-lvol0 > # mkdir /media/test > # mount /dev/mapper/vgtest-lvol0 /media/test > # cp -a SOMEDATA /media/test/ > # umount /media/test > # fsck.ext4 -f /dev/mapper/vgtest-lvol0 > > Filesystem created and no error on it. Now the disk with different physical > size: > > # pvcreate /dev/sdc1 > # vgextend vgtest /dev/sdc1 > # pvmove /dev/sdb4 /dev/sdc1 > # fsck.ext4 -f /dev/mapper/vgtest-lvol0 > # mount /dev/mapper/vgtest-lvol0 /media/test > # ls /media/test/ > > The fsck command reports no errors, the filesystem is mountable and the data > is there. > > Looks like physical sector size didn't matter here. Or I'm missing something? > > Cesare. > > _______________________________________________ > linux-lvm mailing list > linux-lvm@redhat.com > https://www.redhat.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/ > > -- Ingo Franzki eMail: ifran...@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/ _______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/