LoadDskF/SaveDskF

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name LoadDskF/SaveDskF
Ontology
Extension(s) .dsk, .1dk, .2dk, ...

LoadDskF and SaveDskF are floppy disk imaging utilities by IBM. They have an associated file format, sometimes called DSK or SKF. The format was notably used for OS/2 service packs.

It most likely contains an image of a FAT12 filesystem.

Contents

Format details

The LoadDskF documentation says "all diskette sectors are written [to the image file] up to and including the highest occupied data sector". So, uncompressed files can be converted to raw FAT/IMA format by deleting the header, and appending padding if needed.

File structure

The following information is from a forum post.

+0  DW  magic     [all words are in Intel little-endian order]
            0x5AAA => Compressed 
            0x59AA => No compression
            0x58AA => Older format (no compression), with sector data 
                    beginning at fixed offset 0x200 rather than immediately 
                    after the comment. Created by SAVEDSKF with the 
                    undocumented /C option.

                (In fact, LOADDSKF accepts any magic number in the range 
                 58AAh-5AAAh, but these are the ones SAVEDSKF generates).

+2  DW  media type
                The first byte of the FAT.
+4  DW  sector size, bytes
+6  DB  cluster mask
                The number of sectors per cluster, minus 1.
+7  DB  cluster shift
                = log2(cluster size / sector size)
+8  DW  reserved sectors
                As in the BIOS parameter block
+10 DB  FAT copies
                As in the BIOS parameter block
+11 DW  Root directory entries   
                As in the BIOS parameter block
+13 DW  Sector number of first cluster (ie, count of sectors used by boot
        sector, FATs and root directory)
+15 DW  Number of clusters in image. This is probably less than the number of
        clusters the disc can hold, since empty clusters at the end are not
        saved.
+17 DB  sectors/FAT
                As in the BIOS parameter block
+18 DW  Sector number of root directory (ie, count of sectors used by 
                boot sector and FATs)
+20 DD  checksum
                Sum of all bytes in the file.
+24 DW  cylinders
                Number of cylinders, 40 or 80
+26 DW  heads
                Number of heads, 1 or 2
+28 DW  sectors/track
                Number of sectors per track
+30 DB  0,0,0,0    
                Do not appear to be used.
+34 DW  number of sectors in image
+36 DW  offset to comment
+38 DW  offset to the first sector. If this is 0, assume it is 0x200.

  After the header, an ASCII comment may follow. 

  The sectors then follow, stored in cylinder/head/sector order. If the magic
number is 5AAAh, the data will be compressed using a 12-bit LZW scheme.

Compression scheme

The compression scheme is the same LZW scheme used by OS/2 PACK archive.

Checksum

The checksum is derived from the payload data, interpreted as an array of 16-bit little-endian integers. If the file is compressed, it is based on the decompressed data.

Identification

Old format files start with bytes 0xaa 0x58.

New format uncompressed files start with 0xaa 0x59.

New format compressed files start with 0xaa 0x5a.

The value of the media descriptor byte is stored as 2 byte integer at offset two. So the upper byte of the media type at offset 3 is not used and therefore always seems to contain the value 0.

The number of cylinders is stored as a 2-byte integer at offset 24. Relatively small values appear here, with these often hovering around 40 or 80. Since the mid-nineties there exist super floppy disks with a capacity of several hundred MB with a correspondingly large number of cylinders in the thousands. Since the software for creating such disk images was designed for operation under DOS or OS/2 before that time, you will not find such high cylinder values in real examples.

The number of heads is stored as a 2-byte integer at offset 26. Only relatively small values like one or two appear here.

At offset 30 there are four bytes which are apparently not used and probably therefore always contain the value zero.

Software

  • DIUNPACK Rel. 3.03 (1996-01-30) (OS/2 software)
  • loaddf.zip - LoadDskF 1.16r (1993-01-14) and SaveDskF 1.14r (1992-05-26) - DOS and OS/2-compatible binaries; probably requires a floppy disk + drive.
  • DSKXTRCT - Exracts files (uncompressed disk images only) (OS/2 software)
  • dskdcmps - Decompresses compressed disk images (source code)
  • Deark - Can convert to raw, decompress (based on dskdcmps), etc.
  • MAKEDSKF - Utility for creating disk images (OS/2 software)
  • 7-Zip's support for FAT is robust enough that it can often handle uncompressed LoadDskF files.

Sample files

Resources

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox