Docs/SysAdmin/Config/FormattingFloppies

From Mandriva

Jump to: navigation, search
Formatting Floppy Disks

Contents

[hide]
[edit]

Standard Disks

  1. StandardDisks

You can format floppy disks from the command line in linux with the following command:

$  fdformat /dev/fd0

To make use of the disk you must put a filesystem on it, you can use one of the following commands (you may need to su to root for this).

Note: Choose one of the commands below. The first will make the filesystem "msdos" and the second command makes an "ext2" filesystem:

#
# mkfs -t msdos /dev/fd0
# mkfs -t ext2 /dev/fd0

If you have mtools installed, you can also create a DOS file system with:

#  mformat a:


[edit]

Oversized Disks

It's definitely a dying format - but it's not quite dead yet. Until booting from removable media like USB keys and SD sticks is as common as booting from the floppy drive there's still a good use for the floppy drive. Currently, most floppy discs have a capacity of 1.44MB. In recent years there have been a series of open source projects that have depended heavily on floppy images - software like firewalls, custom kernel boot discs and system/network diagnostic and repair. Each of these projects tend to need as much storage space as they can get. As a result, developers need low level formatting techniques to take the standard floppy and stuff more data in it.


[edit]

Format 1680K Floppy Disks Mandriva Linux version 9.2 and older: 9.0, 9.1 and 9.2

Making a boot disk for Mandriva Linux 9.2 requires more space on a floppy disk than the standard 1.4 MB (initrd and the boot loader will not fit onto a standard floppy formatted 1440K). This is the command for formatting a floppy disk to 1680 KB:

$  fdformat /dev/fd0u1680

You can look at all the entries in /dev/fd0uXXXX where the XXXX is the various formats available. See UdevFloppyProblem below for more info on what they all are.

To add the msdos filesystem (again, you may need to su to root for this one):

#  mkfs -t msdos /dev/fd0u1680

You can now make the bootdisk for your currently running kernel with:

$  mkbootdisk $(uname -r)

Alternatively, you may want to refer to MakeBootCD on how to make a bootable CDRom.


[edit]

Formatting Over-Sized Floppies on Mandriva 10.1 and 10.2

{ Round Holes and Square Pegs in the udev age }

[edit]

The Problem

  1. UdevFloppyProblem

udev creates /dev entries on the fly - there is no handy /dev/fd0xxxxxx entries there anymore (see StandardDisks above).

[edit]

Solution One

Thanks Mikkel Ellerston from the expert mailing list

Use the info provided in the kernel source under drivers/block/floppy.c (see Footnote below) and the setfdparm program to temporarily set your floppy to a different size before running fdformat - for example:

 #!/bin/sh
 # Format a floppy in /dev/fd0 to 1722 Kb.
 setfdprm /dev/fd0 3444 21 2 82 0 0x25 0x00 0xDF 0x0C
 fdformat /dev/fd0

The floppy resets to 'normal' as soon as the media is changed.

Alternatively you could check to see if the size you need has an entry in the /etc/mediaprm file already. Other distros use /etc/fdprm but Mandriva seems to be compiled to use /etc/mediaprm even though /etc/fdprm may exist. If it is there, just refer to it by name - for example

 setfdparm /dev/fd0 1722/1440
 fdformat /dev/fd0
[edit]

Solution Two

Thanks to Mikkel Ellerston and Larry Sword from the expert mailing list

Install the fdutils package

urpmi fdutils

and use the superformat command.

Superformat understands all the formats listed in the /etc/mediaprm file so you can just type

superformat /dev/fdo 1722/1440

replacing the 1722/1440 as required for your application. As above, you could add your own entries too. There's quite a list - browse the /etc/mediaprm file for all the details.


[edit]

Footnote: a section of drivers/block/floppy.c

