NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/59924: NetBSD improperly does not update FAT0 on FAT12 MSDOS filesystem
The following reply was made to PR kern/59924; it has been noted by GNATS.
From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/59924: NetBSD improperly does not update FAT0 on FAT12
MSDOS filesystem
Date: Sun, 18 Jan 2026 08:47:06 +0000 (UTC)
```
qemu# uname -a
NetBSD qemu.local 10.1_STABLE NetBSD 10.1_STABLE (GENERIC) #0: Thu Jan 8 10:57:41 UTC 2026 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
qemu# unxz dd-msdos-fat12.img.xz
```
*** (Note the checksum difference, but no matter, the error is elsewhere...)
> # md5 dd-msdos-fat12.img
> MD5 (dd-msdos-fat12.img) = 67cb3c500cf779b5db6cb704694c4a39
>
```
qemu# md5 dd-msdos-fat12.img
MD5 (dd-msdos-fat12.img) = f4ddf3f4e2f0fc8e3b3219e4b2a92876
```
*** (Note the difference in device name throughout.)
> # mount_msdos /dev/vnd0a /mnt
>
```
qemu# ls -fl /dev/vnd0a /dev/vnd0 /dev/vnd0d
brw-r----- 1 root operator 14, 0 Jan 18 07:50 /dev/vnd0a
brw-r----- 1 root operator 14, 3 Jan 18 07:50 /dev/vnd0
brw-r----- 1 root operator 14, 3 Jan 18 07:50 /dev/vnd0d
qemu# mount_msdos /dev/vnd0 /mnt
qemu# ls /mnt/
bytes.bin cyl00014.bin cyl00028.bin cyl00042.bin cyl00056.bin cyl00070.bin
cyl00001.bin cyl00015.bin cyl00029.bin cyl00043.bin cyl00057.bin cyl00071.bin
cyl00002.bin cyl00016.bin cyl00030.bin cyl00044.bin cyl00058.bin cyl00072.bin
cyl00003.bin cyl00017.bin cyl00031.bin cyl00045.bin cyl00059.bin cyl00073.bin
cyl00004.bin cyl00018.bin cyl00032.bin cyl00046.bin cyl00060.bin cyl00074.bin
cyl00005.bin cyl00019.bin cyl00033.bin cyl00047.bin cyl00061.bin cyl00075.bin
cyl00006.bin cyl00020.bin cyl00034.bin cyl00048.bin cyl00062.bin cyl00076.bin
cyl00007.bin cyl00021.bin cyl00035.bin cyl00049.bin cyl00063.bin cyl00077.bin
cyl00008.bin cyl00022.bin cyl00036.bin cyl00050.bin cyl00064.bin cyl00078.bin
cyl00009.bin cyl00023.bin cyl00037.bin cyl00051.bin cyl00065.bin cyl00079.bin
cyl00010.bin cyl00024.bin cyl00038.bin cyl00052.bin cyl00066.bin
cyl00011.bin cyl00025.bin cyl00039.bin cyl00053.bin cyl00067.bin
cyl00012.bin cyl00026.bin cyl00040.bin cyl00054.bin cyl00068.bin
cyl00013.bin cyl00027.bin cyl00041.bin cyl00055.bin cyl00069.bin
qemu# umount /mnt
qemu# fsck_msdos -n /dev/vnd0
** /dev/vnd0
** Phase 1 - Read and Compare FATs
** Phase 2 - Check Cluster Chains
** Phase 3 - Checking Directories
** Phase 4 - Checking for Lost Files
81 files, 0 free (0 clusters)
qemu# mount_msdos /dev/vnd0 /mnt
qemu# rm /mnt/bytes.bin
qemu# umount /mnt
qemu# fsck_msdos -n /dev/vnd0
** /dev/vnd0
** Phase 1 - Read and Compare FATs
** Phase 2 - Check Cluster Chains
** Phase 3 - Checking Directories
** Phase 4 - Checking for Lost Files
80 files, 1 free (3 clusters)
qemu#
```
On Linux:
```
$ fsck.msdos -v dd-msdos-fat12.img
fsck.fat 4.2 (2021-01-31)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "MSDOS5.0"
Media byte 0xf0 (5.25" or 3.5" HD floppy)
512 bytes per logical sector
512 bytes per cluster
1 reserved sector
First FAT starts at byte 512 (sector 1)
2 FATs, 12 bit entries
4608 bytes per FAT (= 9 sectors)
Root directory starts at byte 9728 (sector 19)
224 root directory entries
Data area starts at byte 16896 (sector 33)
2847 data clusters (1457664 bytes)
18 sectors/track, 2 heads
0 hidden sectors
2880 sectors total
Checking for unused clusters.
dd-msdos-fat12.img: 80 files, 2847/2847 clusters
$
```
So, there's only 1 reserved sector, and FAT starts at byte 512. Looks like
A.I. might be right after all. :)
However, I think that since floppies don't have a MBR, you're supposed to
use the whole-disk device for mounting them.
-RVP
Home |
Main Index |
Thread Index |
Old Index