Skip to contentSkip to conversation

How to manipulate an encrypted partition in a switched_root environment.

dm-crypt Tamateas Kostas 2 participants 2 messages Jun 5, 2012

lore
Share & tools
lore
#0 lore raw

Hello evertybody. I am using cryptsetup to work with encryption. Everything is ok and working nice. However I have an issue and I don't know how to solve it. Well, the kernel is loaded, same for the ramdisk. In the ramdisk I use *cryptsetup luksOpen blabla*.. and then I use *mount /dev/mapper/enc /media/root*. Then I switch_root to /media/root. Everything works normally.

Inside the switched_root system, I do e2fsck or dumpe2fs on /dev/sda2, where sda2 is that encrypted partitionand it returns: bad superblock and stuff like this.In the ramdisk I had the /dev/mapper/enc device, but in switched_root system I don't have it. I only have /dev/mapper/control.

So can anyone tell me how I can manipulate my sda2 device in the switched_root environment ?

Thanks, Kostas.

#1 lore raw
Quoted 6 lines

Inside the switched_root system, I do e2fsck or dumpe2fs on /dev/sda2, where sda2 is that encrypted partitionand it returns: bad superblock and stuff like this.In the ramdisk I had the /dev/mapper/enc device, but in switched_root system I don't have it. I only have /dev/mapper/control.

Since sda2 is encrypted e2fsck cant find superblock and fs data. You must pass e2fsck to the fs unlocked.

Look for which device is mounted as rootfs and do e2fsck to this one.