Sunday, June 14, 2009

device-mapper ate my linux installation

Just a quick note about the harm that you can suffer, should you try to install the “dmraid” package in your linux distribution: It’s EVIL! The problem is that for me it installed the dmraid signature in my harddisks last sector, so that Ubuntu’s initrd would automatically create useless mappings from…

  • /dev/sda –> /dev/mapper/NVIDIAxyzqwert
  • /dev/sda1 –> /dev/mapper/NVIDIAxyzqwer_1
  • /dev/sda2 –> /dev/mapper/NVIDIAxyzqwer_2
  • …and so on…

Everything completely pointless, and wrecking my distribution’s ability to boot. I usually run my self compiled kernels which exclude the device-mapper for this exact reason, but it’s not possible on my other PC for one reason or the other. And the final and correct cure is to boot with the greatest bootable live-system there is: GRML, and overwrite the harddisk’s last sector (which holds the signature) with zeroes:

# dmsetup remove_all # get rid of the mappings
# cat /proc/partitions

8 0 12345678 sda # your harddisk

# sdd bs=512 –inull of=/dev/sda oseek=12345677k count=1 # overwrite last block

Reboot and enjoy. Use this recipe at your own risk!

No comments: