Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Disk formatting
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Disk formatting process == Formatting a disk for use by an operating system and its applications typically involves three different processes.<ref group="lower-alpha">Each process may involve multiple steps, and steps of different processes may be interleaved.</ref> # Low-level formatting (i.e., closest to the hardware) marks the surfaces of the disks with markers indicating the start of a recording block (typically today called sector markers) and other information like block [[Cyclic redundancy check|CRC]] to be used later, in normal operations, by the [[disk controller]] to read or write data. This is intended to be the permanent foundation of the disk, and is often completed at the factory. # [[Disk partitioning|Partitioning]] divides a disk into one or more regions, writing data structures to the disk to indicate the beginning and end of the regions. This level of formatting often includes checking for defective tracks or defective sectors. # High-level formatting creates the [[file system]] format within a disk partition or a [[logical volume]].<ref name="Tanenbaum" /> This formatting includes the data structures used by the OS to identify the logical drive or partition's contents. This may occur during operating system installation, or when adding a new disk. [[List of file systems|Disk and distributed file system]] may specify an optional boot block, and/or various volume and directory information for the operating system. === Low-level formatting of floppy disks === The low-level format of floppy disks (and early hard disks) is performed by the disk drive's controller. For a standard [[Floppy disk#microfloppy|1.44 MB floppy disk]], low-level formatting normally writes 18 [[Disk sector|sector]]s of 512 [[byte]]s to each of 160 tracks (80 on each side) of the floppy disk, providing 1,474,560 bytes of storage on the disk. Physical sectors are actually larger than 512 bytes, as in addition to the 512 byte data field they include a sector identifier field, [[Cyclic redundancy check|CRC]] bytes (in some cases [[Error detection and correction|error correction bytes]]) and gaps between the fields. These additional bytes are not normally included in the quoted figure for overall storage capacity of the disk. Different low-level formats can be used on the same [[Recording medium|media]]; for example, large records can be used to cut down on inter-record gap size. Several [[freeware]], [[shareware]] and [[free software]] programs (e.g. [[GParted]], [[Fdformat|FDFORMAT]], NFORMAT, [[VGA-Copy]] and 2M) allowed considerably more control over formatting, allowing the formatting of high-density 3.5" disks with a capacity up to 2 MB. Techniques used include: * head/track sector skew (moving the sector numbering forward at side change and track stepping to reduce mechanical delay), * [[interleaving (disk storage)|interleaving]] sectors (to boost throughput by organizing the sectors on the track), * increasing the number of sectors per track (while a normal 1.44 MB format uses 18 sectors per track, it is possible to increase this to a maximum of 21), and * increasing the number of tracks (most drives could tolerate extension to 82 tracks: though some could handle more, others could jam). [[Linux]] supports a variety of sector sizes,<ref>{{Cite web|url=https://tools.ietf.org/doc/fdutils/Fdutils.html#Media-description|title = Fdutils}}</ref> and [[DOS]] and [[Microsoft Windows|Windows]] support a large-record-size [[Distribution Media Format|DMF]]-formatted floppy format.<ref>{{cite web |url=http://support.microsoft.com/kb/120348 |title=Definition of Distribution Media Format (DMF) |publisher=[[Microsoft Knowledge Base]] |date=2007-01-19 |access-date=2011-10-16 |archive-url=https://web.archive.org/web/20110914232540/http://support.microsoft.com/kb/120348 |archive-date=2011-09-14 |url-status=dead}}</ref> After establishing the structure of tracks, a formatter also needs to fill the entire floppy and look for [[bad sector]]s. Traditionally, the physical sectors were initialized with a fill value of <code>0xF6</code> as per the INT 1Eh's [[Disk Parameter Table]] (DPT)<!-- TBD: IIRC this resembles a bit pattern optimized for MFM controllers --> during format on IBM compatible machines. This value is also used on the [[Atari Portfolio]]. [[CP/M]] 8-inch floppies typically came pre-formatted with a value of <code>0xE5</code>,<ref name="Schulman_1994_Undocumented-DOS">{{cite book |author-first1=Andrew |author-last1=Schulman |author-first2=Ralf D. |author-last2=Brown |author-link2=Ralf D. Brown |author-first3=David |author-last3=Maxey |author-first4=Raymond J. |author-last4=Michels |author-first5=Jim |author-last5=Kyle |title=Undocumented DOS: A programmer's guide to reserved MS-DOS functions and data structures - expanded to include MS-DOS 6, Novell DOS and Windows 3.1 |publisher=[[Addison Wesley]] |edition=2 |date=1994 |orig-year=November 1993<!-- first printing --> |isbn=0-201-63287-X |url=https://archive.org/details/undocumenteddosp00andr_0 }} (xviii+856+vi pages, 3.5"-floppy) Errata: [https://web.archive.org/web/20190417215556/http://www.cs.cmu.edu/afs/cs/user/ralf/pub/books/UndocumentedDOS/errata.ud2][https://web.archive.org/web/20190417212906/https://www.pcjs.org/pubs/pc/programming/Undocumented_DOS/#errata-2nd-edition]</ref> and by way of [[Digital Research]] this value was also used on [[Atari ST]] and some [[Amstrad]] formatted floppies.<ref group="lower-alpha" name="NB_Magic_E5"/> Amstrad otherwise used <code>0xF4</code> as a fill value. === Low-level formatting (LLF) of hard disks === [[File:IBM PC XT 10 meg MFM low level format.jpg|thumb|Low-level format of a 10-megabyte [[IBM Personal Computer XT|IBM PC XT]] hard drive]] Hard disk drives prior to the 1990s typically had a separate [[disk controller]] that defined how data was encoded on the media. With the media, the drive and/or the controller possibly procured from separate vendors, users were often able to perform low-level formatting. Separate procurement also had the potential of incompatibility between the separate components such that the subsystem would not reliably store data.<ref group="lower-alpha">This problem became common in PCs where users used RLL controllers with MFM drives; [https://web.archive.org/web/20180609221448/http://webpages.charter.net/dperr/diskguid.txt "MFM drives should not be used on RLL controllers.".]</ref> User-instigated low-level formatting (LLF) of [[hard disk drives]] was common for [[minicomputer]] and [[personal computer]] systems until the 1990s. [[IBM]] and other mainframe system vendors typically supplied their hard disk drives (or media in the case of removable media HDDs) with a low-level format. Typically this involved subdividing each track on the disk into one or more blocks which would contain the user data and associated control information. Different computers used different block sizes and IBM notably used [[Count Key Data|variable block sizes]] but the popularity of the IBM PC caused the industry to adopt a standard of 512 user data bytes per block by the middle 1980s. Depending upon the system, low-level formatting was generally done by an operating system utility. IBM compatible PCs used the BIOS, which is invoked using the MS-DOS [[DEBUG (DOS Command)|debug]] program, to transfer control to a routine hidden at different addresses in different BIOSes.<ref>[http://support.microsoft.com/kb/60089 Using DEBUG to Start a Low-Level Format], Microsoft</ref> ==== Transition away from LLF ==== Starting in the late 1980s, driven by the volume of IBM compatible PCs, HDDs became routinely available pre-formatted with a compatible low-level format. At the same time, the industry moved from [[Hard disk drive interface#BSDI|''historical (dumb) bit serial interfaces'']] to modern (intelligent) [[Hard disk drive interface#BSI|''bit serial interfaces'']] and [[Hard disk drive interface#WSI|''word serial interfaces'']] wherein the low-level format was performed at the factory.<ref>{{cite web|publisher=The NOSPIN Group, Inc.|url=http://freepctech.com/pc/001/007.shtml|title=Low level formatting an IDE hard drive|website=FreePCTech.com|archive-url=https://web.archive.org/web/20120716043736/http://freepctech.com/pc/001/007.shtml|archive-date=July 16, 2012|access-date=December 24, 2003}}</ref><ref>{{cite web|website=The PC Guide. Site Version: 2.2.0 - Version Date: April 17, 2001|url=http://www.pcguide.com/ref/hdd/geom/formatUtilities-c.html|title=Low-Level Format, Zero-Fill and Diagnostic Utilities|access-date=May 24, 2007|archive-url=https://web.archive.org/web/20190103014814/http://www.pcguide.com/ref/hdd/geom/formatUtilities-c.html|archive-date= January 3, 2019}}</ref> Accordingly, it is not possible for an end user to low-level format a modern hard disk drive. === Modern disks: reinitialization === Modern hard drives can no longer perform post-production LLF, i.e. to re-establish the basic layout of "tracks" and "blocks" on the recording surface. ''Reinitialization'' refers to processes that return a disk to a factory-like configuration: no data, no partitioning, all blocks available to use. ==== Command-set support ==== SCSI provides a {{tt|Format Unit}} command. This command performs the needed certification step to weed out [[bad sector]]s and has the ability to change sector size. The command-line sg_format program may be used to issue the command.<ref>{{man|8|sg_format|Linux}}</ref> A variety of sector sizes may be chosen, but are not available on all devices: 512, 520, 524, 528, 4096, 4112, 4160, and 4224-byte sectors.<ref>[http://www.seagate.com/docs/pdf/whitepaper/tp595_building_faster_more_flexible_infrastructure.pdf Seagate SAS drives] {{webarchive |url=https://web.archive.org/web/20101129180307/http://www.seagate.com/docs/pdf/whitepaper/tp595_building_faster_more_flexible_infrastructure.pdf |date=2010-11-29}}</ref> Although the SCSI command provides many options, even resizing, it does not touch on the track layer where low-level format happens.<ref>{{cite web |title=INCITS 506-202x - Information technology - SCSI Block Commands - 4 (SBC-4) draft revision 22 |url=https://standards.incits.org/apps/group_public/download.php/124286/livelink |access-date=22 May 2023 |date=15 September 2020}}</ref> ATA does not expose a low-level format functionality, but they allow the sector size to be changed via {{tt|SET SECTOR CONFIGURATION}} ({{tt|--set-sector-size}} in <code>[[hdparm]]</code>). (Consumer drives usually only support 512 and [[Advanced Format|4096-byte sector]]s.) Although sector-size change may scramble data, it is not a safe way of erasing data, nor is any certification done. ATA offers a separate {{tt|SECURITY ERASE}} ({{tt|--security-erase}} in <code>[[hdparm]]</code>) command for erasure.<ref>{{man|8|hdparm|Linux}}</ref> [[NVMe]] drives have a standard method of formatting, available in, for example, the Linux command-line program {{tt|nvme format}}. Sector size change and secure erase options are available.<ref>{{man|1|nvme-format|Linux}}</ref> Note that NVMe drives are generally solid-state, making this "track" distinction useless. [[Seagate Technology]] drives offer a [[TTL serial]] debugging console.<ref>{{cite web |title=Seagate Serial Talk {{!}} OS/2 Museum |url=https://www.os2museum.com/wp/seagate-serial-talk/}}</ref> Among other things, the console can format the "system" and "user" partitions while performing defect checks (re-initialization over pre-established logical blocks) and modify track parameters (managing the ''real'' low-level format).<ref>{{cite web |title=F3 Serial Port Diagnostics |url=https://dokumen.tips/documents/f3-serialport-diagnostics.html?page=1}} older version available from </ref> ==== Disk-filling ==== When the hard drive's built-in reinitialization function (see above) is unavailable due to driver or system limitations, it is possible to fill the entire disk instead. On older hard drives without [[bad sector]] management,<ref>{{cite web |title=BadBlockHowto β smartmontools |url=https://www.smartmontools.org/wiki/BadBlockHowto |website=www.smartmontools.org}}</ref> a program will also need to check for any damaged sectors and try to spare them out. On newer drives with defect management, reallocated sectors may be left unerased, whereas the built-in re-initialization function will erase them.<ref name="Secure Deletion" /> In modern times, it is most common to fill hard drives with value of <code>0x00</code>. One popular method for performing this zero-fill operation on a hard disk is by writing zero-value bytes to the drive using the Unix [[dd (Unix)|dd]] utility with the [[/dev/zero]] stream as the input file and the drive itself (or a specific partition) as the output file.<ref>{{cite web|url=http://www.myfixlog.com/fix.php?fid=58|title=How to Securely Erase (Wipe) a Hard Drive for Free with DD|website=myfixlog.com|archive-url=https://web.archive.org/web/20160418143615/http://www.myfixlog.com/fix.php?fid=58|archive-date=April 18, 2016}}</ref> This command may take many hours to complete, and will erase all files and file systems. A value of <code>0xFF</code> is used on flash disks to reduce [[Program-erase cycle|wear]] . The latter value is typically also the default value used on ROM disks (which cannot be reformatted). Some advanced tools allow configuring the fill value.<ref group="lower-alpha" name="NB_Format_Wipe"/> Zero-filling a drive is not a secure method of preparing a drive for use with an encrypted filesystem. Doing so voids the [[deniable encryption|plausible deniability of the process]], as the encrypted areas (indistinguishable from random without a key, unless the cipher is compromised) will stand out among zero blocks. The correct technique is to zero-fill inside a temporary encrypted layer then discard the key and layer setup. ([[/dev/urandom]] provides similar safety, but tends to be slow.)<ref>[http://www.globallinuxsecurity.pro/quickly-fill-a-disk-with-random-bits-without-dev-urandom/ Quickly fill a disk with random bits]</ref> ==== Confusion ==== {{More citations needed section|date=July 2009}} The present ambiguity in the term ''low-level format'' seems to be due to both inconsistent documentation on web sites and the belief by many users that any process below a high-level (file system) format must be called a ''low-level'' format. Since much of the low-level formatting process can today only be performed at the factory, various drive manufacturers describe reinitialization software as LLF utilities on their web sites. Since users generally have no way to determine the difference between a complete LLF and ''reinitialization'' (they simply observe running the software results in a hard disk that must be high-level formatted), both the misinformed user and mixed signals from various drive manufacturers have perpetuated this error. Note: whatever possible misuse of such terms may exist, many sites do make such ''reinitialization'' utilities available (possibly as bootable floppy diskette or CD image files), to both overwrite every byte ''and'' check for damaged sectors on the hard disk. === Partitioning === {{main|Disk partitioning}} Partitioning is the process of writing information into blocks of a storage device or medium to divide the device into several sub-devices, each of which is treated by the operating system as a separate device and, in some cases, to allow an operating system to be booted from the device. On [[MS-DOS]], [[Microsoft Windows]], and UNIX-based operating systems (such as [[BSD]], [[Linux]] and [[macOS]]) this is normally done with a [[partition editor]], such as [[fdisk]], [[GNU Parted]], or [[Disk Utility]]. These operating systems support multiple partitions. Floppy disks are not partitioned; however depending upon the OS they may require volume information in order to be accessed by the OS. [[Partition editor]]s and ICKDSF today do not handle low-level functions for HDDs and optical disc drives such as writing timing marks, and they cannot reinitialize a modern disk that has been degaussed or otherwise lost the factory formatting. IBM operating systems derived from [[CP-67]], e.g., [[z/VM]], maintain partitioning information for [[VM (operating system)#Minidisks|minidisks]] externally to the drive. === High-level formatting === High-level formatting is the process of setting up an empty file system on a disk partition or a [[logical volume]] and for PCs, installing a [[boot sector]].<ref name="Tanenbaum" /> This is often a fast operation, and is sometimes referred to as ''quick formatting''. Formatting an entire logical drive or partition may optionally scan for defects, which may take considerable time. In the case of floppy disks, both high- and low-level formatting are customarily performed in one pass by the disk formatting software. Eight-inch floppies typically came low-level formatted and were filled with a format filler value of <code>0xE5</code>.<ref name="Schulman_1994_Undocumented-DOS"/><ref group="lower-alpha" name="NB_Magic_E5"/> Since the 1990s, most 5.25-inch and 3.5-inch floppies have been shipped pre-formatted from the factory as DOS [[FAT12]] floppies. In current IBM mainframe operating systems derived from [[OS/360]] and [[DOS/360]], such as [[z/OS]] and [[z/VSE]], formatting of drives is done by the INIT command of the [[ICKDSF]] utility.<ref>{{Cite web |url=http://publibz.boulder.ibm.com/epubs/pdf/ick4020f.pdf |title=Device Support Facilities User's Guide and Reference |access-date=2010-12-27 |archive-date=2021-12-09 |archive-url=https://web.archive.org/web/20211209100904/http://publibz.boulder.ibm.com/epubs/pdf/ick4020f.pdf |url-status=dead }}</ref> These OSs support only a single partition per device, called a volume. The ICKDSF functions include writing a Record 0 on every track, writing [[Initial Program Load|IPL]] text, creating a volume label, creating a [[Volume Table of Contents]] (VTOC) and, optionally, creating a VTOC index (VTOCIX); high level formatting may also be done as part of allocating a file, by a utility specific to a file system or, in some older access methods, on the fly as new data are written. In z/OS Unix System Services, there are three distinct levels of high-level formatting: *Initializing a volume with ICKDSF *Initializing a [[VSAM]] Linear Data Set (LDS) as part of allocating it on the volume with Access Method Services (IDCAMS) DEFINE *Initializing a [[zFS (z/OS file system)|zFS]] aggregate in the LDS using ioeagfmt. In IBM operating systems derived from [[CP-67]], formatting a volume initializes track 0 and a dummy VTOC. Guest operating systems are responsible for formatting [[minidisk (VM)|minidisks]]; the CMS FORMAT command formats a [[CMS file system]] on a CMS minidisk.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)