Existe uma maneira de reiniciar os badblocks?

6

Eu tenho uma unidade de 1TB na qual gostaria de executar os badblocks, mas, como eu entendo, levaria cerca de 3 dias, gostaria de executá-los em partes (digamos, todas as noites) para que o computador seja disponível para uso durante o dia. É algo assim possível?

    
por Robert S. Barnes 25.12.2013 / 12:27

2 respostas

6

Existe uma maneira de especificar de qual bloco badblocks deve iniciar e o último bloco, (veja man badblocks ):

badblocks [ -svwnfBX ] [ -b block-size ] [ -c blocks_at_once ] [ -e max_bad_blocks ] [ -d read_delay_factor ] [ -i input_file ] [ -o output_file ] [ -p num_passes ] [ -t test_pattern ] device [ last-block ] [ first-block ]

    
por 25.12.2013 / 16:08
6

Eu encontrei essa ótima resposta para a pergunta na lista de discussão geral dos entusiastas do Linux em Atlanta :

I finally figured this out after much pondering and reading the man page about 10 times. I thought I'd share it in case someone else needs the info. Googling didn't help much, as those listings usually just quote the man page. When the man page says last-block first-block, it doesn't want you to enter those WORDS, it wants you to enter a NUMBER. It mentions that both are optional, but I cannot figure out how to leave out last-block if I want to specify first block.

Say you stopped your test originally at block 33000001. I would restart the test at one block less, so 33000000.

First, you have to determine what the last block number is on the partition. I've found two ways to do that.

  1. You can start badblocks without block numbers. It will tell you the block range it's processing.

    Ex: sudo badblocks -sv /dev/sda3

    And it says something like:

    Searching for badblocks in read only nondestructive mode from block to 66828373

    Write down this ending block number. Terminate the test with CTRL-C and then enter the command with the block numbers that you want.

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

Sincerely,

Ron

    
por 25.12.2013 / 19:08

Tags