This wide- and large- screen layout may not work quite right without Javascript.

Maybe enable Javascript, then try again.

Home Fiddling with PCs

Disk Surface Scan



Disk Surface Flaws

The magnetic material on the surface of a computer disk almost always includes some microscopic flaws, no matter how careful the manufacturing was. These areas of course aren't usable because those microscopic flaws interfere with the storage of information. But it wouldn't work out to just throw away all those disks. Some way of making them useful despite the microsopic flaws in their magnetic material is needed.

Handling Flaws

The usual solution is to "catch" disk write operations to flawed areas and redirect them to some extra invisible space on the disk, then "catch" the corresponding disk read operations and return the appropriate data read from the extra invisible space. Nowadays this operation is performed by the disk itself (or by the "microcode" inside the disk if you prefer that terminology).

New disks already have most of their flawed areas identified. And if reading problems suggest an additional flawed area, the disk adds that area to its list of flaws and moves the data automatically. The user doesn't have to do anything.

Of course when installing a new OS, it often makes sense to first obtain the manufacturer's disk diagnostic program and have it scan (test) the entire magnetic surface and recreate the entire list of flawed areas. (Such diagnostics are usually [but not always] non-destrictive of data and can be run safely after the new OS is installed too. But rather than risking a surprise, use the disk diagnostics to scan (test) the whole surface before installing a new OS.) Note that a complete surface scan to completely rebuild the list of flawed areas can take a very long time, perhaps even several hours. So plan ahead.

This system works so well and so automatically that many users don't even realize their disk includes some microscopic flaws. Nevertheless very occasionally some reason may arise for using some tool other than the disk itself to handle the surface scan and the flaw redirection. Such an alternative is the disk scan and redirect tools built into Linux. Way back when Unix was invented, disks weren't so smart, and it was necessary to provide the entire set of scan and redirect tools some other way. So the whole set of tools was included inside Unix itself. Although seldom used, it's still there.

In most cases, using these tools isn't recommended because with both Linux and the disk thinking they're in charge of scanning and redirecting, the situation can be too complex to understand clearly. But there may be times anyway...

Command Line For Alternative

The Linux command to enter at a shell prompt to surface scan a disk partition is
   fsck -f -y -C -V -c -c /dev/xxan
Those parameters mean:

-f "force" the complete operation to occur even if the flag says the disk is "clean"
-yautomatically answer "yes" whenever an error is discovered which asks the user what to do
(needed for unattended automatic fix operation)
-C(note upper case)
present a progress bar showing how much of the operation has been completed
-V(note upper case)
enable "verbose" mode to keep the user apprised of what's happening by printing informative messages
-c -c(no that's not a stutter, it really does need to be entered twice for this particular piece of software - only once would specify the "shortcut" of only reading the existing data from every sector and relying completely on the disk itself to detect any problems, thus missing many flaws)
do a comprehensive surface scan operation by saving the existing contents of each area, writing a test pattern to the area, reading the area and making sure the data read is exactly the same as the pattern that was written, then finally restoring the initial contents of the area
xxanthe disk partition to be operated on:
xx is either sd for SCSI and for Serial/Sata disks, or hd for older Parallel/Pata ATA/IDE disks
a is a, b, c etc. to specify which disk
n is 1, 2, 3 etc. to specify which partition on the disk

(Note the disk partition should not be mounted [i.e. any possibility of being in use] during the operation. For some partitions the umount command will do all that's necessary; for others you may have to boot the system in "emergency" mode.)



Location: (N) 42.67995, (W) -70.83761
 (North America> USA> Massachusetts> Boston Metro North> Ipswich)

Email comments to Chuck Kollars
Time: UTC-5 (USA Eastern Time Zone)
 (UTC-4 summertime --"daylight saving time")

Chuck Kollars headshot Chuck Kollars' other web presences include Chuck's books and Chuck's movies.

You may also wish to look at Dad's photo album.

All content on this Personal Website (including text, photographs, audio files, and any other original works), unless otherwise noted on individual webpages, are available to anyone for re-use (reproduction, modification, derivation, distribution, etc.) for any non-commercial purpose under a Creative Commons License.