Forked from edouard-lopez/00.reinstalling-LVM+LUKS-on-Ubuntu.md
Last active
August 29, 2015 14:22
-
-
Save aussielunix/9ac980e756e863dca229 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo cryptsetup luksOpen /dev/sda5 luks_container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo lvdisplay | |
--- Logical volume --- | |
LV Path /dev/mint-vg/root | |
LV Name root | |
VG Name mint-vg | |
LV UUID ZXld2t-7wOU-Vw5p-4h4Q-w8is-yhCf-z7hLX2 | |
LV Write Access read/write | |
LV Creation host, time mint, 2014-05-22 00:01:06 +0000 | |
LV Status available | |
# open 0 | |
LV Size 8.55 GiB | |
Current LE 2188 | |
Segments 3 | |
Allocation inherit | |
Read ahead sectors auto | |
- currently set to 256 | |
Block device 252:1 | |
--- Logical volume --- | |
LV Path /dev/mint-vg/home | |
LV Name home | |
VG Name mint-vg | |
LV UUID 89jWuf-uKik-4JDF-BJUp-GbyM-UPje-WyotAG | |
LV Write Access read/write | |
LV Creation host, time mint, 2014-05-22 00:53:52 +0000 | |
LV Status available | |
# open 0 | |
LV Size 2.00 GiB | |
Current LE 512 | |
Segments 1 | |
Allocation inherit | |
Read ahead sectors auto | |
- currently set to 256 | |
Block device 252:2 | |
--- Logical volume --- | |
LV Path /dev/mint-vg/data | |
LV Name data | |
VG Name mint-vg | |
LV UUID 1P2oWP-WEmN-2tKD-wkfh-GAlC-iCWv-XPTL3b | |
LV Write Access read/write | |
LV Creation host, time mint, 2014-05-22 00:55:13 +0000 | |
LV Status available | |
# open 0 | |
LV Size 100.00 GiB | |
Current LE 25600 | |
Segments 1 | |
Allocation inherit | |
Read ahead sectors auto | |
- currently set to 256 | |
Block device 252:3 | |
--- Logical volume --- | |
LV Path /dev/mint-vg/swap | |
LV Name swap | |
VG Name mint-vg | |
LV UUID HfQVJv-giT3-81W1-JJdY-kM4l-19uI-DVAlIX | |
LV Write Access read/write | |
LV Creation host, time mint, 2014-05-31 19:47:33 +0000 | |
LV Status available | |
# open 0 | |
LV Size 1.00 GiB | |
Current LE 256 | |
Segments 1 | |
Allocation inherit | |
Read ahead sectors auto | |
- currently set to 256 | |
Block device 252:4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo blkid /dev/sda5 | |
# /dev/sda5: UUID="db83deac-8302-47f0-804b-fb2b95f2b8fc" TYPE="crypto_LUKS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.webupd8.org/2014/01/how-to-fix-non-bootable-ubuntu-system.html | |
sudo mkdir /mnt/ | |
sudo mount /dev/mint-vg/root /mnt | |
# # # following command is CRITICAL! Otherwise you won't edit the correct config file | |
sudo mount /dev/sda1 /mnt/boot | |
# ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ | |
sudo mount /dev/mint-vg/home /mnt/home | |
for p in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$p" "/mnt$p"; done | |
sudo cp /etc/resolv.conf /mnt/etc/ | |
sudo chroot /mnt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create: nano /etc/crypttab | |
# <target name> <source device> <key file> <options> | |
luks_container UUID=db83deac-8302-47f0-804b-fb2b95f2b8fc none luks,retry=1,lvm=mint-vg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create: nano /etc/initramfs-tools/conf.d/cryptroot | |
#CRYPTROOT=target=luks_container,source=/dev/disk/by-uuid/db83deac-8302-47f0-804b-fb2b95f2b8fc | |
CRYPTROOT=target=luks_container,source=/dev/disk/by-uuid/db83deac-8302-47f0-804b-fb2b95f2b8fc,lvm=mint-vg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see http://ubuntuforums.org/showthread.php?t=2222993 | |
# in /etc/initramfs-tools/modules add f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update-initramfs -k all -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set GRUB_CMDLINE_LINUX in : nano /etc/default/grub | |
GRUB_CMDLINE_LINUX="cryptopts=target=luks_system,source=/dev/disk/by-uuid/db83deac-8302-47f0-804b-fb2b95f2b8fc,lvm=mint-vg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update-grub | |
# if you got the following error, try: | |
# /usr/sbin/grub-mkconfig: 250: /usr/sbin/grub-mkconfig: cannot create /boot/grub/grub.cfg.new: Directory nonexistent | |
grub-install /dev/sda; update-grub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you got trouble with grub try re-creating the grub.cfg file, | |
# see http://edoceo.com/notabene/grub-probe-error-cannot-find-device-for-root | |
sh -x /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment