Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a massive ZFS array on my fileserver. Whenever a disk reports bad sectors to smartmon, I order a replacement, and I shelve the failing one.

And by "shelving the failing one", I mean that I give it a low-level format if applicable, or a destructive badblocks run to possible claim spare sectors to replace the bad ones, then use it to dump my DVDs (and lately BluRays) on, so that I can use it with my HTPC and bring it with me when going to my friends to watch movies. It's just a really easy and portable way to watch movies with XBMC. I have the stuff on pressed discs already, so I'm not dependent on their reliance, and the dying drive just gets a hospice life serving as quick-access media storage. Keeping in mind Google's reports that drives are 39x more likely to die within 60 days after their first SMART error, I'm expanding that period by the fact that these drives mostly remain on their shelves and are only plugged into the SATA bay once or twice every year.

I'm just saying this to make clear that I'm not confused about these drives dying, and I'm not looking to elongate their lives ;)

So. Sometimes these drives, after a badblocks run, simply claim fresh sectors from the spare pool, but sometimes there aren't any left, and I face the fact that there are bad sectors in my FS. That's not a problem if you use one of a set of linux filesystems, as mkfs.* often takes a badblocks list as input. But seeing as I sometimes bring a drive or two to my girlfriend's (Mac) or one of my friends (usually Windows), I've decided to use NTFS for these things. Up untill now, when a drive had unrelocatable bad sectors, I've just written data to it, re-read it, and files that were bad were put in a "BAD_SECTOR_FILES" folder on the drive.

Sure, it works, but it would be really nice to be able to just mark those sectors bad instead. It's a lot of hassle the other way around.

So I read some posts, of which most quickly switch subject to the often accurate one of "replace your drive!!!", and some suggest spinrite, but really, I don't see why I should pay that much money for such a trivial task.

The alternative is to use ext3, but I'd like to hear if someone knows how I can feed badblocks output to mkfs.ntfs, so that the bad blocks aren't used. Or if there are other tools (I could use Windows in a VM) that do the same. I'm confused about chkdsk, it seems the bad sectors thing is FAT only?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

To mark sectors as bad on an NTFS filesystem requires modification and knowledge of the hidden "$BadClus" file. I'm not sure of a Linux utility capable of editing that file.

I was under the impression that a non-quick NTFS format would scan the hard drive and mark bad sectors to skip later. Have you tried just reformatting the drive with bad sectors in a Windows VM using either the FORMAT command or diskmgmt.msc and then do a chkdsk to see if it reports the number of bad sectors consistent with what you've discovered?

share|improve this answer
    
Kinda hoping I wouldn't have to, considering the r/w badblocks run takes 11 hours, and writing files to it and reading them back would take twice that at least, but I'll do it now, and report back ;) Either way, if anyone has the knowledge on how to do this natively in Linux, I'd really like to know :) –  DanielSmedegaardBuus Feb 20 '11 at 19:00
    
It finished after a busy night, though it only added 1 bad cluster to the bad clusters file. Accepting the tip as an answer, but if anyone knows how to manually modify this file to add more bad blocks, preferably on Linux, please let me know :) Thanks! –  DanielSmedegaardBuus Feb 21 '11 at 12:08

man mkfs.ntfs sais:

 Basic options
       -f, --fast, -Q, --quick
              Perform quick (fast) format. This will skip both zeroing of the volume and bad sector checking.

I suppose that if the flag is not used, a bad sector checking would be done

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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