Search raisama.net:

Eduardo Habkost raisama.net

diary / Hardware

Dom 22 Mar 2009
17h01min
permalink

SMART and bad block reallocation fun

I’ve spent last night trying to find out how to handle some bad blocks reported by smartd, on the hard disk of a old laptop. The Bad block HOWTO for smartmoontools has lots of useful information, but too many calculations to be done by hand. To ease on the task, I’ve written a script to help on the task. The script simply does the calculations described on the HOWTO and shows you the result.

This is a sample run:

# ./lba2fs.py /dev/sda 11475078  # SMART says LBA 11475078 is bad
lba2fs, by Eduardo Habkost <ehabkost@raisama.net>
If you want to know what to do with the output of this program, check:
http://smartmontools.sourceforge.net/badblockhowto.html

[/dev/sda sector 11475078]
Press Return to automatically probe, or enter command:
cmd>
I think I've found: partition table
Checking the partition list...
/dev/sda2 sector 11073453
[/dev/sda2 sector 11073453]
Press Return to automatically probe, or enter command:
cmd>
I think I've found: LVM volume
Checking the PE where the block is located
pe_start: 384 sectors
PE: 168
Checking on which LV the PE is located
Found PE range on map (LV)
Checking maps of LV...
/dev/VolGroup00/LogVol00 sector 11073069
[/dev/VolGroup00/LogVol00 sector 11073069]
Press Return to automatically probe, or enter command:
cmd>
I think I've found: ext3 filesystem
Checking ext2 fs block...
Block size: 4096
Block: 1384133
debugfs 1.41.4 (27-Jan-2009)

GOOD: ext2fs block 1384133 at /dev/VolGroup00/LogVol00, not in use

You can zero the block running the following command, but:
1) Don't do that if the device is in use (e.g. filesystem mounted)
2) *You will lose data* that is stored on the block. It looks like
   It is safe to do that on this block, but be careful. Are your
   backups up to date?  8)

  dd if=/dev/zero of=/dev/VolGroup00/LogVol00 bs=4096 count=1 seek=1384133

I recommend doing a read-test on the block first, to see if an I/O error
is returned. Use the 'read' command for that.

[ext2fs block 1384133 at /dev/VolGroup00/LogVol00, not in use]
Press Return to automatically probe, or enter command:
cmd>

As you can see above, fortunately on my case the bad block was unused on the ext2 filesystem, and I could safely write to it to force the drive to reallocate the bad sector, and the I/O errors are gone.

The script just try to read from the devices, with no code to write to them, so it should be always safe to run it. However, be very careful when using the numbers calculated by it to write to a disk sector. Always keep your backups up to date.

Comente!
Sex 22 Fev 2008
17h14min
permalink

Veículo

Depois de muito tempo me locomovendo a pé ou de ônibus pela cidade, finalmente adquiri um veículo:

Bicicleta

3 comentários
Seg 22 Jan 2007
18h57min
permalink

Panificando

É curioso, mas alguns dos posts mais visitados e comentados neste blog são os posts em que falo da máquina de pão que compramos há pouco mais de 1 ano. A maioria dos comentários é de gente perguntando onde encontrar mais receitas para a máquina.

O interesse gerado me fez criar uma lista de e-mail para usuários e simpatizantes da máquina. A lista começou devagar, ficou muitos meses com tão pouco movimento, que achei que a lista ia morrer, mas nos últimos dias a quantidade de membros começou a crescer bastante, e agora há movimento na lista praticamente todo dia. :)

Houve sugestões de catalogar as receitas que são trocadas no grupo. Para isso, eu e a Kátia criamos o blog maquinadepao.com, com receitas para máquina de pão. Além das receitas publicadas, há links para outros lugares onde é possível encontrar mais receitas e dicas.

Boa parte dos comentários nos meus posts era de gente que nem mesmo leu os outros posts, onde já havia ponteiros para a comunidade no Orkut e para o manual da máquina da Britania. A idéia é que as pessoas que antes encontravam os posts no meu blog e não sabiam onde encontrar receitas, agora encontrem o material no maquinadepao.com, junto com os ponteiros para os outros lugares onde é possível encontrar mais informação.

9 comentários
Ter 28 Nov 2006
14h47min
permalink

Playing with HDA Intel codecs

When debugging a problem with the snd-hda-intel module on a machine that has an unsupported codec model, I’ve spent some time studying the Intel HDA specification, and noticed that we can get very interesting information from the hardware. You can do many interesting things even if the driver never saw an specific model of the audio codec, because the HDA architecture allows you to ask lots of information and control many aspects of the codecs.

I’ve written a small script that generate a graphviz graph from the information on /proc/asound/card\*/codec#\*. I’ve generated the graph for a bunch of different machines that have HDA Intel. They are interesting to see if you want to know what the hardware you have can do, and to find out the correct NID and commands supposed to be used by the alsa drivers. Here they are:


A Realtek ALC660 on an Asus W5F notebook


A Realtek ALC861 codec, found somewhere on the web


A SigmaTel STAC9200 on a Dell Latitude 120L notebook


A Realtek ALC880 on a LG LW20 Express notebook


A SigmaTel STAC9200 on a Dell Latitude D-something notebook


A Realtek ALC86x on a HP DX2200 machine

The script is on a GIT repository. You can clone it with:
git clone http://git.raisama.net/hda-tools.git.

What I would really like to see in the end is the ability to change the way the nodes are associated to alsa streams and mixers from user-space. Then this could be configurable using a GUI where the user would change the input connection settings and associate nodes with mixers and streams, while seeing the graph. Then instead of waiting somebody to change the Alsa driver to do what you want regarding the mixer and streams, you could simply change the codec settings on a GUI and everybody would be happy. :)

3 comentários
Ter 21 Nov 2006
10h08min
permalink

Vendo modem ADSL

Estou vendendo o meu modem ADSL, já que mudei para o Virtua. Dê o seu lance.

1 comentário
Hosting service by Dreamhost