Advertisement
Guest User

Untitled

a guest
Apr 16th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. sudo apt-get install cryptsetup lvm2
  2.  
  3.  
  4.  
  5. # insert kernel modules that we will need
  6.  
  7. sudo modprobe dm-crypt
  8.  
  9. sudo modprobe dm-mod
  10.  
  11.  
  12.  
  13. # unlock the sda2 partition and call it MYTAG
  14.  
  15. sudo cryptsetup luksOpen /dev/sda2 MYTAG
  16.  
  17. Enter LUKS passphrase:
  18.  
  19. key slot 0 unlocked.
  20.  
  21. Command successful.
  22.  
  23.  
  24.  
  25. # now that we have unlocked the encryption, deal with the lvm
  26.  
  27.  
  28.  
  29. sudo vgscan # scan for all volume groups
  30.  
  31. Reading all physical volumes. This may take a while...
  32.  
  33. Found volume group "vg1" using metadata type lvm2
  34.  
  35.  
  36.  
  37. # make the vg1 volume group active; if you don't give it a volume group as
  38.  
  39. # an argument it'll make them all active
  40.  
  41. sudo vgchange -ay [vg1]
  42.  
  43.  
  44.  
  45. sudo lvscan # list logical volumes and their /dev path
  46.  
  47. ACTIVE '/dev/vg1/lvswap' [2.00 GB] inherit
  48.  
  49. ACTIVE '/dev/vg1/lvroot' [10.00 GB] inherit
  50.  
  51. ACTIVE '/dev/vg1/lvdata' [60.00 GB] inherit
  52.  
  53.  
  54.  
  55. # mount a logical volume; don't do this if you need to run fsck on it
  56.  
  57. sudo mkdir /media/root
  58.  
  59. sudo mount /dev/vg1/lvroot /media/root
  60.  
  61.  
  62.  
  63. # to reverse the process and unmount everything, do the following
  64.  
  65.  
  66.  
  67. sudo umount /media/root
  68.  
  69.  
  70.  
  71. # the following command will issue a somewhat confusing message
  72.  
  73. sudo vgchange -an [vg1]
  74.  
  75. 0 logical volume(s) in volume group "vg1" now active
  76.  
  77.  
  78.  
  79. sudo cryptsetup luksClose MYTAG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement