I want to know if I have badblocks on my sdb5 HDD.

Gene Heskett gene.heskett at verizon.net
Thu Nov 20 18:28:00 UTC 2008


On Thursday 20 November 2008, Steven Vollom wrote:
>I did the following in the Shell:
>steven at Studio25:~$ e2fsck -c
>Usage: e2fsck [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]
>               [-I inode_buffer_blocks] [-P process_inode_size]
>               [-l|-L bad_blocks_file] [-C fd] [-j external_journal]
>               [-E extended-options] device
>
>Emergency help:
>-p                   Automatic repair (no questions)
>-n                   Make no changes to the filesystem
>-y                   Assume "yes" to all questions
>-c                   Check for bad blocks and add them to the badblock list
>-f                   Force checking even if filesystem is marked clean
>-v                   Be verbose
>-b superblock        Use alternative superblock
>-B blocksize         Force blocksize when looking for superblock
>-j external_journal  Set location of the external journal
>-l bad_blocks_file   Add to badblocks list
>-L bad_blocks_file   Set badblocks list
>steven at Studio25:~$
>
>The following was included in a search:
>
>*Important note:* If the output of *badblocks* is going to be fed to the
>*e2fsck* or *mke2fs* programs, it is important that the block size is
>properly specified, since the block numbers which are generated are very
>dependent on the block size in use by the filesystem. For this reason,
>it is strongly recommended that users *not* run *badblocks* directly,
>but rather use the *-c* option of the *e2fsck* and *mke2fs* programs.
>
>
>Does the size of the blocks show here:
>
>255 heads, 63 sectors/track, 24792 cylinders
>Units = cylinders of 16065 * 512 = 8225280 bytes
>Disk identifier: 0x47a447a3
>
>  Device Boot      Start         End      Blocks   Id  System
>/dev/sda1   *           1        1824    14651248+  83  Linux
>/dev/sda2            1825       24792   184490460    f  W95 Ext'd (LBA)
>/dev/sda5           16523       24792    66428775   83  Linux
>/dev/sda6            1825        2006     1461852   82  Linux swap /
>Solaris
>/dev/sda7            2007       16522   116599738+  83  Linux
>
>Partition table entries are not in disk order
>
>Disk /dev/sdb: 81.9 GB, 81964302336 bytes
>255 heads, 63 sectors/track, 9964 cylinders
>Units = cylinders of 16065 * 512 = 8225280 bytes
>Disk identifier: 0xffffffff
>
>  Device Boot      Start         End      Blocks   Id  System
>/dev/sdb1               1        2591    20812176   83  Linux
>/dev/sdb2            2592        2856     2128612+  82  Linux swap /
>Solaris
>/dev/sdb3            2857        9964    57095010    5  Extended
>/dev/sdb5            2857        9964    57094978+  83  Linux
>steven at Studio25:~$
>If there are badblocks and they are identified on the HDD, can the HDD
>still be used?  If I format the HDD, will the badblocks be wiped and
>usable after format?  TIA.
>
>Steven

You cannot format a recent hard drive, with recent being defined as nearly 20 
years now.  The drives are factory formatted, and require instrumentation we 
don't have, so they just spin for a bit and return with no error. All we do 
is write the filesystems logical structure when we mke2fs a partition.

I believe badblocks can work in that asked about mode, if e2fsck tells it 
where to start and stop the scan at the partition boundaries.  That would 
tend to automate the process for a beginner, at the expense of having to run 
it on all the individual partitions in order to cover the whole disk.

From the badblocks manpage, it can generate a file in the correct format to 
send back to mke2fs or e2fsck and do it automatically from what I read.

So I would run it to generate the file, (on a usb key or someplace not on that 
drive) and then feed that file to e2fsck as a separate operation, which would 
check (and repair if it can) the whole drive in only 2 operations.  The first 
run is a lengthy procedure timewise, so expect an hour or more dependent on 
the hardware.  The 500Gb Maxtor that just failed for me was about 11 hours to 
check it all.

I have now zeroed the bootable flag on it using fdisk, so I can re-install the 
card and drive, and will see if its salvageable in the next day or so.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
FORCE YOURSELF TO RELAX!




More information about the kubuntu-users mailing list