Tag Info

Hot answers tagged

13

Let /dev/sda be the new drive on which to test destructive-rw and /dev/sdb the old drive where you want non-destructive-r # badblocks -wsv /dev/sda # badblocks -sv /dev/sdb -s gives the process indicator -v gives verbose output -w enables destructive read-write -n would be non-destructive read-write Read-only testing is the default and doesn't need ...


7

Bad sectors are always an indication of a failing HDD, in fact the moment you see an I/O error such as this, you probably already lost/corrupted some data. Make a backup if you haven't one already, run a self test smartctl -t long /dev/disk and check SMART data smartctl -a /dev/disk. Get a replacement if you can. Bad sectors can't be repaired, only replaced ...


7

From examining the source code, I find that: If you didn't specify -n or -w, badblocks doesn't write to the disk at all, so you're safe interrupting it. If you specified -w, badblocks has already overwritten the filesystem, so it's much too late to worry about interrupting the process. If you specified -n, badblocks uses a signal handler to prevent the ...


6

All these "poke the sector" answers are, quite frankly, insane. They risk (possibly hidden) filesystem corruption. If the data were already gone, because that disk stored the only copy, it'd be reasonable. But there is a perfectly good copy on the mirror. You just need to have mdraid scrub the mirror. It'll notice the bad sector, and rewrite it ...


5

When you're using ext4, you can check for badblocks with the command e2fsck -c /dev/sda1 or whatever. This will "blacklist" the blocks by adding them to the bad block inode. e2fsck -c runs badblocks on the underlying hard disk. You can use the badblocks command directly on a LVM physical volume (assuming that the PV is in fact a hard disk, and not some ...


5

Your guess is correct. The source code looks like this: if (v_flag) fprintf(stderr, _("Pass completed, %u bad blocks found. (%d/%d/%d errors)\n"), bb_count, num_read_errors, num_write_errors, num_corruption_errors); So its read/write/corruption errors. And corruption means comparison with previously written data: if (t_flag) ...


4

I've just had pretty much the same problem with a RAID1 array. The bad sector was right at the beginning of one of the partitions - sector 16 of /dev/sdb2. I followed the instructions above: after verifying that logical block 2 was not in use by the file system and being careful to get dd seek and skip the right way around, and zeroed out 1 file system ...


4

If you're looking for advanced filesystems for general-purpose computers in the Linux world, there are two candidates: ZFS and BTRFS. ZFS is older and more mature, but it's originally from Solaris and the port to Linux isn't seamless. BTRFS is still under heavy development, and not all features are ready for prime time yet. Both filesystems offer per-file ...


4

You're working from a bad premise, being that badblocks can solve your problem in the first place. When badblocks finds bad sectors on the disk, what it is really telling you is that the hard disk has run out of spare sectors, which means that it has been degrading for some time. Up until the point where badblocks can actually detect this, the hard drive ...


4

Your disk had some problems with reading data from the surface, but it seems that the disk dealt with it. I had similar situation: Error 29 occurred at disk power-on lifetime: 18836 hours (784 days + 20 hours) When the command that caused the error occurred, the device was active or idle. After command completion occurred, registers were: ER ST SC SN ...


4

Sounds like you have a bad cable. The drive renaming itself is indicative of the USB connection being dropped and restarted and the kernel assigning the next device name to the subsequent connection. I'd watch dmesg for USB errors while accessing the drive. If it works with the short cable, that further reinforces your long cable is bad. Also keep in ...


3

No, bad sectors are not always an indication of a failing drive. Sometimes if a write is in progress at the time of a power failure, the data in the sector will be corrupted, resulting in an error when you try to read it. Attempting to write new data to the sector may work just fine since there's nothing physically wrong with it. You can run badblocks -n ...


3

I'm pretty sure LVM doesn't handle bad blocks; it expects the underlying storage to. And most, if not all, modern hard disks do. You may need to perform a write to the sector, but the disk should remap it. (You may need it to do an offline surface scan first, with e.g., smartctl /dev/sda -t offline). That said, LVM doesn't actually move data around unless ...


3

No, you can't. You should also check the drive's SMART status either with the gnome disk utility or with smartctl from the smartmontools package. If it is only a few bad sectors, md should have tried to rewrite them, which should have triggered the drive to automatically remap them to the spare pool. If you have enough bad sectors that the spare pool has ...


2

There are no reallocated sectors because they failed to reallocate.Your drive is showing 5 Offline_Uncorrectable sectors, which happens when automatic repair fails. There are obvious read failures shown in the dmesg output, SMART errors, and read failures from SMART tests. There are ways of repairing these sectors as you have mentioned in the question, but ...


2

The last few lines of that strace tell a fairly boring tale: badblocks opens the drive device, gets its size, closes it, reopens it and then goes off to do some work, which fails in some way strace doesn't show. You'd have to use gdb or similar to dig deeper. Your symptom may go away if you unmount the partition so badblocks has a stable thing to work on. ...


2

ZFS has by default multiple copies of every meta data block. You can enable this feature for data blocks and then have some protection against (localized and non massive) disk errors. http://blogs.oracle.com/bill/entry/ditto_blocks_the_amazing_tape Automatic ZFS Snapshots are also a popular way to protect files against accidental deletion or corruption.


1

pvck can check LVM metadata, after that consistency is the job of the filesystem. LVM is only about volume management so it doesn't need to care if the space constituting a particular extent is bad since higher level software catches those issues. LVM metadata only takes up the first (optionally also the last sector) of the physical volume anyways. If just ...


1

btrfs and zfs are engineered for data integrity. By default, btrfs duplicates meta-data on single device configurations. I think you can duplicate data too, although I've never done it. zfs has copies=n - which I think of as RAID1 for a single-disk. Consider that the amount of redundancy chosen will negatively impact usable device space as well as the ...


1

SMART doesn't remap sectors, it just detects and logs errors. Bad sectors are remapped automatically when written to. You can do this with dd or hdparm --write-sector. If your drive cannot remap the sector because it has run out of reserve sectors then you should be one step before panic. Remapping them in the file system does not make much sense. If ...



Only top voted, non community-wiki answers of a minimum length are eligible