[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Format an MS-DOS floppy on /dev/sdc



On Sun 17 Mar 2019 at 13:19:29 (+0100), Anders Andersson wrote:
>   I got myself a USB 3.5" disk drive and want to format a 3.5" HD disk
> so that it Just Works™ as a standard MS-DOS floppy.

I'm not sure that you really can. What's your reasoning for
doing this? Are you just spoiling for an unnecessary fight?
Or do you really want to boot off it?

>   Normally I would have used mformat from the mtools package, but it
> appears that I can not supply a device name, just "emulated names"
> like A: which are then translated to /dev/fd0 etc.

It's a long time ago, but I seem to remember they did a good job.

>   The problem is that my disk drive shows up as a SCSI device on
> /dev/sdc and I can not find a way to tell mformat to use it, so it
> seems that I have to use the traditional mkfs.fat to format my disk.
>   However, there are dozens of parameters such as number of FATs, FAT
> size, "media type", and I don't know anything about that! Can someone
> figure out what type of magic I need to supply to mkfs.fat for it to
> do exactly what mformat would to do a floppy, or alternatively, how to
> make mformat work with /dev/sdc?

Here's an example dialogue for formatting a FAT disk. Try it,
see if it meets the unwritten criteria that apply to your
instance and if it does, stick with it. If not, just try again
with any mtools advice you get. (FAT format will stick around.
Who knows about mtools?)

# You should always blank the start of FAT partitions/disks
# dd bs=512 of=/dev/sdz if=/dev/zero count=2048
2048+0 records in
2048+0 records out
1048576 bytes (1.0 MB) copied, 0.3333 s, 3.1 MB/s
# 

##

# This step is optional. Floppies are unpartitioned.
# Hard drives almost never are. This may or may not matter to you.
# fdisk /dev/sdz

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xa7c66574.

Command (m for help): p
Disk /dev/sdz: 3.8 GiB, 4089446400 bytes, 7987200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa7c66574

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-7987199, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-7987199, default 7987199): 

Created a new partition 1 of type 'Linux' and of size 3.8 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

# 

##

# If you skipped the previous step, skip this to the next.
# This is for a PARTITIONED device.
# mkdosfs -v -i 20140440 -F 32 -n columbine4g /dev/sdz1
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS
or Windows
/dev/sdz1 has 126 heads and 62 sectors per track,
hidden sectors 0x0800;
logical sector size is 512,
using 0xf8 media descriptor, with 7985152 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 7784 sectors, and provides 996194 clusters.
There are 32 reserved sectors.
Volume ID is 20140440, volume label columbine4g.
# 

##

# For completeness, here's an up-to-date dialogue for
# an UNPARTITIONED device. This is a stick. As you
# have a disk, you might need to add -I if you
# *really* want it unpartitioned.

# mkdosfs -v -i 20140440 -F 32 -n COLUMBINE4G /dev/sdz
mkfs.fat 4.1 (2017-01-24)
attribute "partition" not found
/dev/sdz has 126 heads and 62 sectors per track,
hidden sectors 0x0000;
logical sector size is 512,
using 0xf8 media descriptor, with 7987200 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 7792 sectors, and provides 996448 clusters.
There are 32 reserved sectors.
Volume ID is 20140440, volume label COLUMBINE4G.
# 

I don't have 26 devices, but sdz prevents casual cut-and-paste.
I use the approximate acquisition date for the VSN≡UUID (8 hex
digits) and, against recommendations, I use lowercase LABELs,
like columbine4g, and utf8 filenames. For those who care,
the labels are whatever the companies wrote on them, plus the
size, but cut to 11 chars.

Cheers,
David.


Reply to: