6

I did a search beforehand and I don't think a similar question has been asked before.

I have two hard disk drives - a 1TB Seagate and a 1TB Western Digital. My Seagate drive crashed a while back and I suspect it may have some damaged sectors. I was just wondering what is the best way to perform a hard drive scan in Ubuntu and check hard disk health in general? I know both Seagate and WD provide their own software for scanning and repairing drives - can these be installed in Ubuntu? If not then can anyone tell me what method is recommended? Or, is it better to use the manufacturer's proprietary software through Windows?

  • 2
    It looks like fsck can be used to check a Unix filesystem, but what I'm asking about is scanning the disk itself, regardless of filesystem (for example, scanning my Windows HDD). I've read that it's recommended to use the manufacturer's own software if possible - is there an acceptable alternative in Ubuntu? – Time4Tea Dec 16 '14 at 0:51
  • Read it again. fsck can handle most filesystems (including FAT by default, and NTFS with a small modification) – krowe Dec 16 '14 at 1:04
3

A standard filesystem scan is usually done with fsck. This application handles most filesystems out of the box. However, you may need to install NTFS support separately on some installations.

If you'd like to do a surface scan of your drive you can use e2fsck. Use the -c option to do a bad sector scan.

It should also be mentioned that nearly every Linux distro is also configured by default to periodically scan your fixed drives on boot. They will also typically be setup to do this on a schedule (this is important since most Linux boxes rarely need to be reset).

  • 1
    Well, e2fsck with -c seems to just call badblocks, so I guess I could just use that, right? Is there any benefit to using it through e2fsck? – Time4Tea Dec 16 '14 at 3:18
  • e2fsck is going to know how to handle the filesystem, which will come in handy if it needs to remove part of it. – krowe Dec 16 '14 at 3:29
  • 2
    You can use badblocks separately, but if you call it from e2fsck, it will mark the bad blocks in the FS... – Fabby Dec 16 '14 at 16:37
  • 1
    That should say "fsck", not "fschk", shouldn't it? – mwfearnley Jun 6 '17 at 14:03
  • @mwfearnley Yes, fixed. – krowe Jun 6 '17 at 22:24
3

I did a bit more reading into this myself. These two pages gives some tips about scanning hard drives/filesystems in Linux (they also mention fsck and badblocks):

http://www.howtogeek.com/howto/37659/the-beginners-guide-to-linux-disk-utilities/

http://mypage.uniserve.ca/~thelinuxguy/doc/hdtest.html

There is also the Ubuntu 'Disk Utility' package, which allows checking of the HDD SMART status.

2

You can use the command smartctl from the package smartmontools:

sudo apt install smartmontools
sudo smartctl -a /dev/sda

Where /dev/sda is the name of the device you want to scan.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.