Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
Yes, the process for making a floppy useful to an OS is the same as any other computer media. The common "1.44" MB floppy is actually 2.0 MB (12 Mbits) worth of data. However, a controller chip (usually an NEC 765 or equivalent) is used to write certain patterns onto the diskette; for a standard 3.5" 1.44 floppy, the 'formatter' writes 18 sectors per track, each sector is 512 bytes. http://www.bitsavers.org/components/nec/_dataSheets/uPD765_App_Note_Mar79.pdf These 'sectors' have extra info that the disk controller chip uses to figure out where the actual data is; that is, each of those 18 sectors has some info for synchronization, and also has the Sector Number. Even though there is an 'index' pulse once per revolution that tells you where to start looking for data, the controller chip scans the magnetic domains/transitions (encoded as Modified FM, aka MFM) and finds the proper sector it was commanded to. It then proceeds to read / write the data as commanded on that sector. The low-level format leaves the diskette with 18 sectors per track, and there are a total of 80 tracks; there are also 2 read/write heads, one on each side, so there are 36 tracks per 'cylinder' (a cylinder holds all the sectors can can be read/written without moving the disk drive head). 36 sectors per cylinder x 80 cylinders = 2,880 sectors Times 512 bytes per sector = 1,474,560 (formatted) bytes. But yes, you're right, when you do *# newfs_msdos -f 1440 /dev/rsd1a* you get an MS-DOS filesystem, which is described here: https://www.eit.lth.se/fileadmin/eit/courses/eitn50/Literature/fat12_description.pdf And yes, sectors 0 through 32 are used up by the Filesystem (FAT1, FAT2, and Root Dir); that means there are only 2880 - 33 = 2,847 sectors (1,457,664 bytes) available for actual user data. And, yes, one consequence is that since there are an odd # of sectors available for user data, it is not possible to have 2 *identical* files that completely fills up a diskette -- thanks for spotting my error on this
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
Le Tue, Nov 15, 2022 at 04:04:05PM -0800, Michael Cheponis a écrit : >[...] > > I see other unexpected behavior; when I copy to identical files that are > exactly 1/2 of 1.4 MB long > # ll f1 f2 > > -rw-r--r-- 1 mac wheel 737280 Nov 15 02:53 f1 > -rw-r--r-- 1 mac wheel 737280 Nov 15 02:54 f2 > > Each of these is 1440 sectors (std 512-byte sectors); I know the diskette > is 'perfect' (no defects), yet when I write both of these files to the > mounted "/a" filesystem, only f1 gets fully written, and then it complains > there's not enough room for f2: > > # cp f2 /a > cp: /a/f2: No space left on device > arm64# ll /a > total 2592 > -rwxr-xr-x 1 root wheel 737280 Nov 15 08:06 f1* > -rwxr-xr-x 1 root wheel 589824 Nov 15 23:59 f2* > Excuse me if que question is stupid, but is `a' (i suppose a 1.44MB floppy device) an exactly 1.44MB device? Because, for copying, one needs a filesystem; and the filesystem metadata takes space. You can dd(1) exactly this amount; you can cp(1) only less... Or am I missing something? Best, -- Thierry Laronde http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
On Tue, Nov 15, 2022 at 04:04:05PM -0800, Michael Cheponis wrote: > Nov 15 23:42:22 arm64 /netbsd: [ 1728677.3990874] sd1(umass1:0:0): not > ready, data = 00 00 00 00 3a 00 00 00 00 00 > Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] sd1: detached > Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] atapibus0: detached > Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2670131] umass1: detached > Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2700137] umass1: at uhub2 port 1 > (addr 3) disconnected > > Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0440298] umass1 at uhub2 port 1 > configuration 1 interface 0 > Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0480306] umass1: TEACV0.0 (0x0644) > TEACV0.0 (0x), rev 1.10/2.00, addr 3 > Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0550327] umass1: using UFI over > CBI with CCI > Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0560337] atapibus0 at umass1: 2 > targets > Nov 15 23:42:29 arm64 /netbsd: [ 1729069.1262885] sd1 at atapibus0 drive 0: > disk removable > Nov 15 23:42:30 arm64 /netbsd: [ 1729069.9404460] sd1: 1440 KB, 80 cyl, 2 > head, 18 sec, 512 bytes/sect x 2880 sectors A bit strange, but otherwise ok. A real SCSI device would attach as sd1 in offline mode and will become online when the medium is recognized. > I see other unexpected behavior; when I copy to identical files that are > exactly 1/2 of 1.4 MB long > # ll f1 f2 > > -rw-r--r-- 1 mac wheel 737280 Nov 15 02:53 f1 > -rw-r--r-- 1 mac wheel 737280 Nov 15 02:54 f2 > > Each of these is 1440 sectors (std 512-byte sectors); I know the diskette > is 'perfect' (no defects), yet when I write both of these files to the > mounted "/a" filesystem, only f1 gets fully written, and then it complains > there's not enough room for f2: A filesystem needs to store more data than just the file contents. > total 2592 > -rwxr-xr-x 1 root wheel 737280 Nov 15 08:06 f1* > -rwxr-xr-x 1 root wheel 589824 Nov 15 23:59 f2* > > If I rm /a/f2 and then write it again, there is even less 'space': > > # rm /a/f2 > arm64# cp f2 /a > cp: /a/f2: No space left on device > arm64# ll /a > total 1568 > -rwxr-xr-x 1 root wheel 737280 Nov 15 08:06 f1* > -rwxr-xr-x 1 root wheel 65536 Nov 16 00:00 f2* This looks like a bug somewhere, but maybe you did remove the mounted medium at some point? So what kind of filesystem did you use? FFS? FAT? My guess is that you need to use fsck to fix the inconsistencies and find out when they occur. The usual culprits are media removal while mounted, hard reset of the system, or failure to unmount when rebooting.
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
Hmm, this is getting more interesting: Nov 14 20:55:16 arm64 /netbsd: [ 1632636.5571825] umass1 at uhub2 port 1 configuration 1 interface 0 Nov 14 20:55:16 arm64 /netbsd: [ 1632636.5601839] umass1: TEACV0.0 (0x0644) TEACV0.0 (0x), rev 1.10/2.00, addr 3 Nov 14 20:55:16 arm64 /netbsd: [ 1632636.5671868] umass1: using UFI over CBI with CCI Nov 14 20:55:16 arm64 /netbsd: [ 1632636.5681880] atapibus0 at umass1: 2 targets Nov 14 20:55:16 arm64 /netbsd: [ 1632636.6382151] sd1 at atapibus0 drive 0: disk removable Nov 14 20:55:17 arm64 /netbsd: [ 1632637.5163701] sd1: 1440 KB, 80 cyl, 2 head, 18 sec, 512 bytes/sect x 2880 sectors tail -f /var/log/messages on one console, and: # scsictl sd1 format /dev/rsd1: Check Condition on CDB: 1a 00 03 00 24 00 SENSE KEY: No Additional Sense ASC/ASCQ: No Additional Sense Information came out this time! NO console messages. Now, unplug, and re-plug the USB in: Nov 15 23:42:22 arm64 /netbsd: [ 1728677.3990874] sd1(umass1:0:0): not ready, data = 00 00 00 00 3a 00 00 00 00 00 Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] sd1: detached Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2630115] atapibus0: detached Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2670131] umass1: detached Nov 15 23:42:22 arm64 /netbsd: [ 1729062.2700137] umass1: at uhub2 port 1 (addr 3) disconnected Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0440298] umass1 at uhub2 port 1 configuration 1 interface 0 Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0480306] umass1: TEACV0.0 (0x0644) TEACV0.0 (0x), rev 1.10/2.00, addr 3 Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0550327] umass1: using UFI over CBI with CCI Nov 15 23:42:29 arm64 /netbsd: [ 1729069.0560337] atapibus0 at umass1: 2 targets Nov 15 23:42:29 arm64 /netbsd: [ 1729069.1262885] sd1 at atapibus0 drive 0: disk removable Nov 15 23:42:30 arm64 /netbsd: [ 1729069.9404460] sd1: 1440 KB, 80 cyl, 2 head, 18 sec, 512 bytes/sect x 2880 sectors Try again: # scsictl sd1 format /dev/rsd1: Check Condition on CDB: 1a 00 03 00 24 00 SENSE KEY: No Additional Sense ASC/ASCQ: No Additional Sense Information Same as before. No messages is /var/log/messages I see other unexpected behavior; when I copy to identical files that are exactly 1/2 of 1.4 MB long # ll f1 f2 -rw-r--r-- 1 mac wheel 737280 Nov 15 02:53 f1 -rw-r--r-- 1 mac wheel 737280 Nov 15 02:54 f2 Each of these is 1440 sectors (std 512-byte sectors); I know the diskette is 'perfect' (no defects), yet when I write both of these files to the mounted "/a" filesystem, only f1 gets fully written, and then it complains there's not enough room for f2: # cp f2 /a cp: /a/f2: No space left on device arm64# ll /a total 2592 -rwxr-xr-x 1 root wheel 737280 Nov 15 08:06 f1* -rwxr-xr-x 1 root wheel 589824 Nov 15 23:59 f2* If I rm /a/f2 and then write it again, there is even less 'space': # rm /a/f2 arm64# cp f2 /a cp: /a/f2: No space left on device arm64# ll /a total 1568 -rwxr-xr-x 1 root wheel 737280 Nov 15 08:06 f1* -rwxr-xr-x 1 root wheel 65536 Nov 16 00:00 f2* Thanks, again for any pointers / suggestions. On Mon, Nov 14, 2022 at 1:29 PM Michael van Elst wrote: > On Mon, Nov 14, 2022 at 09:33:07AM -0800, Michael Cheponis wrote: > > *# scsictl sd1 format/dev/rsd1: device had unknown status 4* > > Is there any other message (on console) ? > > There are 3 cases that produce a 'status 4': > > - "have short sense" (printed only with SCSI debugging) > - "passthrough: adapter inconsistency" > - "unknown error category %d from adapter" > > Greetings, > -- > Michael van Elst > Internet: mlel...@serpens.de > "A potential Snark may lurk in every tree." >
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
On Mon, Nov 14, 2022 at 09:33:07AM -0800, Michael Cheponis wrote: > *# scsictl sd1 format/dev/rsd1: device had unknown status 4* Is there any other message (on console) ? There are 3 cases that produce a 'status 4': - "have short sense" (printed only with SCSI debugging) - "passthrough: adapter inconsistency" - "unknown error category %d from adapter" Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
*# scsictl sd1 format/dev/rsd1: device had unknown status 4* The dd trick seems to work only if the diskette is pre-formatted. great suggestions, thank you. I'll keep whacking at this. -Mike On Mon, Nov 14, 2022 at 9:11 AM Michael van Elst wrote: > michael.chepo...@gmail.com (Michael Cheponis) writes: > > >I would think 'fdformat' would work, but... > > >*arm64# ./fdformat -f /dev/rsd1 > >*fdformat: Device `/dev/rsd1' does not support floppy formatting: > >Inappropriate ioctl for device* > > > Try 'scsictl sd1 format'. > >
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
michael.chepo...@gmail.com (Michael Cheponis) writes: >I would think 'fdformat' would work, but... >*arm64# ./fdformat -f /dev/rsd1 >*fdformat: Device `/dev/rsd1' does not support floppy formatting: >Inappropriate ioctl for device* Try 'scsictl sd1 format'.
Re: noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
I found 2 old amd64 floppy images from 2.0. No idea why I still have these: -rwxr--r-- 1 andy andy 1474560 Nov 30 2004 boot1.fs -rwxr--r-- 1 andy andy 1474560 Nov 30 2004 boot2.fs Can you try writing a file of that size to one of those /dev/rsd files using dd? (The man page for fdformat says 2006, I'm surprised it's that new.) Andy
noob Question: How to format a floppy on a USB floppy disk drive (on RPi 4) ?
I would think 'fdformat' would work, but... *[ 1063553.609981] umass1 at uhub2 port 3 configuration 1 interface 0* *[ 1063553.612982] umass1: TEACV0.0 (0x0644) TEACV0.0 (0x), rev 1.10/2.00, addr 3* *[ 1063553.620984] umass1: using UFI over CBI with CCI* *[ 1063553.621985] atapibus0 at umass1: 2 targets* *[ 1063553.692011] sd1 at atapibus0 drive 0: disk removable* *[ 1063554.506165] sd1: 1440 KB, 80 cyl, 2 head, 18 sec, 512 bytes/sect x 2880 sectors* *# disklabel sd1 * *# /dev/rsd1:* *type: ATAPI* *disk: USB UF000x* *label: default label* *flags: removable* *bytes/sector: 512* *sectors/track: 18* *tracks/cylinder: 2* *sectors/cylinder: 36* *cylinders: 80* *total sectors: 2880* *rpm: 10240* *interleave: 1* *trackskew: 0* *cylinderskew: 0* *headswitch: 0 # microseconds* *track-to-track seek: 0 # microseconds* *drivedata: 0* *3 partitions:* *#sizeoffset fstype [fsize bsize cpg/sgs]* * a: 2880 0 4.2BSD 0 0 0 # (Cyl. 0 - 79)* * c: 2880 0 unused 0 0# (Cyl. 0 - 79)* *disklabel: boot block size 0* *disklabel: super block size 0* *arm64# ./fdformat -f /dev/rsd1 * *fdformat: Device `/dev/rsd1' does not support floppy formatting: Inappropriate ioctl for device* *arm64# ./fdformat -f /dev/rsd1a * *fdformat: Device `/dev/rsd1a' does not support floppy formatting: Inappropriate ioctl for device* *arm64# ./fdformat -f /dev/rsd1c * *fdformat: Device `/dev/rsd1c' does not support floppy formatting: Inappropriate ioctl for device* *arm64# ./fdformat -f /dev/rsd1e * *fdformat: Cannot open /dev/rsd1e: Device not configured* *NetBSD arm64 9.99.102 NetBSD 9.99.102 (MIKE64) #0: Wed Oct 26 22:54:20 UTC 2022 mac@arm64:/usr/obj/sys/arch/evbarm/compile/MIKE64 evbarm* (same as GENERIC64 but HZ=1000) mtools expects there to be a low-level format available from the OS. Thanks for any pointers here! The other thing is: if I format on a different machine, when reading / writing and some floppy HW error occurs, pretty much, the only way to 'clear' the error is to unplug the USB connector & plug it back in. The machine more or less 'hangs' if, e.g., a sector has gone bad. I know these questions are from a different era of computing, but, gosh, I do really like the backward compatibility of NetBSD. Thanks again, -Mike