Tuesday, March 24, 2015

memperbaiki bad sector dengan linux

saya pertama menggunakan disk-utility
karena gagal untuk self-try dan gagal untuk mendeteksi bad sector.

You can check for badblocks running the command 
sudo badblocks -nsv /dev/[device-partition] > bad-blocks for a non-destructive read-write test. That will generate a file called bad-blocks with the sectors damaged. Then, you can run sudo fsck -t ext3 -l bad-blocks /dev/[device-partition] to tell the file system where the bad sectors are and move data away from them, if possible.

jangan lupa check file sistem dengan menggunakan command blkid.

jika lupa untuk membuat output text dengan command -nsv  maka
You can use the fdisk (or I think also sfdisk) command to list partition information. One of the columns of information is # of blocks. Find the number of blocks in the partition you're interested in and SUBTRACT 1 since the blocks are numbered starting at 0.
sudo fdisk -l /dev/sda (That option is a lower case L. In this case, you don't specify the partition number, just the hard drive designation.)
And it says something like:
/dev/sda2 ... /dev/sda3 ... 66828374 /dev/sda4 ...
Find the partition you're interested in and read the number of blocks and subtract 1 to find the last block number.
Now, you can enter the badblocks command as follows. Say you want to start testing in the middle of the partition at block 33000000. This example is for non destructive read write mode with badblocks list to a text file. If booted from a live cd, you will lose this text file when you reboot.
sudo badblocks -nsv -o ~/Desktop/badblocks.txt /dev/sda3 66828373 33000000
This will test from block 33000000 to the end of the partition. If you specify 66828374 as the last block, as reported in fdisk, it will report that block number as bad, but, in fact, that block number doesn't exist.
I hope others may find this useful, as it really confused me for a while.

No comments:

Post a Comment

have a question, just spill it :D