* ropers <[EMAIL PROTECTED]> [2008-04-19 02:19:18]: > On 18/04/2008, Calomel <[EMAIL PROTECTED]> wrote: > > Ropers, > > > > You can find the badblocks utility prepackaged in "e2fsprogs". > > THANK YOU! :) I had wondered why I couldn't find badblocks among > OpenBSD's packages. This explains it. I will say in my defense ;-) > that badblocks is not ext2-specific, so while I have now seen that > it's part of these tools, possibly for historic reasons, that's not > necessarily a logical place for it to be. > > Looking at the package contents ( > http://www.openbsd.org/4.2_packages/i386/e2fsprogs-1.27p5.tgz-contents.html > ), I've also figured out how to search for stuff like this in the > future: > > http://www.google.ie/search?q=badblocks+inurl%3Aopenbsd.org+inurl%3Acontents.html&btnG=Search > > I was surprised though to find that GoogleBot doesn't appear to have > indexed most of these pages -- maybe because > http://www.openbsd.org/<x.y>_packages/<architecture>.html loads so > slowly? > > > BadBlocks Hard Drive Validation and/or Destructive Wipe > > http://calomel.org/badblocks_wipe.html > > Thanks for this info as well. I wonder why googling openbsd and > badblocks didn't turn that up for me. > > On 18/04/2008, Jon Simola <[EMAIL PROTECTED]> wrote: > > On 4/18/08, ropers <[EMAIL PROTECTED]> wrote: > > > Sometimes I find myself in need of a disk checking utility that can > > > check both disks with known *and unknown* filesystems, and/or that can > > > check even currently unpartitioned space on a disk. > > > > > > Not claiming to be an optimal solution (dd is faster), but does a read > > pass across the > > entire partition: > > $ sudo md5 /dev/rwd0c > > MD5 (/dev/rwd0c) = a85c2c67475f983a98007fd9a47378b7 > > > > Run it again and compare the hashes if you're worried. > > > > Works on floppies too, broken ones can't be read: > > $ sudo md5 /dev/fd0c > > md5: /dev/fd0c: read error: Input/output error > > $ tail -n1 /var/log/messages > > Apr 18 13:13:29 gamma /bsd: fd0c: hard error reading fsbn 0 of 0-3 > > (st0 40<abnrml> st1 20<bad_crc> st2 20<bad_crc> cyl 0 head 0 sec 1) > > > > In OpenBSD the 'c' partition covers the entire disk, so you'll > > probably want that most of > > the time. dd is very useful for this as well, but read the man pages > > carefully. > > Ah! Those are also very good thoughts! Now Steve rightly observed that > I wanted to do a write-test, but come to think of it, something like > this should allow one to do a "badblocks -svn"-alike non-destructive > write test: > > - Use dd to back up the entire device to /tmp. > - then copy /dev/arandom (or even /dev/srandom) to the device until > it's full and use tee to also duplicate what's being written to the > device to /tmp. > - md5sum the latter, duplicate file in /tmp > - md5sum the device, compare the hashes (& delete the file) > - finally, dd the original backup file back to the device and delete the > backup. > > This kludge could be used as a poor man's badblocks, if that's not > available, but it does require that twice the size of the device is > available in terms of disk space. > Yes, it's kinda horrible and probably useless in most situations, but > there we go. ;-) > > Thanks and regards, > --ropers > >
I don't know if anyone brought this up, and I hate to state the obvious, but if you're getting bad blocks then the hard drive has exhausted its ability to deal with them on its own and should be replaced. Otherwise you'll see data loss/corruption and a higher probability of a total drive failure. -- Travers Buda