16

Is there a utility in DOS or Windows that is as thorough as badblocks on Linux?

5 Answers 5

9

With the Windows Subsystem for Linux, you can run badblocks directly under a Windows 10+ host.

  1. Have a working WSL2 installation

  2. In a console window, identify the physical path of your disk in Windows:

    wmic diskdrive list brief

  3. Copy the "DeviceID" for the appropriate drive:

Caption                         DeviceID             Model                           Partitions  Size
SMI USB DISK USB Device         \\.\PHYSICALDRIVE6   SMI USB DISK USB Device         1           124654118400
  1. Mount the disk so it is visible to WSL2:

    wsl --mount \\.\PHYSICALDRIVE6 --bare

  2. Inside of WSL, find the newly added device with lsblk:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sde      8:64   0  12.8T  0 disk
└─sde1   8:65   0  12.8T  0 part
  1. Run badblocks against the device:

    badblocks /dev/sde

  2. After badblocks completes, don't forget to unmount the disk so that it can be used again in Windows:

    wsl --unmount \\.\PHYSICALDRIVE6

2
  • 2
    These instructions are valid as of Insider Build 20231 and above. The mount feature will enter general availability in September 2021, with the Windows 10 21H2 release: github.com/microsoft/WSL/discussions/6061
    – Scorpion
    May 7, 2021 at 14:25
  • 2
    Still not available in Win10 Pro 21H2 19044.1387 😢
    – mpen
    Dec 8, 2021 at 6:35
7

The best tool I've ever encountered for testing a hard drive for bad sectors is called SpinRite:

  SpinRite 6
  http://www.grc.com/sr/spinrite.htm

It was created by Steve Gibson (who writes most of his code in Assembler), and I remember using it back in the late 1980s on XT computers (with 4.77 MHz 8086/8088 processors) to recover bad sectors from failing hard drives.

The current version also works very well (and you also get the benefit of the many years of Steve Gibson's experience in maintaining this software to ensure it works reliably with all types of hard drives).

It is far more thorough than the ScanDisk or ChkDsk programs included with DOS and Windows.

enter image description here

enter image description here

enter image description here

enter image description here

3
  • 3
    I know this is a really old answer, but it bears pointing out - Spinrite is pointless. It claims to be able to recover data (#1) and warn about failing sectors (#2). It does #1 by repeatedly reading the bad sectors 2000x, which can make a bad drive worse. Any data recovery professional always clones a bad drive to a working one instead of reading off the bad one repeatedly. And ddrescue for example would be a better software option here. #2 is just reading SMART data which any free tool can do. tl;dr save your $90 and spend it on a new drive. Answer above is likely spam. Dec 8, 2021 at 2:56
  • I thought about buying Spinrite once. But then I read more about what it does - which is to use the drive's built-in error handling capability, triggered by reading at a low level. Simply using dd if=/dev/sdwhatever > /dev/null has "recovered" a couple of my semi-failing disks enough for me to get data off, I suspect in the same way that Spinrite would've done. That said: Spinrite has a nice interface, and Steve Gibson I think in general makes a positive impact on the world (Security Now is also a really good podcast). So it's certainly not a bad thing in my opinion to buy the software.
    – dannysauer
    May 5, 2022 at 15:05
  • 2
    Security now is just reading a list of vulnerabilities at best, I can't say the info is generally inaccurate, but I find it dull. I can read a list faster than listening to one. However, the software he sells is snake oil based on unfounded claims of his Elite Magical Tech Skills. At best spinrite does what a free tool could do, at worst it makes your disk unrecoverable, and I would hardly call a DOS interface "nice". But eh to each their own I guess. Jun 2, 2022 at 5:33
3

To update these answers for anyone who finds this as of 2014:

chkdsk with either /r or /b switches is roughly equivalent to badblocks in the default read only mode

SpinRite has far better data recovery capability run at the default level 2

Run at level 4 it's equivalent to badblocks non-destructive read write mode, but with better data recovery capabilities.

However it falls over with divide overflows on modern huge drives, you'll need to wait for SpinRite 6.1 to fix this, development has started on 6.1 according to Steve Gibson on the Security Now netcast, but is suspended again while he completes another project.


Meanwhile, the nearest functional Windows based method to recreate the non destructive read/write badblocks mode for large drives requires owning storage equal to or greater than the drive being tested and would proceed thus:

  1. Download and install a disk image program (Macrium reflect free, Acronis True Image either the commercial or drive maker's free version, or some other)

  2. Create the WinPE recovery disk (you'll need later) and an image of the drive, with intelligent sector copy unchecked, and continue on finding bad sectors checked (both reverse of the default). This recreates the read pass.

  3. Use the drive maker's DOS tool to zero fill the drive (roughly equivalent to the write phase)

  4. Use the recovery CD to restore the image made in step 2 to restore the image you made to it's original location. (roughly equivalent to the write data back phase)

In the above scenario, or when using badblocks a modern drive's internal logic will handle remapping any bad sectors found when they're attempted to be written to.


To recreate the badblocks destructive test you'll need a commercial UK (not US) government approved drive wiping program and you'll need to run it at the higher security level, this will write patterns repeatedly to the drive and verify each pass much as badblocks does.


So until Spinrite 6.1 or later gets released, the question becomes, "Why would you want to do that?"

Downloading pretty much any Linux live CD/DVD will give you a bootable platform to run badblocks, which is cheaper, easier, and safer for your data, for any scenario where you need more than the read only test.

If you want the read only test, just run CHKDSK with the /r switch

If you want to run CHKDSK /R on your system drive under Vista note it will ignore that you told it to run and skip the test on reboot unless you also use FSUTIL to mark the filesystem as dirty.

6
  • 1
    CHKDSK = Read-only, CHKDSK /R = "R"ecovery, which is most definitely NOT read-only. :) Anyhow, to me, this answer is merely commenting on existing answers and is not actually providing a new/different answer. Apr 25, 2014 at 16:36
  • 1
    CHKDSK /R certainly isn't read only I'll grant, but it does no write tests, in which sense you could call it an "only read" test, it only writes for error correction purposes, this has the limitation that it can't force a remap of a defective sector the way badblocks will in read write mode.
    – Beardy
    Apr 26, 2014 at 5:09
  • Since the first answer only addresses how to test the first part of a large drive (owing to limitations of the software) What I've added is a method to force sector remaps further into such drives as badblocks can, using DOS/Windows methods, nobody sane is going to do it that way, but it's answered...
    – Beardy
    Apr 26, 2014 at 5:16
  • @Beardy - I have the latest SpinRite - I guess 6.3 - Will have to check? I also have Linux bootable to run Badblocks / FS. I need to do a thorough pre-check for 2TB WD & 2 x 1TB Seagate drives. Should I use SR or BB or both.. if so in what order? I am wondering what kind of overlap in functionality they have?
    – Alex S
    Sep 24, 2015 at 13:14
  • 1
    "chkdsk with either /r or /b switches is roughly equivalent to badblocks in the default read only mode" - Midleading statement, as was pointed out to you in comments, and as you've admitted in comments, but didn't update the post. Downvoted.
    – cp.engr
    Jan 16, 2018 at 15:11
2

chkdsk with the appropriate switch

/R Locates bad sectors and recovers readable information

/b NTFS only: Clears the list of bad clusters on the volume and rescans all allocated and free clusters for errors. /b includes the functionality of /r. Use this parameter after imaging a volume to a new hard disk drive. Works only on vista or better.

See here for a more complete switch list

-1

scandisk (DOS) / chkdsk (Windows) perhaps?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .