BACKUP & RESTORE for the FreeDOS project

© Copyright 1998-2000 by
 Ralf Quint
    The Pacific Coast Byte Factory

     Los Angeles, California

Written for the FreeDOS project


These two programs resemble the programs of the same name of MS-DOS. They are supposed to be compatible to those versions, enabling the user to exchange backups between FreeDOS and any given DOS version. Unfortunately complete compatibility is no easy to achieve. As FreeDOS tries to achieve compatibility to MS-DOS 3.3, the compatibility to the BACKUP and RESTORE of this DOS version was the primary goal in the development of the program. Extended compatibility will be tried to achieve in future versions of the FreeDOS versions of BACKUP and RESTORE.

One of the biggest problems in the development of BACKUP and RESTORE for FreeDOS was the fact that no information on the used data format was available. Even different versions of DOS were not able to read each others backup files, giving the user sometimes big headaches after upgrades or system crashes, as previous backups were not readable anymore. At least MS-DOS 6.22 came with a RESTORE program (beside the MSBACKUP.EXE) that is able to read at least backup files from DOS versions 2.x-5.x.
The basic hints about the data format of the different MS-DOS version were found in an article of the excellent German computer magazine c’t ( in 1989. The presented information were expanded by own reverse engineering and the demo programs, written in Borland Pascal, were improved to one, much more sophisticated RESTORE program. All this work is the base for the FreeDOS versions of BACKUP and RESTORE, written in C (Borland C++ 3.1/Turbo C++ 3.0), as supposed for the FreeDOS development.
Some additional information and testing tools have been available on Microsoft’s web site on this issue (

Beside the information how to use BACKUP and RESTORE for FreeDOS, this document is intended to give the basic information about the used data structures, files formats and further issues.


Data format for the DOS versions 2.0 to 3.2x

The Backup for these DOS versions creates one control file (BACKUPID.@@@) for each backup disk and a single backup file for each backup'd file.

The format of the BACKUPID.@@@ control file is as follows:
BACKUPID.@@@, 128 bytes
Offset Size  Contents
0x0000 1 byte Flag for multi disk backups, 0xFF=only/last disk of set, 0x00=not the last disk of multi disk set
0x0001 2 bytes 1 word, sequence number of the backup disk
0x0003 2 bytes 1 word, Year of the backup creation
0x0005 1 byte Day of the backup creation
0x0006 1 byte Month of backup creation
0x0007 121 bytes All bytes zero, no know usage so far

Each of these backup files consists of the original file contents preceded by a 128-byte header and the original filename.

The format of the file header is as follows:
Backup file header (128 bytes)
Offset Size Contents
0x0000 1 byte flag for split files, 0xFF=complete file, 0x00=split file
0x0001 2 bytes 1 word, sequence number of a spit file, 0x01 for complete file on disk
0x0003 2 bytes 1 word, ???
0x0005 78 bytes Full pathname of the backed-up file, without drive letter, zero terminated *1
0x0053 1 byte Length of the path/filename
0x0054 44 bytes  unknown (unused ???) 
0x0080 n bytes Original file contents
*1 Note: There is supposed to be a difference how MS-DOS 3.2 and IBM-DOS 3.2 handle the pathname entries. MS-DOS BACKUP writes the path name with a forward slash (/) and RESTORE accepts both forward and backward slash (\), while IBM-DOS accepts only the backward slash (\). The BACKUP program of FreeDOS writes only backward slashes and accepts both types in the RESTORE program. This avoids any further compatibility problems. On at least one system that i aquiered with MS-DOS 3.2 loaded, the backup files were written with the backward slash (\).

Data format for the DOS versions 3.30 to 5.x

Each backup disk consist of two files:
- A control file holding name, attributes, date/time stamp and size with the filename CONTROL.??? with .??? in the range 000 to 255 (or 999 ? Sorry folks, but I had no interest in testing this ;-) )
- A backup file (BACKUP.???) associated to the CONTROL.??? File, which is just one file copied after the other

The format of the control file is as follows:
Control file header, 139 bytes
Offset Size Contents
0x0000 1 byte 0x8B, length of the header record, including this byte
0x0001 8 bytes The signature “BACKUP  “
0x0009 1 byte Number of the backup disk (sequence), same as the extension
0x000A 128 bytes Unknown, all zero bytes
0x008A 1 byte 0xFF, indicator if last disk in backup sequence

followed by  a number of entries of one of the following types
Directory entry, 70 bytes
Offset Size Contents
0x0000 1 byte 0x46, length of the entry record, including this byte
0x0001 63 bytes Directory path name (zero padded ?), root is 0x00
0x0040 2 bytes 1 word, number entries in this directory
0x0042 4 bytes 1 long (?), 0xFFFFFFFF

It appears that at least one directory entry has to be written to the CONTROL file in order to define the source path of the backup-ed files.
File entry, 34 bytes
Offset Size Contents
0x0000 1 byte 0x22, length of the entry record, including this byte
0x0001 12 bytes File name
0x000B 1 byte Unknown, Flag for complete (03h) or split (02h) file
0x000C 4 bytes 1 long, original file size
0x0012 2 bytes 1 word, sequence/part of the backup file (1= first/complete, 2,3..=part of the file
0x0014 4 bytes 1 long, offset into BACKUP.??? File
0x0018 4 bytes 1 long, saved length in the BACKUP.??? File
0x001A 1 byte File attributes
0x001B 1 byte Unknown
0x001C 4 bytes 1 long,  file time/date stamp (DOS format, packed structure)

End of backup, 1 byte
Offset Size Contents
0x0000 1 byte 0x00, length of the entry record, excluding this byte

Data format for the DOS versions 6.x

With the newer, more enhanced versions of DOS emerging, unfortunately compatibility between the different DOS versions became an illusion. Not only that MS-DOS and PC-DOS went different ways after the split-up of the development between Microsoft and IBM, with Digital Research/Novell there was a third player with an even more different DOS version.
The Backup programs for these DOS versions are actually licensed versions of the Norton (Symantec) or Central Point (Symantec) backup programs. They use proprietary compression formats (QIC-113), which are for copyright reasons not usable. Even though the program became more sophisticated in their abilities, compatibility to earlier DOS versions seems never to be an issue for their implementation.

The FreeDOS BACKUP & RESTORE and the Y2K issue

Both programs use the DOS provided data structures to represent the files date and time stamp. These timestamps can be considered Y2K safe. Any date output of these two programs is using the 4-digit format and accepts any date in this format. 2 digit years are considered to be an offset to 1980, so being interpreted as being 1980 to 2079.

Coding/Compiling Requirements
The programs BACKUP and RESTORE for FreeDOS have been developed using Borland C++ 3.1 and Turbo C++ 3.0. They won't compile with the free available Turbo C 2.01 (yet), mainly because of a heavy use of the C++ style '//' comments. The sources themself are otherwise written in straight ANSI C (with the necessary DOS extensions), there are no C++ code used. All source files use the .C extension, all header files use .h extension, with the exception of the include files for the "build" number, which have the extension .bld. They source distribution for these programs provide the necessary .PRJ files (in BC/TC 3x format). The important settings are summorized in the following table:
Tabs Size
Memory Model
Code Generation: CPU
Code Generation: Floating Point
Display Warnings
*Note: I like to enable all warnings, as any warning is a potential source for "bugs". If time permits and I'm in a good mood (so I'm not getting too frustrated...), i will run PC-LINT (s. to eliminate any further existing inconsitencies.



Known problems and issues

Program history
start of the program(s) for the FreeDOS project
first public release for the FreeDOS project

These programs are basically the translation of an existing program from Turbo/Borland Pascal to the C language to meet the requirements of the FreeDOS project.
The information about the data format is acquired from an article of the German computer magazine c’t, published in 1989. This information is expanded by own re-engineering of the data written and read by the original MS-DOS BACKUP and RESTORE programs.

BACKUP and RESTORE for FreeDOS are written in Borland C++ 3.1 and Turbo C++ 3.0 (© by Borland Inc, now Inprise Inc).
MS-DOS™ of Microsoft Corporation
DR-DOS, Novell-DOS ™ of Caldera/Lineo.
Both programs were tested with the latest version of FreeDOS and the following DOS versions

Note: BACKUP and RESTORE for FreeDOS were tested on the following DOS versions for their functionality according to the specification of this document. The FreeDOS programs are not compatible with the BACKUP/RESTORE programs of these DOS versions!
DR-DOS 6.0
v7.0 (Windows 95)
Novell DOS 7.0
v7.1 (Windows 95SR2, Windows 98)
PC-DOS 2000

Road map for future program versions