Difference between revisions of "LVM"

From Blue-IT.org Wiki

(Mount existing volume groups)
(Open encryted lvm partition)
Line 6: Line 6:
  
 
== Open encryted lvm partition ==  
 
== Open encryted lvm partition ==  
Be careful: if this is the root device, you will need to use EXACTLY the same name for the crpyt (here: sda5_crypt) like in your Ubuntu enviroment. If not, you will not be able to boot your device, because the system will be configured using the wrong name for your mapper:
 
  
  cryptsetup luksOpen /dev/sda5 sda5_crypt
+
Be arefulat this step!
 +
 
 +
If this is the root device, you will need to USE EXACTLY THE SAME NAME FOR THE CRYPT (here: "sda5_crypt") like in your Ubuntu environment.
 +
 
 +
If not, you will not be able to boot your device, because the system will be configured using the wrong name for your mapper
 +
 
 +
  cryptsetup luksOpen /dev/sda5 '''sda5_crypt'''
 +
 
 +
If you are unsure, uncrypt your device, mount it an look into the /etc/crypttab for the name like this:
 +
 
 +
cryptsetup luksOpen /dev/sda5 test_crypt
 +
mount /dev/mapper/vg-somename-root /mnt/test
 +
'''nano /mnt/test/etc/crypttab'''
 +
umount /mnt/test
 +
crpytsetup luksClose test_crypt
  
 
== Mount existing volume groups ==
 
== Mount existing volume groups ==

Revision as of 07:33, 18 September 2015

Install necessary apps

E.g. on a rescue disc ...

apt-get install cryptsetup

Open encryted lvm partition

Be arefulat this step!

If this is the root device, you will need to USE EXACTLY THE SAME NAME FOR THE CRYPT (here: "sda5_crypt") like in your Ubuntu environment.

If not, you will not be able to boot your device, because the system will be configured using the wrong name for your mapper

cryptsetup luksOpen /dev/sda5 sda5_crypt

If you are unsure, uncrypt your device, mount it an look into the /etc/crypttab for the name like this:

cryptsetup luksOpen /dev/sda5 test_crypt
mount /dev/mapper/vg-somename-root /mnt/test
nano /mnt/test/etc/crypttab
umount /mnt/test
crpytsetup luksClose test_crypt

Mount existing volume groups

sudo apt-get install lvm2
sudo modprobe dm-mod
sudo vgchange -a y
> 2 logical volume(s) in volume group "vg-whatever" now active
ls /dev/mapper
> control vg--whatever--root  vg--whatever--swap
# Please edit
my_root=/mnt/whatever_root
my_vg=vg--whatever--root


mkdir ${my_root}
mount /dev/mapper/${my_vg} ${my_root}
mount /dev/sdax ${my_root}/boot
mount -o bind /dev ${my_root}/dev; \
mount -o bind /run ${my_root}/run; \
mount -t proc /proc ${my_root}/proc; \
mount -t sysfs /sys ${my_root}/sys
chroot ${my_root}

Umount existing volume groups and close encrypted container

sudo umount ${my_root}/*
sudo umount /dev/mapper/whatever
sudo vgchange -a n
sudo cryptsetup luksClose my-crypt