Re: Sector size changes creating filesystem problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+CC Li Nan

在 2025/07/17 0:21, Yu Kuai 写道:
Hi,

在 2025/7/16 22:30, Filipe Maia 写道:
Hi,

When a 4Kn disk is added to an mdadm array with sector size 512, its
sector size changes to 4096 to accommodate the new disk.

Here's an example:

```
truncate -s 1G /tmp/loop512a
truncate -s 1G /tmp/loop512b
truncate -s 1G /tmp/loop512c
truncate -s 1G /tmp/loop4Ka
losetup --sector-size 512  --direct-io=on /dev/loop0  /tmp/loop512a
losetup --sector-size 512  --direct-io=on /dev/loop1  /tmp/loop512b
losetup --sector-size 512  --direct-io=on /dev/loop2  /tmp/loop512c
losetup --sector-size 4096  --direct-io=on /dev/loop3  /tmp/loop4Ka
mdadm --create /dev/md2 --level=5 --raid-devices=3 /dev/loop[0-2]
# blockdev returns 512
blockdev --getss /dev/md2
mdadm /dev/md2 -a /dev/loop3
mdadm /dev/md2 -f /dev/loop2
# blockdev still returns 512
blockdev --getss /dev/md2
mdadm -S /dev/md2
mdadm -A /dev/md2 /dev/loop0 /dev/loop1 /dev/loop3
# blockdev now returns 4096
blockdev --getss /dev/md2
```

This breaks filesystems like XFS, with new mounts failing with:
`mount: /mnt: mount(2) system call failed: Function not implemented.`
Yes, this is a known problem. Li Nan was trying to fix this long time ago.

Shouldn't the user be warned when this can happen?
Kernel should forbid larger lbs new disk, however, this is still a missing
feature for now.

You can try this set:

https://lore.kernel.org/all/20250304121918.3159388-1-linan666@xxxxxxxxxxxxxxx/


Thanks,

Kuai

Cheers,
Filipe


.






[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux