linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: ext4/xfs: about switching underlying 512B sector devices to 4K ones
Date: Thu, 30 Jul 2020 09:16:05 +1000	[thread overview]
Message-ID: <20200729231605.GB2005@dread.disaster.area> (raw)
In-Reply-To: <CANR1yOpz9o9VcAiqo18aVO5ssmuSy18RxnMKR=Dz884Rj8_trg@mail.gmail.com>

On Wed, Jul 29, 2020 at 07:38:33PM +0900, Takuya Yoshikawa wrote:
> I have a question: is it possible to make existing ext4/xfs filesystems
> formatted on 512B sector devices run as is on 4k sector devices?
> 
> 
> Problem:
> 
> We are maintaining some legacy servers whose data is stored on
> ext4/xfs filesystems formatted on lvm2 raid1 devices.
> 
> These raid1 devices consist of a few iSCSI devices, so the
> remote storage servers running as iSCSI targets are the actual
> data storage.
> 
>   /dev/md127 --  /dev/sda  --(iSCSI)-- remote storage server
>                  /dev/sdb  --(iSCSI)-- remote storage server
> 
> A problem happened when we tried to add a new storage server with
> 4k sector disks as an iSCSI target. After lvm2 added that iSCSI
> device and started syncing the blocks from existing 512B sector
> storage servers to the new 4k sector ones, we got
> "Bad block number requested" messages, and soon after that,
> the new device was removed from the lvm2 raid1 device.
> 
>   /dev/md127 --  /dev/sda  --(iSCSI)-- remote storage server(512)
>                  /dev/sdb  --(iSCSI)-- remote storage server(512)
>               *  /dev/sdc  --(iSCSI)-- remote storage server(4k)
> 
>   The combined raid1 device had been recognized as a 4k device
>   as described in this article:
>     https://access.redhat.com/articles/3911611

Rule of thumb: growing must always be done with devices that have
the same or smaller logical sector sizes. IOWs, the above will break
any filesystem that is formatted with alignment to the logical
sector size of 512 bytes...

> It seemed like 512B unaligned requests from the xfs filesystem
> were sent to the raid1 device, and mirrored requests caused
> the problem on the newly added 4k sector storage.

Yes, because XFS has permanent metadata that is logical sector sized
and aligned. Hence if the device has a logical sector size of 512
at mkfs time, you will get this:

> The xfs was formatted with its sector_size_options set to the
> default (512).
> See https://www.man7.org/linux/man-pages/man8/mkfs.xfs.8.html

and that filesystem will not work on 4k physical/logical
storage devices.

if you start with 4k devices, mkfs.xfs will detect 4k
physical/logical devices and set it's sector size to 4k
automatically and hence will work on those devices, but you can't
change this retrospectively....

> xfs: is it possible to change the filesystem sector size?

Only at mkfs time.

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2020-07-29 23:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 10:38 ext4/xfs: about switching underlying 512B sector devices to 4K ones Takuya Yoshikawa
2020-07-29 20:09 ` Andreas Dilger
2020-07-29 23:16 ` Dave Chinner [this message]
2020-07-31  6:46   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729231605.GB2005@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=takuya.yoshikawa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).