ufs filesystem cannot mount NetBSD/arm64 partition
To: Evgeniy Dushistov <[email protected]>
CC: [email protected]
Subject: ufs filesystem cannot mount NetBSD/arm64 partition
The disk obtained by
$ wget http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz $ gunzip arm64.img
contains two partitions, as shown by
$ fdisk arm64.img Device Boot Start End Sectors Size Id Type arm64.img1 * 32768 196607 163840 80M c W95 FAT32 (LBA) arm64.img2 196608 2366335 2169728 1G a9 NetBSD
The second partition is of type ufs, with subtype 44bsd (as all NetBSD UFS partitions). But Linux cannot mount them.
How to reproduce:
# kpartx -av arm64.img
add map loopXXp1 ...
add map loopXXp2 ...
# mount -r -t ufs -o ufstype=44bsd /dev/mapper/loopXXp2 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/mapper/loopXXp2, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
# dmesg
...
[ 285.212612] ufs: UFSD (fs/ufs/super.c, 797): ufs_fill_super:
[ 285.212619] ufs: ENTER
[ 285.212622] ufs: UFSD (fs/ufs/super.c, 812): ufs_fill_super:
[ 285.212625] ufs: flag 1
[ 285.212629] ufs: UFSD (fs/ufs/super.c, 387): ufs_parse_options:
[ 285.212632] ufs: ENTER
[ 285.212636] ufs: UFSD (fs/ufs/super.c, 852): ufs_fill_super:
[ 285.212639] ufs: ufstype=44bsd
[ 285.212739] ufs: ufs_fill_super(): fragment size 8192 is too large
[ 285.212745] ufs: UFSD (fs/ufs/super.c, 1300): ufs_fill_super:
[ 285.212749] ufs: EXIT (FAILED)Reproduced on Ubuntu 23.10 with a vanilla linux-6.7.0.
Whereas this partition can be mounted fine on FreeBSD, NetBSD, OpenBSD. FreeBSD 11:
# mount -r -t ufs /dev/ada1s2 /mnt NetBSD 9.3: # mount -r -t ffs /dev/wd1a /mnt OpenBSD 7.4: # mount -r -t ffs /dev/wd1j /mnt
The source code line which emits the
ufs: ufs_fill_super(): fragment size 8192 is too large
error is obviously linux/fs/ufs/super.c:1083.
Bruno
Al Viro
maintainerQuoted 11 lines · Bruno Haible
Whereas this partition can be mounted fine on FreeBSD, NetBSD, OpenBSD. FreeBSD 11:
# mount -r -t ufs /dev/ada1s2 /mnt NetBSD 9.3: # mount -r -t ffs /dev/wd1a /mnt OpenBSD 7.4: # mount -r -t ffs /dev/wd1j /mntThe source code line which emits the
ufs:ufs_fill_super(): fragment size 8192 is too large
error is obviouslylinux/fs/ufs/super.c:1083.
Lovely... Does it really have 8Kb fragments? That would be painful to deal with - a plenty of places in there assume that fragment fits into a page...
Al Viro
maintainerQuoted 10 lines · Al Viro
Quoted 8 lines · Bruno Haible
Whereas this partition can be mounted fine on FreeBSD, NetBSD, OpenBSD. FreeBSD 11:
# mount -r -t ufs /dev/ada1s2 /mnt NetBSD 9.3: # mount -r -t ffs /dev/wd1a /mnt OpenBSD 7.4: # mount -r -t ffs /dev/wd1j /mnt
Quoted 7 lines
Quoted 3 lines
The source code line which emits the
ufs:ufs_fill_super(): fragment size 8192 is too large
error is obviouslylinux/fs/ufs/super.c:1083.Lovely... Does it really have 8Kb fragments? That would be painful to deal with - a plenty of places in there assume that fragment fits into a page...
FWIW, theoretically it might be possible to make that comparison with PAGE_SIZE instead of 4096 and require 16K or 64K pages for the kernel in question; that ought to work, modulo bugs in completely untested cases ;-/
Support with 4K pages is a different story - that would take much more surgery in fs/ufs.
Constraints:
* fragment and block sizes are powers of 2.
* block:fragment is 1, 2, 4 or 8.
Violating those is not an option for any kernel.
* fragment fits into page.
Could be worked around, but not easily.
BTW, can NetBSD/i386 mount the same image?
Quoted 11 lines · Al Viro
Quoted 10 lines · Al Viro
Quoted 8 lines · Bruno Haible
Whereas this partition can be mounted fine on FreeBSD, NetBSD, OpenBSD. FreeBSD 11:
# mount -r -t ufs /dev/ada1s2 /mnt NetBSD 9.3: # mount -r -t ffs /dev/wd1a /mnt OpenBSD 7.4: # mount -r -t ffs /dev/wd1j /mnt
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
The source code line which emits the
ufs:ufs_fill_super(): fragment size 8192 is too large
error is obviouslylinux/fs/ufs/super.c:1083.Lovely... Does it really have 8Kb fragments? That would be painful to deal with - a plenty of places in there assume that fragment fits into a page...
Wouldn't surprise me if netbsd/arm64 had decided to go with 64kB PAGE_SIZE and 8kB fragments ...
Quoted 7 lines
FWIW, theoretically it might be possible to make that comparison with
PAGE_SIZEinstead of 4096 and require 16K or 64K pages for the kernel in question; that ought to work, modulo bugs in completely untested cases ;-/Support with 4K pages is a different story - that would take much more surgery in fs/ufs.
Possibly not too much more. With large folios, we're most of the way to being able to support this. If there's real interest, we can look at supporting large folios in UFS.
Al Viro
maintainerQuoted 8 lines · Matthew Wilcox
Wouldn't surprise me if netbsd/arm64 had decided to go with 64kB
PAGE_SIZEand 8kB fragments ...Quoted 5 lines
FWIW, theoretically it might be possible to make that comparison with
PAGE_SIZEinstead of 4096 and require 16K or 64K pages for the kernel in question; that ought to work, modulo bugs in completely untested cases ;-/
Quoted 6 lines
Quoted 2 lines
Support with 4K pages is a different story - that would take much more surgery in fs/ufs.
Possibly not too much more. With large folios, we're most of the way to being able to support this. If there's real interest, we can look at supporting large folios in UFS.
Metadata handling will take some work. I've done some untangling in prep to that (see #work.ufs), but that's not all. And fun around tail unpacking is also not quite there.
Al Viro asked:
Quoted 1 line
can NetBSD/i386 mount the same image?
Yes, it mounts fine in
- NetBSD 9.3/x86_64 (PAGESIZE=4096)
- NetBSD 8.0/i386 (PAGESIZE=4096)
Quoted 2 lines · Matthew Wilcox
Wouldn't surprise me if netbsd/arm64 had decided to go with 64kB
PAGE_SIZEand 8kB fragments ...
getpagesize() on NetBSD 9.3/arm64 is 4096.
Al Viro
maintainerQuoted 5 lines · Bruno Haible
Quoted 2 lines · Matthew Wilcox
Wouldn't surprise me if netbsd/arm64 had decided to go with 64kB
PAGE_SIZEand 8kB fragments ...
getpagesize()on NetBSD 9.3/arm64 is 4096.
It's not impossible to do on Linux side; the main trouble is in the Cthulhu-awful set of helpers that needs to be untangled before we can realistically do any kind of massage in there. What I want to do one of those days is to do an iomap conversion and see how well does that work. ETOOMUCHOTHERSHITE...