# ubuntu: scan hard disk for physical problems

How do I scan my hard disk for physical problems in Ubuntu?

• i could have swore that the ubuntu installer disk gives you an option to scan just from the installation/boot menu. – djangofan Aug 11 '09 at 21:45

## 4 Answers

You probably want to use "badblocks".

You can use 'SMART' scan which should be available to you in Ubuntu. SMART is a program that analyzes data that is built in to most new hard drives. While this wont give you a full picture, SMART is the first place to look when you think you might be having issues. Also, back up your data ASAP!

here is a link to more information and some general usage regarding smartctl:

http://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html

The standard way to do this in *nix is the fsck command family, in your case, with -c switch to check bad blocks. You can use fsck command by itself, or like fsck.ext4 for a specific system. Like:

fsck.ext4 -cvf /dev/sda1


Here is its help:

Usage: fsck.ext4 [-panyrcdfvtDFV] [-b superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-l|-L bad_blocks_file] [-C fd] [-j external_journal]
[-E extended-options] device

Emergency help:
-p                   Automatic repair (no questions)
-n                   Make no changes to the filesystem
-y                   Assume "yes" to all questions
-c                   Check for bad blocks and add them to the badblock list
-f                   Force checking even if filesystem is marked clean
-v                   Be verbose
-b superblock        Use alternative superblock
-B blocksize         Force blocksize when looking for superblock
-j external_journal  Set location of the external journal
-l bad_blocks_file   Add to badblocks list
-L bad_blocks_file   Set badblocks list


As you see, it checks file systems, so you'll have to run it on all partitions if you want to check whole disk. Also, for it to access the partition, it needs to be unmounted. Which means, if you need to scan a root partition, you need to boot from a live cd/usb to access it.

Another way could be to use a bootable CD/USB stick with some dedicated SW ..

look here (on ServerFault!) for some suggestions.

I always use SpinRite, but it is -ware and not Ubuntu/OSS ..

• however once you get the spinrite disk made it will work with any OS. It is agnostic to the OS, as long as you have your computer able to boot from a CD. – Matt Jul 13 '09 at 16:30