Disk image size calculator
Type in a disk's geometry, or a SCSI drive's block count and block size, and get the raw image size in bytes and in both decimal and binary units.
Disk image size
READY. Type the numbers and press RUN.
The formula
bytes = cylinders × heads × sectors per track × bytes per sector
bytes = block count × block size
Worked example: 80 × 2 × 18 × 512 = 1,474,560 bytes, the size of a raw 1.44 MB PC disk image. The geometry (80 tracks per side, 2 heads, 18 sectors, 512 bytes per sector) is the PC 3.5-inch high-density format listed in source 1. Divide by 1,000 for kB or 1,000,000 for MB (decimal units), and by 1,024 for KiB or 1,048,576 for MiB (binary units).
What the result assumes
- Every track has the same number of sectors and every sector the same size. Some formats vary this from track to track, for example disks that use fewer sectors on inner tracks. For those, add the tracks up separately.
- "Cylinders" means tracks per side. A single-sided disk has 1 head.
- The result is an estimate of the uncompressed raw payload. Extra data, such as headers or metadata, can increase the size of the stored file, and compression can change it. How a particular image format stores the data decides the real file size.
- SCSI mode takes the total number of logical blocks and the logical block size in bytes, as you read them from the drive or emulator; the calculator does not look anything up. A READ CAPACITY response reports the last logical block address, so add 1 to it to get the total (source 3).
- Results are rounded half up to two decimal places. The byte count is exact.
- Interface choices, not rules of the disk formats: each field takes a whole number from 1 to 1,000,000,000,000,000 (10^15); a result above 10^21 bytes (one zettabyte) is refused; and GB and GiB are shown only for results of 100,000,000 bytes or more, where they stop being tiny.
Units
kB and MB are decimal: 1 kB is 1,000 bytes and 1 MB is 1,000,000 bytes. KiB and MiB are binary: 1 KiB is 1,024 bytes and 1 MiB is 1,048,576 bytes. The familiar "1.44 MB" floppy figure mixes the two: 1,474,560 bytes is 1.44 × 1,000 × 1,024 bytes.
Sources
- pc_dsk.cpp, PC disk image format table, row "1440K 3 1/2 inch high density", MAME project (18 sectors, 80 tracks per side, 2 heads, 512 bytes per sector)
- Metric (SI) Prefixes, National Institute of Standards and Technology (NIST), for kB, MB, GB and the zettabyte; and Prefixes for binary multiples, NIST, for KiB, MiB and GiB
- sg_readcap(8) manual page, sg3_utils project (READ CAPACITY reports the last logical block address and the logical block size)