UNFORMAT
has two modes of operation.
The first one restores a backup of the critical areas of the disk, a “Mirror” backup. These backups are created, space permitting, by the MIRROR
tool and by FORMAT
when it performs a quick format (which is the default in MS-DOS 5.0 and later). The backup contains a copy of the boot sector, FAT, and root directory; these are stored in a hidden file named MIRROR.FIL
. Obviously formatting a drive means that the location of that file is lost; to work around that, a pointer to the MIRROR.FIL
file’s clusters is stored in another hidden file named MIRORSAV.FIL
, stored in the last cluster of the disk.
If UNFORMAT
finds the signature of a Mirror backup, it displays the date and time at which the backup was created, and checks whether any file on the disk has been created since then. If everything is OK, and the user confirms they want to update the disk, the data from the backup is restored. Since a quick format only deletes the FAT and root directory, this results in a full restoration of the disk, if nothing was written to the disk after it was formatted.
The second mode of operation applies when no Mirror backup is available. In such cases, UNFORMAT
first looks for a Mirror backup (for scenarios where a MIRROR.FIL
file was stored on disk, but MIRORSAV.FIL
was overwritten); if it can’t find one, it looks at every single sector of the drive, looking for data structures matching directories. If it finds any, it uses the information present in the directory to restore its contents; this allows it to restore any unfragmented file stored in a subdirectory.
There are two important limitations with the second mode of operation: it can’t restore files which were stored in the root directory, and it can’t restore fragmented files. When UNFORMAT
comes across a fragmented file, it asks whether the user wishes to restore it (truncated), or delete it.
All of this was available in Central Point Software’s PC Tools, before it became available in MS-DOS 5. PC Tools also included a formatting tool, PC Format, which would perform quick formats and store Mirror backups. Microsoft licensed these tools for inclusion in MS-DOS 5 and later, in a simplified form compare to the PC Tools versions (in particular, the PC Tools versions have a more sophisticated user interface).
In MS-DOS 5 and later, it is also possible to quick-format a disk without storing the Mirror backup by specifying both /Q
and /U
options (FORMAT /Q /U
, quick and unconditional).
unformat
so I thought it might be part of "DOS9", a collection of joke programs (see discussion a thttps://rpgwatch.com/forum/threads/are-there-any-joke-programs-anymore.11587/). It seems to exist actually, however. Surprise!unformat
was chosen in the sense ofundelete
, i.e. "get back my data as it was before formatting the disk", not as in "I want to have the disk in pristine condition as if it came from the factory".