Search:  
Gentoo Wiki

Convert_your_raid0_volume_to_luks

Setup

mkdir /mnt/gentoo
mount /dev/md0 /mnt/gentoo
cp /mnt/gentoo/sbin/cryptsetup /sbin/
apt-get install nfs-??? #check the name of the nfs package
mkdir /mnt/NFS/
mount nfs_server:/mnt/share /mnt/NFS
mkdir /mnt/gentoo/NFS
mount --bind /mnt/NFS/ /mnt/gentoo/NFS

edit the file exclude.txt in /mnt/NFS/ and add the followign line:

/NFS/*

then chroot into the gentoo installation:

chroot /mnt/gentoo /bin/bash
tar cvf /mnt/NFS/backup.tar / -X /NFS/exclude.txt 
umount /mnt/gentoo/NFS
umount /mnt/gentoo
modprobe dm-crypt
modprobe dm-mod
modprobe aes-generic
cryptsetup -y --cipher aes-cbc-essiv:sha256 --key-size 256 luksFormat /dev/md0
cryptsetup luksOpen /dev/md0 root
mount /dev/mapper/root /mnt/gentoo
cd /mnt/gentoo
tar xvpf /mnt/NFS/backup.tar -C /mnt/gentoo/
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot
nano /mnt/boot/grub/menu.lst
title Genkernel
root (hd0,1)
kernel /kernel-genkernel-x86-2.6.25.6_my_computer root=/dev/ram0 init=/linuxrc ramdisk=8192 crypt_root=/dev/md0 real_root=/dev/mapper/root udev
initrd /initramfs-genkernel-x86-2.6.25.6_my_computer
rlpkg -r -a

now we need to encrypt the swap: do a dd if=/dev/urandom of=/swap/device in order to clear the previous data on the swap...because it could contain important data add this to /etc/conf.d/dmcrypt

swap=crypt-swap1
source='/dev/sda1'
options='-c aes -h sha256 -d /dev/urandom'

and add this to /etc/fstab:

/dev/mapper/crypt-swap1              none            swap            sw,pri=1              0 0

the result is that we encrypt the swap with a random key each boot

Livecd

then we need to generate a livecd with:

because it's a read-only media...a good idea is to buy buisness-card size cd-r and don't forget to write something on it so you can differenciate it from a fake one...

Quick fake GNU/linux installation

As you need a /boot on a partition and that you have 2 hdd, you could have another free partition on the other hdd(because the raid partition must be the same size...and that we created 2 swap partition of the same size we have 2 partitions left: a /boot partition and an unused partition) so we could use this partition to install a lightweight GNU/Linux such as puppy-linux(there is a version with the 2.6.25 kernel)...you'll need about 128MB of free space minimum... For instance you could use it:

Retrieved from "http://www.gentoo-wiki.info/Convert_your_raid0_volume_to_luks"

Last modified: Mon, 04 Aug 2008 09:08:00 +0000 Hits: 1,257