Tag Info

Hot answers tagged

15

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 ...


9

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 ...


8

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 ...


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 ...


6

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 ...


6

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) ...


5

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

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

You're working from a shaky premise, being that badblocks can solve your problem in the first place. Why badblocks Is an Untrustworthy Repair Method As you use a hard drive, it continually does its best to hide problems from you by swapping fresh sectors in for dodgy ones. The hard disk ships from the factory with a pool of spare sectors for this very ...


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

BtrFS can do "RAID1" with a single HDD. Meaning it will put a file twice across the disk. It also stores a checksum of each file, if one file becomes corrupted it can give you the other copy. Check out their wiki.


2

Try dumpe2fs -b /dev/<WHATEVER>


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.


2

Patch to limit badblocks to 2^32 There appears to have been a patch made for badblocks to add this particular limitation. See here, titled: Re: [PATCH 04/25] libext2fs: reject 64bit badblocks numbers. From: "Darrick J. Wong" <darrick.wong <at> oracle.com> Date: Wed, 23 Oct 2013 19:43:32 -0400 Subject: [PATCH] libext2fs: reject 64bit badblocks ...


2

Can the disk (ATA) be setup so that a failing read doesn't take too long, so that it can be dropped, and the reading process and the disk wouldn't be blocked, and the next read could be attempted? No. My understanding of this is that it's a logical problem resulting from a design choice (not unique to linux) that favours performance and stability for ...


2

I have no exact answer to your question, but i know openmoko project which had badblocks support on s2410. http://wiki.openmoko.org/wiki/NAND_bad_blocks


2

First things first, you should check whether or not your process is still attached to your terminal. $ ps -eo comm,tty | grep fsck Now, if you can still see a TTY value next to your process, you can still get its output (from this TTY). You can get your current TTY's ID using tty. However, if there's a ? next to your process, I'm afraid you can't get its ...


1

Letting badblocks write the pattern in the first place should be no slower than writing it any other way. Especially if you use the -b block-size and -c blocks-at-once options so it doesn't do small reads/writes. This example overwrites the disk with "random" pattern in 1MiB blocks: badblocks -v -w -t random -b 4096 -c 256 /dev/thedisk If there is a ...


1

First, do not use fdisk with GPT. Second, since the disk is indeed failing and considering that you have ample free disk space the best thing you can do is clone the entire disk to an image and then work on that image without caring about the disk. You can do this with dd if=/dev/sdc of=image_of_disk.img, assuming that the failing disk is /dev/sdc and it is ...


1

The best way to fix these bad sectors and to get rid of the warnings is by backing up, replacing the hardware and restoring (if the drive is part of a RAID-5, you should just swap the drive and let the RAID software reconstruct the contents). Although you could get rid of the problems with these sectors by remapping (or having the drive remap them for you ...


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 ...


1

I've tested it on armv5tel GNU/Linux 2.6.39+ by marking physical eraseblocks (PEB) as bad using the U-Boot command line: When the bad PEB count is higher than the amount of reserved PEBs, the volume will still be usable. As long as free blocks are available they are used to replace the bad ones. Problems will occur when all PEBs are used up and a new bad ...



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