The scan command displays the track layout of disks and disk images, including any non-standard attributes, and optionally the approximate track length and sector positions.
The results depend entirely on what the PC floppy disk controller is able to see on the disk, of course. Disks that aren't 100% PC compatible may be missing some details.
To scan all tracks on drive A:
SAMdisk scan a:
To scan the first 4 tracks on the first side:
SAMdisk scan a: -c4 -h0
Sample output for a 1.44M DOS disk:
80 Cyls, 2 Heads: 500Kbps MFM, 18 sectors, 512 bytes/sector: 0.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
The output starts with the scan range and a summary of the track format, which includes data rate, data encoding, sector count and size. The header represents the most commonly used details on the track, but specific sectors may differ.
If the header includes c=N and h=N, most sectors don't match their disk physical location. If all tracks show a cyl value twice the physical location, you probably need to use --double-step.
Each track begins with the physical location in cyl.head notation. This is followed by a list sector numbers in the order they're found from the index hole. If the sector details match the format header only the sector number is shown. If there is anything unusual about the sector, details are shown in square brackets after the sector number.
The following indicators may be seen following the sector number:
ni — no ID header found before data field (disk image only)
nd — no data field found after ID header
ic — ID header has CRC error (disk image and some FDCs)
dc — data field has CRC error
fm — FM sector on MFM track (currently DMK only)
r — sector number repeated on this track (matching CHRN)
d — data field uses deleted DAM (shown as suffix on sector number)
cN — ID header has cyl value of N.
hN — ID header has head value of N.
nN — ID header has size code of N (= 128 * 2^N bytes).
mN — N error copies of data field were read (differences shown below)
gN — N additional bytes of data follow data field (includes CRC and gap bytes)
Consider the following example copy-protected track:
250Kbps MFM, 10 sectors, 512 bytes/sector: 37.0 203[n0,nd] 193 198 194[m3,dc] 199 195 200 196 201 197 diff(194): =256 -32 +48 -176
All sectors except 203 and 194 match the 512-byte double-density track format in the header. Sector 203 has a size code of 0 (128 * 2^0 = 128 bytes), and no data field follows its ID header. Sector 194 has a data CRC error, and 3 samples of the data field were taken for comparison.
When multiple samples of error sectors are available (real disks, EDSK, IPF), the scan will display the differences between the data copies. This is useful for identifying likely weak sectors, or simply showing where real data damage is likely to begin. The difference may also be suppressed using the --no-diffs option.
The difference indicators used are:
=N - N bytes identical in each copy
-N - N bytes non-repeating, different between copies
+N - N bytes repeating (filler), different between copies
The difference line in the scan example above shows ~256 bytes identical, then ~32 bytes different, then ~48 bytes changing filler, then ~176 bytes different. This pattern of differences matches a known Speedlock weak sector protection.
Time stamps are taken during the scanning process, which can be used to estimate the position of each sector on the track, as well as the total track length. This does assume constant data rate and drive speed the same as when the data was written, but that's often the case.
Here's a sample track from a 1.44M DOS disk:
500Kbps MFM, 18 sectors, 512 bytes/sector: 0.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 12524: 169 681 682 682 682 681 683 682 682 682 682 682 683 682 681 682 682 682 
The first value (12524) is the track length in bytes, which is close to the expected 12500 bytes for a 500Kbps track on a 3.5" drive rotating at 300rpm.
The next value (169) is the approximate distance from the index hole to the first sector DAM. The remaining values (~682) are the relative distances to each of the next sectors. The final value in square brackets is the distance from the final sector to the index hole at the track wrapping point. If this value is less than the typical offset then the final data field overlaps the track wrapping point.
The sector offsets can help spot missing sectors and deliberately uneven spacing on some copy protections. They can even be used to help estimate the gap3 value used for a format, by subtracting the gap overhead (~62 bytes for MFM) and data field size from a typical sector offset value.
Adding the --gaps option will often improve the track length and sector offsets, by matching them against the data returned by the READ_TRACK command.
To display the contents of a disk image:
SAMdisk scan image.dsk
To scan a DMK disk image, including track length and sector offsets:
SAMdisk scan image.dmk --offsets
With flexible format disk images, the entire disk format is displayed. With simple sector-based images, only the basic track range and format are shown:
[msdos.img] 500Kbps MFM, 80 Cyls, 2 Heads, 18 Sectors, 512 bytes/sector.
To see the full output, perhaps to check the sector order, add the --verbose option.