fd(HW) 19 June 1992 fd(HW) Name fd - floppy devices Description The fd devices implement the interface with floppy disk drives. Each de- vice name corresponds to a specific major and minor device. Typically, the tar(C), cpio(C) or dd(C) commands are used to read or write floppy disks. For instance, tar tvf /dev/fd0 tabulates the contents of the floppy disk in drive 0 (zero). The block special fd devices are also block-buffered. The floppy driver can read or write 1K bytes at a time using raw I/O. Note that block transfers are always a multiple of the 1K disk block size. XENIX devices XENIX diskette device file names use the following format: /dev/[r]fd[0|1][48ss8|48ss9|96ds9|96ds15|135ds9|135ds18] (See notes below for more information about the device naming procedure.) The corresponding character special (raw) devices allow direct, unbuf- fered transmission between the floppy and the user's read or write transfer address in the user's program. For information about formatting, see format(C). The minor device number determines what kind of physical device is attached to each device file. When accessing the character special floppy devices, the user's buffer must begin on a word boundary. The count in a read(S), write(S), or lseek(S) call to a character special floppy device must be a multiple of 1K bytes. Device names determine the particular drive and media configuration. The device names have the form: fd048ds9 Where: fd0 = drive number (0, 1, 2 or 3) 48 = number of disk tracks per inch (48 or 96) ds = single or double sided floppy (ss or ds) 9 = number of sectors per track (8,9,15 or 18) For instance, /dev/fd048ss9 indicates a 48 track per inch, single sided, 9 sector floppy disk device in drive 0. The minor device numbers for floppy drives depend on the drive and media configuration. The most common are: ______|__________________________________________________________________ | Minor Device Number |________________________________|_________________|_______________ Drive | 48tpi | 96tpi | 135tpi | ds/8 ds/9 ss/8 ss/9 | ds/15 ds/8 | ds/9 ds/18 ______|_______|________|_______|_______|________|________|_______|_______ 0 | 12 | 4 | 8 | 0 | 52 | 44 | 36 | 60 1 | 13 | 5 | 9 | 1 | 53 | 45 | 37 | 61 2 | 14 | 6 | 10 | 2 | 54 | 46 | 38 | 62 3* | | | | | | | | * reserved for special, non-floppy devices connected to the floppy con- troller as unit #3. The scheme for creating minor device numbers is as follows: when inter- preted as a binary number, each bit of the minor device number represents some aspect of the device/media configuration. For example, the minor device number for /dev/fd048ss8 is ``8''. Inter- preted as a binary number, 8 is: 00001000 Only bits 1 through 6 are used in minor device identification: ________________|________________________|___________|___________________ Tracks per inch | Sectors per track | ss or ds | Drive number 32 | 16 8 | 4 | 2 1 ________________|________________________|___________|___________________ 0 | 0 1 | 0 | 0 0 Drive number Bits 1 and 2 describe the drive number: __________________________________|______________________________________ Bits | Drive number __________________________________| 2 | 1 | ____________|_____________________|______________________________________ 0 | 0 | 0 0 | 1 | 1 1 | 0 | 2 1 | 1 | 3* * reserved for special, non-floppy devices connected to the floppy con- troller as unit #3. Single sided or double sided Bit 3 describes whether the disk is single sided or double sided. If this bit is 0, the disk is single sided; if this bit is 1, the disk is double sided. Sectors per track Bits 4 and 5 describe sectors per track: __________________________________|______________________________________ Bits | Sectors per track __________________________________| 16 | 8 | ____________|_____________________|______________________________________ 0 | 0 | 9 0 | 1 | 8 1 | 0 | 15 1 | 1 | 18 Tracks per inch Bit 6 describes tracks per inch. If this bit is 0, the floppy has 46 tracks per inch; if this bit is 1, the floppy has either 96 tracks per inch or 135 tracks per inch. 96tpi disks can be distinguished from 135tpi disks by the number of sectors per track. 96tpi disks will have either 15 or 8 sectors per track, while 135tpi disks will have either 9 or 18 sectors per track, so 95tpi disks and 135tpi disks will always have different minor numbers. Using this information, you can construct any minor device numbers you need. UNIX devices UNIX diskette device file names use the following format: /dev/[r]dsk/f[0|1][5h|5d9|5d8|5d4|5d16|5q|3h|3d][t|u] where r indicates a raw (character) interface to the diskette, rdsk selects the raw device interface and dsk selects the block device inter- face. 0 or 1 selects the drive to be accessed: f0 selects floppy drive 0, while f1 selects drive 1. The following list describes the possible for- mats: 5h 5.25" high density diskette (1.2MB) 5d9 5.25" double density diskette, 9 sectors per track (360KB) 5d8 5.25" double density diskette, 8 sectors per track (320KB) 5d4 5.25" double density diskette, 4 sectors per track (320KB) 5d16 5.25" double density diskette, 16 sectors per track (320KB) 5q 5.25" high density diskette (720KB) 3h 3.50" high density diskette (1.44MB) 3d 3.50" double density diskette (720KB) Format specification is mandatory when opening the device for formatting. However, when accessing a floppy disk for other operations (read and write), the format specification field can be omitted. In this case, the floppy disk driver will automatically determine the format previously established on the diskette and then perform the requested operation; for example, cpio -itv</dev/rsdk The last parameter, t or u, selects the partition to be accessed. t represents the whole diskette. Without t or u specified, the whole diskette except cylinder 0 will be selected. u represents the whole diskette except track 0 of cylinder 0. Besides the device file naming convention described above, some of the formats have alias names that correlate to previous releases. The follow- ing list describes the formats that have an alias: format alias 5h q15d 5d8 d8d 5d9 d9d For example, the device file /dev/rdsk/f0q15dt is equivalent to /dev/rdsk/f05ht. Files XENIX Devices: /dev/[r]fd0 /dev/[r]fd048ss8 /dev/[r]fd096 /dev/[r]fd0135ds9 /dev/[r]fd1 /dev/[r]fd148ss8 /dev/[r]fd196 /dev/[r]fd1135ds9 /dev/[r]fd048 /dev/[r]fd048ds9 /dev/[r]fd096ds9 /dev/[r]fd0135ds18 /dev/[r]fd148 /dev/[r]fd148ds9 /dev/[r]fd196ds9 /dev/[r]fd1135ds18 /dev/[r]fd048ds8 /dev/[r]fd048ss9 /dev/[r]fd096ds15 /dev/[r]fd148ds8 /dev/[r]fd148ss9 /dev/[r]fd196ds15 UNIX Devices: /dev/[r]dsk/f0 /dev/[r]dsk/f05d8 /dev/[r]dsk/f05q /dev/[r]dks/f0t /dev/[r]dsk/f05d8t /dev/[r]dsk/f05qt /dev/[r]dsk/f05h /dev/[r]dsk/f05d4 /dev/[r]dsk/f03h /dev/[r]dsk/f05ht /dev/[r]dsk/f05d4t /dev/[r]dsk/f03ht /dev/[r]dsk/f05d9 /dev/[r]dsk/f05d16 /dev/[r]dsk/f03d /dev/[r]dsk/f005d9t /dev/[r]dsk/f05d16t /dev/[r]dsk/f03dt Notes It is not advisable to format a low density (48tpi) diskette on a high density (96tpi or 135tpi) floppy drive. Low density diskettes written on a high density drive should be read on high density drives. They may or may not be readable on a low density drive. Use error-free floppy disks for best results on reading and writing.