0

I would like to run badblocks on one entire hard drive (8TB). For example:

$ sudo badblocks -wsv /dev/sdb

But, this will take days to complete. For some reasons, I can not leave the test PC on for days. I have to shut it down everyday.

Is that a good idea to create some temp partitions, for example format the drive to 8 fat32 partitions and then run badblocks on each partition instead:

$ sudo badblocks -wsv /dev/sdb1
$ sudo badblocks -wsv /dev/sdb2
$ sudo badblocks -wsv /dev/sdb3
$ sudo badblocks -wsv /dev/sdb4
$ sudo badblocks -wsv /dev/sdb5
$ sudo badblocks -wsv /dev/sdb6
$ sudo badblocks -wsv /dev/sdb7
$ sudo badblocks -wsv /dev/sdb8

In such case, I can power off the test PC after each badblocks on each partition.

After all tests are completed, I will reformat the drive to one single partiton with proper filesystem on it later.

Is this a good idea?

Thanks a lot.

sgon00
  • 1,335

3 Answers3

1

for example format the drive to 8 fat32 partitions and then run badblocks on each partition

Partitions and filesystems are different concepts (compare this answer). You don't need filesystems at all. In fact you don't even need partitions either. See man 8 badblocks, you can specify last-block and first-block after device:

badblocks [ -svwnf ] [ -b block-size ] [ -c blocks_at_once ] [ -e max_bad_blocks ] [ -d read_delay_factor ] [ -i input_file ] [ -o output_file ] [ -p num_passes ] [ -t test_pattern ] device [ last-block ] [ first-block ]
0

Your idea is bad. Using badblocks is a bad idea as well when you are running your disk under time constraints.

Use smartmontools to dump all SMART information into one file:

smartctl /dev/sdX > mysmart.txt

Replace the X in sdX by the drive label in question.

Then run ddrescue with your drive being the source and the null device as target using a log file. If a sector cannot be read, the log file gets an entry. You can interrupt and continue this task at will when you are always using the same log file. Furthermore you get defect information on sector level which is more precise than on aggregated level like block level, where a block typically consists of a couple of sectors. To run ddrescue in stop-and-go mode you don't need to create additional partitions.

At then end refetch the smart parameters because running ddrescue on the whole disc will update your smart parameter list in case of failures.

r2d3
  • 4,050
-1

Frame challenge

I think you're completely wasting your time.
Just use the drive.
If it turns out to be a lemon, send it back.

The very same tools you run to sequentially test for bad blocks & the ones you use to access the SMART data both rely on the drive's own firmware to actually do the mapping & reporting - so you can't really trust one yet not the other… they're the same thing.
The drive is perfectly capable of mapping out bad blocks every time it finds one. That's its job. All you do by making it do them all in one go is waste your time & perform an unnecessary write/read cycle of every block. The manufacturer already did that before shipping.

Tetsujin
  • 50,917