Created
May 12, 2016 13:17
-
-
Save agerwick/60bb891d0385168f5027c4efd9481888 to your computer and use it in GitHub Desktop.
creating encrypted lvm partitions
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
First, create an ext4 /boot partition (sda1), and an empty partition for encrypted LVM (sda2) | |
ubuntu-mate@ubuntu-mate:~$ sudo cryptsetup luksFormat /dev/sd | |
sda sda1 sda2 sdb sdb1 | |
ubuntu-mate@ubuntu-mate:~$ sudo cryptsetup luksFormat /dev/sda2 | |
WARNING! | |
======== | |
This will overwrite data on /dev/sda2 irrevocably. | |
Are you sure? (Type uppercase yes): YES | |
Enter passphrase: | |
Verify passphrase: | |
ubuntu-mate@ubuntu-mate:~$ sudo cryptsetup luksOpen /dev/sda2 crypto | |
Enter passphrase for /dev/sda2: | |
ubuntu-mate@ubuntu-mate:~$ sudo pvcreate /dev/mapper/crypto | |
Physical volume "/dev/mapper/crypto" successfully created | |
ubuntu-mate@ubuntu-mate:~$ sudo vgcreate vg0 /dev/mapper/crypto | |
Volume group "vg0" successfully created | |
ubuntu-mate@ubuntu-mate:~$ sudo lvcreate -n crypto-swap -L 1.5g vg0 | |
Logical volume "crypto-swap" created. | |
ubuntu-mate@ubuntu-mate:~$ sudo lvcreate -n crypto-root -L 10g vg0 | |
Logical volume "crypto-root" created. | |
ubuntu-mate@ubuntu-mate:~$ man lvcreate | |
ubuntu-mate@ubuntu-mate:~$ sudo lvcreate -n crypto-home 100%FREE vg0 | |
Volume group name 100%FREE has invalid characters | |
Run `lvcreate --help' for more information. | |
ubuntu-mate@ubuntu-mate:~$ sudo lvcreate -n crypto-home -l 100%FREE vg0 | |
Logical volume "crypto-home" created. | |
ubuntu-mate@ubuntu-mate:~$ sudo mkfs.ext4 /dev/mapper/ | |
control crypto vg0-crypto--home vg0-crypto--root vg0-crypto--swap | |
ubuntu-mate@ubuntu-mate:~$ sudo mkfs.ext4 /dev/mapper/vg0-crypto--home | |
mke2fs 1.42.13 (17-May-2015) | |
Creating filesystem with 16128000 4k blocks and 4038656 inodes | |
Filesystem UUID: 31c6ec98-10d1-4ac8-a916-83b992a92cce | |
Superblock backups stored on blocks: | |
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | |
4096000, 7962624, 11239424 | |
Allocating group tables: done | |
Writing inode tables: done | |
Creating journal (32768 blocks): done | |
Writing superblocks and filesystem accounting information: done | |
ubuntu-mate@ubuntu-mate:~$ sudo mkfs.ext4 /dev/mapper/vg0-crypto-- | |
vg0-crypto--home vg0-crypto--root vg0-crypto--swap | |
ubuntu-mate@ubuntu-mate:~$ sudo mkfs.ext4 /dev/mapper/vg0-crypto--root | |
mke2fs 1.42.13 (17-May-2015) | |
Creating filesystem with 2621440 4k blocks and 655360 inodes | |
Filesystem UUID: 0eb46af9-50be-4e35-882e-a998ed8d8eca | |
Superblock backups stored on blocks: | |
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 | |
Allocating group tables: done | |
Writing inode tables: done | |
Creating journal (32768 blocks): done | |
Writing superblocks and filesystem accounting information: done | |
ubuntu-mate@ubuntu-mate:~$ sudo mkswap /dev/mapper/ | |
control crypto vg0-crypto--home vg0-crypto--root vg0-crypto--swap | |
ubuntu-mate@ubuntu-mate:~$ sudo mkswap /dev/mapper/vg0-crypto--swap | |
Setting up swapspace version 1, size = 1.5 GiB (1610608640 bytes) | |
no label, UUID=51ea05de-84e5-4ca3-87f1-4ad10f9142f0 | |
ubuntu-mate@ubuntu-mate:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment