Re: "Repair" hard disk with bad sectors by reading and rewriting same data?
VanguardLH <[email protected]>
| Newsgroups | alt.comp.hardware |
|---|---|
| Organization | Usenet Elder |
| Message-ID | <[email protected]> |
"Percival P. Cassidy" <[email protected]> wrote: > I have a 6TB drive that shows 8 bad sectors. Would it be possible to > repair it without harm to the data using > > dd if=/dev/daX of=/dev/daX (and perhaps with bs settinng as well) ?? dd lets you copy an entire partition atop of itself? Seems dangerous. If there is an error during the operation, well, that's why dd is also known as disk destroyer. Presumably you don't know in file(s) encompass the bad sectors. Or do any files use those sectors, and instead the bad sectors are in free space? Why not use fsck (if the volume can be unmounted, like "sudo unmount /dev/daX", and then "sudo fsck /dev/daX)? If the bad sectors are in free space, go for it. If the bad sectors are used in files, do a logical (file) backup beforehand, or use dd to save a disk image (in another partition or to an .img file). I haven't used [U|Li]nux for many years. Wait until a *NIX guru shows up, but what you propose to write a partition atop of itself looks dangerous, and I would think dd would error on that attempt. Since dd is just a copy tool, I don't see that it will attempt to recover iffy sectors. The copy may be devoid of any files with bad sectors because, after all, they couldn't be read without error. "dd conv=noerror" will continue after an error, but it skips bad blocks. Adding the sync option just adds zeros instead of skipping the bad blocks. gddrescue also keeps going after an error, but it attempts recovery on a partial yield from a bad block while trying to read each sector in a block. However, in either case, if a block is completely unreadable then no data gets read from it into the copy or image. Is this such an old HDD that it doesn't include its own firmware to remap bad sectors using S.M.A.R.T.? If you read the SMART data from the HDD, and there is still a non-zero Current Pending Sector Count (raw count), that count doesn't go down after a reboot? The pending count should go down (to do the remapping using the HDD's firmware) while the Reallocated Sectors Count goes up. https://www.disktuna.com/reallocated-sectors-pending-and-event-count-dealing-with-bad-sectors/ See "Pending Sectors" section. Note that more remapped sectors means slower read and write speeds. The remapping (reading a remapped sector and then having to read the alternate sector used for remapping) takes time. If the Current Pending Sector Count does not go down, there are no more reserve sectors on that hard disk, so the bad sectors cannot get remapped. If that count doesn't go down, you need to look at replacing the hard disk, and soon. If the count goes down, the HDD's firmware did its job of remapping the bad sectors. With an ever-increasing pending count, you need to clone to a partition on a new or different HDD, and get all partitions off the old HDD onto the new one. There are many free tools to read SMART data from a drive. There might be some good free disk health monitor tools, but to get decent testing and recovery features often means having to pay. For example, there's a free version of HD (Hard Disk) Sentinel. I use that but under Windows, and I eventually went to a paid version. They have a full-feature trial version usable for 30 days. It's been too long since I used their free version to remember if it was effective to get bad sectors remapped (or prods the HDD to do it). Try the free version, and it that is insufficient then try their trial version. Just be aware that some "refresh" operations on a disk can be destructive (make sure your files are saved elsewhere). A simple copy operation, like you proposed, does not get a bad sector remapped. It just tries to copy what it can to the destination, but the bad sector remains bad at the source. While disk recovery tools are geared towards recovering data from bad sectors and then prodding the hardware to remap the bad sectors, maybe you can use "smartctl -t offline /dev/daX" to tell the disk's firmware to do an offline surface scan to get the bad sectors remapped. However, I don't know that attempts any data recovery from the bad sectors.