Since my student days, I had a bunch of hard drives. From time to time I upgraded them - sold the old ones, and instead put them more capacious. Then the demand for the volume was quite large, everything had to be kept on screws. But the Internet time has come, and the lokalki have disappeared by themselves. For a while, the disks were used as a file dumper for torrents. But the need to upgrade due to lack of volume gradually disappeared. In the end, I ended up with a bunch of pretty old hard drives that began to die gradually. They are not yet corpses, but they have already covered themselves with bad blocks and crawled toward the grave. Naturally, at the first signs of a bad, everything more or less valuable was transferred to a new screw, and the old one ...
So the question arose, what to do with the old one? Somehow it's a pity to throw out a 4TB screw when there are only a dozen bads on it. Moreover, in most cases, their number does not grow quickly, and this 4TB screw can be used for any nonsense for quite a long time. There was a question, how to make sure that the data on the bed did not fall. Most utilities are trying to restore these sectors. But with such a volume, the question arises - why? This process is very long, and ± GB on a disk in 4TB does not play a special role. Especially when there are several such living dead. A little googling way fast marking badov stumbled upon several branches on the forums where people were looking for something similar. But I never found a normal solution.
If there is no solution, it will be. A little thought, I decided to do the easiest way - to write a console utility that clogs a screw with files and then checks these files for reading. Is the file read? Well, the sector under the file is whole, the file is deleted. Not read? So we found a bad block, we leave the file on this bad so that nothing else is written to it.
Of the minuses of this approach - the place under the existing files is not checked, only free disk space. Of the benefits - quickly and can be done in "portions".
')
There are a total of 2 modes, full, and cleaning mode.
Full mode clogs the disk with files, then they are checked and deleted. To do this, specify the drive and the desired block / file size.
BadBlocksPlaceholder [disk] [file_size_kb] BadBlocksPlaceholder e:\ 4096
Files are created in the BadBlockPlaceholders \ yyyymmdd folder
The second mode is designed to continue checking / cleaning. To score 4TB files and check them for reading is also not an instant process, and sometimes you have to split it for a couple of days. In this mode, you need to specify a folder with the Placeholders files created in the first stage.
BadBlocksPlaceholder clean e:\BadBlockPlaceholders\20190110
Naturally, after cleaning, we leave BadBlockPlaceholders lying on the screw. I hope someone utility will come in handy. Only the happy-day script was checked, so don't be scared much, and don't kick much. Written in .net core / C #.
Sources are on
github .