Formatting a hard drive using MS-DOS
Disk formatting is the process of preparing a hard disk or other storage medium for use by an operating system or a user.
Formatting essentially creates the file system structure that the operating system requires for data to be stored on the medium, and may also write other information to the storage medium, such as a boot sector.
There are many different file systems, such as FAT, FAT32, NTFS, HFS, ext2, ext3, UFS and so on.
Large disks can be formatted with multiple filesystems, divided into logical sections: this is known as partitioning. (Normally 'partitioning' refers only to hard disk drives; partitioning other drive types is generally unfeasible due to drive space and compatibility issues.)
Formatting a drive (or partition) effectively destroys all data it contains. For this reason, before formatting any disk, backups of vital data should be taken. However, the advantage of this is that a computer system running on a severely corrupted operating system or filesystem can be reverted to a fresh, uninitialized state by reformatting the disk.
However, as with regular deletion of files, data may be recoverable, unless they're securely deleted ("shredded") beforehand.
A formatting of a disk involves two quite different processes that have come to be known as "low-level formatting" and "high-level formatting." Low-level formatting deals with formatting of disk surfaces required by the disk controller hardware. High-level formatting deals with software-specific information written by a specific operating system.
Formatting a floppy disk
Warning: The below information on low level formatting of floppy disks may be technically incorrect.
The process is most easily seen with a standard 1.44MB PC floppy disk. Low-level formatting of the floppy normally writes 18 sectors of 512 bytes each on each of 160 tracks (80 on each side) of a floppy disk. That provides 1,474,560 bytes of storage on the floppy. (Sectors are actually larger than 512 bytes as they include sector numbers, CRC bytes, and other information required in order to identify and verify the sector during reading and writing.) Low-level formatting installs characteristics like sector numbers that are visible to, and used by, the hardware and disk controller. To further complicate the concept, different low-level formats can be used on the same media; for example, large records can be used to cut down on interrecord gap size. Linux supports a variety of sector sizes, and DOS and Windows support a large-record-size DMF formatted floppy format.
On the other hand, high-level formatting is unique to a file system. In the case of MS-DOS (FAT12), the writing of an initial "boot" record—which may just contain code to indicate the disk is not bootable—is required, as well as two copies of the file allocation table and an empty root directory.
In the case of floppy disks, both high- and low-level formatting are customarily done in one pass by user software—FORMAT in the case of DOS. In recent years, most floppies have shipped preformatted from the factory as DOS FAT12 floppies. It is possible—if not always easy—to reformat them to other formats.
Low-level formatting a hard disk drive
Early hard disks were quite similar to floppies, but the low-level formatting was generally done by the BIOS, rather than by the operating system. This was a fairly bizarre process that involved using the MS-DOS debug program to transfer control to a routine hidden at different addresses in different BIOSs.
Starting in the early 1990s, the low-level formatting of hard drives became more complex as technology improved to
- use different numbers of sectors per track on longer outer tracks.
- encode track numbers into the disk surface to simplify hardware and increase the speed of head motion, etc.
Rather than face ever-escalating difficulties with BIOS versioning, disk vendors started doing low-level formatting at the factory. High level formatting is done on a per-partition basis, and it formats the partition to work with a specific file format.
Today, an end-user, in most cases, should never perform a low-level formatting of an IDE or ATA hard drive; reinitializing an IDE or ATA hard drive is much more common. (The NOSPIN Group, Inc., n.d.).
Low-level formatting hard drives is frequently confused with "zero-writing" in which every bit of data on the drive is systematically over-written with zeros (returning the drive to a "factory-fresh" state).
- Secure Deletion of Data from Magnetic and Solid-State Memory (http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html) by Peter Gutmann
- Illustrated guide (http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm) on Jegsworks