Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello everyone,
If a HDD has bad sectors, does this mean the HDD should be thrown out?
If I format the HDD in the ext3 format, does it keep information about which sectors are bad and avoids using them?
Also, which Linux tool can scan a HDD and look for bad sectors?
Distribution: Ubuntu based stuff for the most part
Posts: 1,177
Rep:
Bad sectors happen and the hard drive will have a pool of spare sectors to swap in place of bad ones as they are found. The issue is when you start getting lots of bad sectors and the spare pool runs out.
You can use the smartctl command to test and get a report of the drive. This link has a nice over view: https://linuxconfig.org/how-to-check...using-smartctl
Bad sectors happen and the hard drive will have a pool of spare sectors to swap in place of bad ones as they are found. The issue is when you start getting lots of bad sectors and the spare pool runs out.
You can use the smartctl command to test and get a report of the drive. This link has a nice over view: https://linuxconfig.org/how-to-check...using-smartctl
Who handles that pool of spare sectors? Is it done by the internal logic of the HDD or is it done by the OS at the filesystem format level?
The OEM maker of the drive usually has diags to use.
badblocks might be used. There used to be some dos option to verify writes and if bad mark the area and try different. I think linux should do that but I can't find it just now.
"Modern disk drives will probably not show any defective sectors because they silently remap bad sectors to spare tracks,[5] but running the program with a new drive for several days will test the whole surface, and when reading it afterwards S.M.A.R.T. data will eventually show reallocated sectors."
A reported bad block/sector on a hdd can be as simple as a single ding on the platter. Or it could mean the hdd is about to self destruct (usually slowly). At best, and depending on importance (but what drive isn't important?), I would be replacing the drive. At the least, I would be making verified backups often, and watching for errors indicating imminent failure.
Operating system management of bad sectors hasn't been appropriate for years, decades in fact - it is all handled automatically by the drives these days.
As mentioned you can use smartctl to look at the reallocated sector count. A few, especially on older drives, might be nothing to worry about as long as the number is not rising on a daily or weekly basis. If it is the drive is failing and will die probably sooner rather than later so get any important data off of it before it fails.
mke2fs does still have the "-c" argument to check sectors can be read but with the huge capacities of modern drives it's unlikely to be useful in practice.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.