/*
  * This struct defines the different floppy types.
  *
  * Bit 0 of 'stretch' tells if the tracks need to be doubled for some
  * types (e.g. 360kB diskette in 1.2MB drive, etc.).  Bit 1 of 'stretch'
  * tells if the disk is in Commodore 1581 format, which means side 0 sectors
  * are located on side 1 of the disk but with a side 0 ID, and vice-versa.
  * This is the same as the Sharp MZ-80 5.25" CP/M disk format, except that the
  * 1581's logical side 0 is on physical side 1, whereas the Sharp's logical
  * side 0 is on physical side 0 (but with the misnamed sector IDs).
  * 'stretch' should probably be renamed to something more general, like
  * 'options'.  Other parameters should be self-explanatory (see also
  * setfdprm(8)).
  */
 /*
             Size
              |  Sectors per track
              |  | Head
              |  | |  Tracks
              |  | |  | Stretch
              |  | |  | |  Gap 1 size
              |  | |  | |    |  Data rate, | 0x40 for perp
              |  | |  | |    |    |  Spec1 (stepping rate, head unload
              |  | |  | |    |    |    |    /fmt gap (gap2) */
 static struct floppy_struct floppy_type[32] = {
         {    0, 0,0, 0,0,0x00,0x00,0x00,0x00,NULL    }, /*  0 no testing    */
         {  720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"d360"  }, /*  1 360KB PC      */
         { 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"h1200" }, /*  2 1.2MB AT      */
         {  720, 9,1,80,0,0x2A,0x02,0xDF,0x50,"D360"  }, /*  3 360KB SS 3.5" */
         { 1440, 9,2,80,0,0x2A,0x02,0xDF,0x50,"D720"  }, /*  4 720KB 3.5"    */
         {  720, 9,2,40,1,0x23,0x01,0xDF,0x50,"h360"  }, /*  5 360KB AT      */
         { 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,"h720"  }, /*  6 720KB AT      */
         { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"H1440" }, /*  7 1.44MB 3.5"   */
         { 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"E2880" }, /*  8 2.88MB 3.5"   */
         { 6240,39,2,80,0,0x1B,0x43,0xAF,0x28,"E3120" }, /*  9 3.12MB 3.5"   */
 
         { 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, /* 10 1.44MB 5.25"  */
         { 3360,21,2,80,0,0x1C,0x00,0xCF,0x0C,"H1680" }, /* 11 1.68MB 3.5"   */
         {  820,10,2,41,1,0x25,0x01,0xDF,0x2E,"h410"  }, /* 12 410KB 5.25"   */
         { 1640,10,2,82,0,0x25,0x02,0xDF,0x2E,"H820"  }, /* 13 820KB 3.5"    */
         { 2952,18,2,82,0,0x25,0x00,0xDF,0x02,"h1476" }, /* 14 1.48MB 5.25"  */
         { 3444,21,2,82,0,0x25,0x00,0xDF,0x0C,"H1722" }, /* 15 1.72MB 3.5"   */
         {  840,10,2,42,1,0x25,0x01,0xDF,0x2E,"h420"  }, /* 16 420KB 5.25"   */
         { 1660,10,2,83,0,0x25,0x02,0xDF,0x2E,"H830"  }, /* 17 830KB 3.5"    */
         { 2988,18,2,83,0,0x25,0x00,0xDF,0x02,"h1494" }, /* 18 1.49MB 5.25"  */
         { 3486,21,2,83,0,0x25,0x00,0xDF,0x0C,"H1743" }, /* 19 1.74 MB 3.5"  */
 
         { 1760,11,2,80,0,0x1C,0x09,0xCF,0x00,"h880"  }, /* 20 880KB 5.25"   */
         { 2080,13,2,80,0,0x1C,0x01,0xCF,0x00,"D1040" }, /* 21 1.04MB 3.5"   */
         { 2240,14,2,80,0,0x1C,0x19,0xCF,0x00,"D1120" }, /* 22 1.12MB 3.5"   */
         { 3200,20,2,80,0,0x1C,0x20,0xCF,0x2C,"h1600" }, /* 23 1.6MB 5.25"   */
         { 3520,22,2,80,0,0x1C,0x08,0xCF,0x2e,"H1760" }, /* 24 1.76MB 3.5"   */
         { 3840,24,2,80,0,0x1C,0x20,0xCF,0x00,"H1920" }, /* 25 1.92MB 3.5"   */
         { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5"   */
         { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5"   */
         { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5"   */
 
         { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5"   */
         { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800"  }, /* 30 800KB 3.5"    */
         { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5"    */
 };
Personal tools