[linux-l] LVM und Verschlüsselung

Olaf Radicke olaf_rad at gmx.de
Do Jan 3 21:49:01 CET 2008


Am Donnerstag 03 Januar 2008 15:49:00 schrieb Steffen Schulz:
> On 080103 at 14:58, Olaf Radicke wrote:
[... ]
> > elegantesten. Die Kombination LVM & cryt ist nicht so oft dokumentiert.
> > hda5 hat der Debian-Installer für mich gemacht. Da brauchte ich mich
> > nicht kümmern.
>
> Wenn die Daten darauf egal(oder bereits gesichert) sind:
>
> cryptsetup luksFormat /dev/mapper/Debian-HDC

...geht

> cryptsetup luksOpen /dev/mapper/Debian-HDC /dev/mapper/hdc_crypt

...geht nicht...

localhost:/home/or# cryptsetup 
luksOpen /dev/mapper/Debian-HDC /dev/mapper/hdc_crypt

Command failed: Device already exists

localhost:/home/or# ls /dev/mapper/
control  Debian-HDC  Debian-root  Debian-swap_1  hda5_crypt  hdc_crypt

...Okay...

localhost:/home/or# rm /dev/mapper/hdc_crypt /dev/mapper/Debian-HDC

localhost:/home/or# cryptsetup 
luksOpen /dev/mapper/Debian-HDC /dev/mapper/hdc_crypt
Speicherzugriffsfehler

..Okay also auch nicht. Noch mal von Vorne...

cryptsetup luksFormat /dev/mapper/Debian-HDC

> Jetzt ist Debian-HDC ein Luks-Container, der mit cryptsetup durch
> Passwort oder Key-file geoeffnet werden kann und dann das Device
> Debian-HDC-crypt bereit stellt. Das kannst du so auch in die
> /etc/crypttab eintragen:
>
> hda5_crypt /dev/hda5 none luks
> hdc_crypt  /dev/mapper/Debian-HDC none luks

Nach dem Booten bleibt er nach der Passwort-Abfrage im init 1 
stecken und vorder mich auf, das FS zu reparieren.  Gut...
mksf.ext3 /dev/mapper/Debian-HDC

In der /etc/crypttab steht jetzt...

hda5_crypt /dev/hda5 none luks
hdc_crypt  /dev/mapper/Debian-HDC none luks

Und in der /etc/fstab steht jetzt...

/dev/Debian/root                /               ext3    defaults        1 2
/dev/hda1       /boot           ext3    defaults        0       2
/dev/mapper/hdc_crypt           /media/HDC/     ext3    defaults        1 2

df -h sieht normal aus...

/dev/mapper/Debian-root 18G  9,3G  7,6G  56% /
/dev/hda1                          236M   34M  190M  16% /boot
/dev/mapper/hdc_crypt     230G  188M  218G   1% /media/HDC

...Na, ob das jetzt alles so richtig ist? Offenbar ist jetzt hdc zu einem 
Fremdkörper im LVM geworden. Für LVM ist hdc eine nicht formatierte Partition 
(bzw. LV) die vom System in Benutzung ist, auf das es keinen Zugriff hat. 
Dann mach Debian das also ringend wie anders.




Gruß

Olaf












Mehr Informationen über die Mailingliste linux-l