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: mlelstv%serpens.de@localhost (Michael van Elst)
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 09:39:54 -0000 (UTC)

 gnats-admin%NetBSD.org@localhost ("RVP via gnats") writes:
 
 > 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.
 
 
 If you access a partition (but not the raw partition) then the
 "label sector" (== the partition table) is protected and writes
 are blocked with an EROFS error. That allows either partitions
 beyond the label sector or safe filesystems like FFS on a "whole disk"
 that don't touch the label sector.
 
 
 Unfortunately, write errors of a filesystem are hidden as they
 occur asynchronously to the program doing the write. You may see
 kernel messages on the console or logged in /var/log/messages. Only
 direct accesses to the device (e.g. newfs writing to /dev/rvnd0a)
 would see the error, but in the example newfs was used together
 with the raw partition.
 
 So, for a floppy image on a disk device, you need to use the raw partition.
 
 
 
 But it is slightly more complicated :)
 
 The driver for a physical floppy (i.e. not some USB stick where you
 want to write a floppy image to but the real vintage thing) abuses
 the label.
 
 The different partitions are used to select different floppy formats,
 e.g. b is a 1.44MB 3.5" disk, c is a 1.2MB 5.25" disk. You must
 use the correct partition for the medium and even the 'raw' partition
 is abused.
 
 To make this work, the floppy driver has its own private routine
 to check write boundaries, and that one just ignores the label
 sector.
 
 Writing to a physical floppy therefore doesn't have such problems.
 


Home | Main Index | Thread Index | Old Index