Search raisama.net:

Eduardo Habkost raisama.net

diary / In English

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!
Dom 19 Out 2008
23h08min
permalink

As merdas que a gente escreve

English readers: skip to the paragraph in engrish below. It’s the fun part. 8)

Ontem eu estava organizando o monte de tranqueira que tenho guardada nos armários. E achei o texto do meu “projeto final” do curso técnico de processamento de dados que fiz na ET-UFPR, durante o ensino médio.

O projeto final do curso da ET-UFPR era uma maneira dos alunos fazerem de conta que aprenderam a programar e a planejar um sistema de informação, e da escola manter os alunos (bastante) ocupados durante o último ano do curso. Não importa que você aprendeu a programar, que o programa que foi feito não funciona (e se compõe principalmente de telinhas bonitinhas feitas arrastando componentes no Delphi), nem que você não sabe pra que diabos vai usar a maior parte dos diagramas que botou na “monografia” do seu projeto final. O mais importante é que você teve muito trabalho para fazer o projeto.

(A maior prova de que o projeto era um grande faz-de-conta é o nome que encontrei na página da dedicatória. Sério: onde a minha equipe (incluindo eu) estava com a cabeça quando dedicou o trabalho ao MJB[1]?)

O trabalho tinha um “resumo”, em português, e um “abstract”, em inglês (não lembro se isso foi idéia da nossa equipe ou de algum professor fã de protocolos acadêmicos). O texto em inglês foi a coisa mais hilária que li recentemente. A equipe que fez o trabalho era composta de quatro pessoas, e eu não lembro quem foi que traduziu o texto para o inglês. Mas tenho certeza que todos os quatro revisaram a coisa e acharam que estava bom.

Para sua diversão, aqui estão as duas versões do texto, exatamente do jeito que encontrei. Em minha defesa, eu só posso dizer: eu tinha 16 anos na época.

Em português:

Resumo

Um zoológico é um local que disponibiliza aos visitantes a
oportunidade de conhecer animais de várias partes do mundo,
proporcionando simultaneamente lazer e conhecimento. Para que este
objetivo seja alcançado, é necessário um trabalho de bastidores que
envolve material humano (técnicos-administrativos com as mais diversas
funções), controle da dieta e da saúde dos animais e orientação aos
visitantes. Diante do grande volume de dados e informações necessárias
para este controle, que deve ser feito de forma rápida e eficiente, os
recursos da informática tornam-se ferramentas muito úteis. Assim,
estamos desenvolvendo um aplicativo que tem como objetivo auxiliar os
técnicos veterinários no gerenciamento de algumas informações
relativas aos animais que ali estão alojados, como: alimentação,
ocorrências veterinárias e alojamentos; e além disso, proporcionar aos
visitantes, através de recursos audiovisuais (multimídia), uma forma
interativa de obter informações gerais sobre os animais: localização
no zoológico, origem, alimentação, peculiaridades, etc., bem como sua
própria situação na área do parque. Estamos utilizando como
ferramentas para o desenvolvimento do sistema a metodologia de análise
orientada a objeto, UML, descrita por FURLAN (1998) e a linguagem de
programação Borland Delphi, versão 4.0, utilizando SQL Server para o
gerenciamento do banco de dados. O aplicativo será disponibilizado
para utilização em rede, sob o sistema operacional Windows 95 ou
superior. A implantação do sistema possibilitará uma redução no volume
de papéis e no esforço necessário para o controle dos animais, melhor
orientação e maior comodidade aos visitantes e também uma melhora
significativa no processo de gestão do zoológico.

——

Em inglês:

(English readers: the piece of engrish below is an excerpt (typed exactly as-is) from the documentation of a “project” my team produced at a technical course during high school. It’s pure fun, so I am sharing it. In my own defense, all I can say is: I was only 16.)

Abstract

A zoo is a place that gives to the visitor the opportunity to know animals of
anywhere in the world, offer simultaneously leisure and knowing. To this

purpose be reached, is necessary a lot of work of the tambours, that include
human material (manage technician with several functions), the control of the
alimentation and the healthy of the animals and orientation to the visitors.
Because of the large volume of information necessary to this control, that has
to be done fast and efficaciously, the resourses of technology became
tools so useful. So, we are developing a system that has a purpose an
auxiliary to veterinary technician in the management of some information
relatives to the animals that are accommodated, how: alimentation,
veterinary occurrence and accommodation; and beyond, offer to the visitants
through multimedia, an interactive form to get general information about the
animals: localization in the zoo, origin, alimentation, peculiarities, etc.,
his own situation in the area of the park. We are using UML, described by
FURLAN (1998) as object-oriented analysis method. The programming language
used was Borland Delphi, version 4.0, with SQL Server to the management of the
Data Base. The system will be available to use in network, under the operation
system Windows 95 or updated. The implantation of the system will allow a
decrease of paper volume and work necessary to animals control, a better
orientation and a bigger confort for the visitors and a signification
improve in the management of the zoo.

——

[1] O professor orientador durante o projeto. Vou me abster de comentar sobre o que acho dele.

6 comentários
Qui 02 Out 2008
14h20min
permalink

Meme

Meme

From Rich Sharples:

  1. Take a picture of yourself right now.
  2. Don’t change your clothes, don’t fix your hair…just take a picture.
  3. Post that picture with NO editing.
  4. Post these instructions with your picture.


Via Rich Sharples:

  1. Tire uma fotos sua nesse exato momento.
  2. NÃO troque de roupa, NÃO arrume seu cabelo. Simplesmente tire uma foto.
  3. Poste essa foto, SEM editá-la.
  4. Poste estas instruções junto com a foto.
Comente!
Qui 27 Mar 2008
14h33min
permalink

4a7d3d609129a9296bf7ac0608c2097

Can somebody explain to me where this hex string comes from?

It has lots of matches on Google. Most of them are on blog comments. But they appear on valid comments, so I don’t think it is some marker string being used by spam bots.

2 comentários
Ter 09 Out 2007
12h50min
permalink

Getting a mailing-list archive URL from a Message-ID

It happens often to me: I am reading a mailing list on mutt and I want to send a pointer to the message to somebody.

I always wanted to be able to press a key on mutt, and a script would query mailing list archives and find a URL for the message on a mailing list archive. Today I have found this to be possible. Gmane has a “Message-Id” URL format tha allows you to do it. Just point to http://mid.gmane.org/<message-id> and it will redirect to the message on the archives, if it is present.

Now, getting a URL for a mailing list message is as simple as piping the message from mutt to this small script:

#!/bin/bash
mid="$(grep -m 1 -i ^Message-ID: | cut -d: -f2 | sed -e 's/^ *//')"
kfmclient openURL 'http://mid.gmane.org/'"$mid"

And this can be bound this to a keystroke under mutt by simply using something like this on .muttrc:

macro pager U "
msg2url\n"

There are other mailing list archives with similar features. But they are more specific to some mailing lists, so they are not as comprehensive as Gmane. Some examples:

  • http://kerneltrap.org/mailarchive/message-id/<message-id> (for KernelTrap mailing list archives)
  • http://www.red-bean.com/threadfind (mostly Subversion-related mailing lists)
Comente!
Hosting service by Dreamhost