From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1FB6060C47 for ; Fri, 1 Mar 2019 02:56:47 +0000 (UTC) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 450A531642F4 for ; Fri, 1 Mar 2019 02:56:45 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id h58so18764866edb.5 for ; Thu, 28 Feb 2019 18:56:45 -0800 (PST) Message-ID: <5c789f6a.1c69fb81.bdd85.c1bb@mx.google.com> MIME-Version: 1.0 From: Bernd Eckenfels Date: Fri, 1 Mar 2019 03:56:41 +0100 In-Reply-To: References: <253b63e7-e23b-9a0a-d677-a114c00a5134@linux.ibm.com> <2c295ce3-2766-ba41-4bba-575c799b3d46@gmail.com> <443f1e98-1dec-17e5-f38d-cbbd52cd541c@linux.ibm.com> <11dcbee0-ec65-d5d2-b07c-9937b99cc5b4@linux.ibm.com> Content-Type: multipart/alternative; boundary="_430F1F8F-EFEF-437A-AC80-3DA586F1ADBB_" Subject: Re: [linux-lvm] Filesystem corruption with LVM's pvmove onto a PVwith a larger physical block size Reply-To: LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: To: LVM general discussion and development , Ingo Franzki --_430F1F8F-EFEF-437A-AC80-3DA586F1ADBB_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hello, I think the filesystems address in Logical blocks, so this is the size whic= h should match. However the physical size might be relevant for alignment/sizing decisions = of mkfs (but you would expect the to be encoded in the metadata of the fil= esystem so you can transport them (losing proper alignment which might affe= ct Performance or robustness). For ext3/4 I think the mkfs will use -b 4k by Default if your FS is at leas= t 0,5GB. BTW: some applications (like SQL Server) also care about the physical size = to make sure they always write complete sectors in transactions and avoid r= ead-modify-write scenarios. =20 Gruss Bernd --=20 http://bernd.eckenfels.net Von: Cesare Leonardi Gesendet: Freitag, 1. M=C3=A4rz 2019 02:24 An: Ingo Franzki; LVM general discussion and development Betreff: Re: [linux-lvm] Filesystem corruption with LVM's pvmove onto a PVw= ith a larger physical block size On 28/02/19 09:41, Ingo Franzki wrote: > Well, there are the following 2 commands: >=20 > Get physical block size: > blockdev --getpbsz > Get logical block size: > blockdev --getbsz 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=20 fdisk, smartctl, etc. > Filesystems seem to care about the physical block size only, not the logi= cal block size. >=20 > So as soon as you have PVs with different physical block sizes (as report= ed 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=20 added 512/4096 disk but I had no data corruption. Unfortunately I=20 haven't any native 4k disk to repeat the same test. 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=20 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=20 data is there. Looks like physical sector size didn't matter here. Or I'm missing=20 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/ --_430F1F8F-EFEF-437A-AC80-3DA586F1ADBB_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Hello,

&n= bsp;

I think the filesystems address in Logic= al blocks, so this is the size which should match.

=  

However the physical size might b= e relevant for alignment/sizing decisions of mkfs =C2=A0(but you would expe= ct the to be encoded in the metadata of the filesystem so you can transport= them (losing proper alignment which might affect Performance or robustness= ).

 

For ex= t3/4 I think the mkfs will use -b 4k by Default if your FS is at least 0,5G= B.

 

BTW: s= ome applications (like SQL Server) also care about the physical size to mak= e sure they always write complete sectors in transactions and avoid read-mo= dify-write scenarios.

Gru= ss

Bernd

--
http://bern= d.eckenfels.net

 

Von: Cesare LeonardiGesendet: Freitag, 1. M=C3=A4rz 2019 02:24
An: Ingo Franzki; LVM general discussion and development
Betreff: Re: [linux-lvm] Filesystem corruption with LVM's pvmove onto a PVwith a l= arger physical block size

 

On 28/02/19 09:41, Ingo Franzki wrote:

> Well, there are the following 2 commands:

>

> Get physical block size:

>=C2=A0=C2=A0 blockdev --getpbsz <device>

> Get logical block size:

>= =C2=A0=C2=A0 blockdev --getbsz <device>

=  

I didn't know the blockdev command and= , to recap, we have:

--getpbsz: physical sector siz= e

--getss: logical sector size

--getbsz: blocksize used internally by the kernel

 

getpbsz/getss correspond to ph= ysical/logical sector size reported by

fdisk, smar= tctl, 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 rep= orted 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. Unfortunatel= y I

haven't any native 4k disk to repeat the same = test.

 

Her= e is what I've done.

/dev/sdb: SSD with 512/512 sec= tor size

/dev/sdc: mechanical disk with 512/4096 se= ctor size

 

# blockdev -v --getss --getpbsz --getbsz /dev/sdb

= get logical block (sector) size: 512

get physical b= lock (sector) size: 512

get blocksize: 4096

 

# blockdev -v --= getss --getpbsz --getbsz /dev/sdc

get logical block= (sector) size: 512

get physical block (sector) siz= e: 4096

get blocksize: 4096

 

# pvcreate /dev/sdb4

# vgcreate vgtest /dev/sdb4

# lvcreate= -L 1G vgtest /dev/sdb4

# mkfs.ext4 /dev/mapper/vgt= est-lvol0

# mkdir /media/test

# mount /dev/mapper/vgtest-lvol0 /media/test

# c= p -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

physic= al size:

 

= # pvcreate /dev/sdc1

# vgextend vgtest /dev/sdc1

# pvmove /dev/sdb4 /dev/sdc1

= # fsck.ext4 -f /dev/mapper/vgtest-lvol0

# mount /de= v/mapper/vgtest-lvol0 /media/test

# ls /media/test/=

 

The fsck= command reports no errors, the filesystem is mountable and the

data is there.

 

<= p class=3DMsoNormal>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 h= ttp://tldp.org/HOWTO/LVM-HOWTO/

 

= --_430F1F8F-EFEF-437A-AC80-3DA586F1ADBB_--