diff --git a/web/support/kb/general/createLUKSEncryptedVolume.rst b/web/support/kb/general/createLUKSEncryptedVolume.rst index 656e3f44ca24cf1e52959a0f1f2df3575654f1ca..a4b4cc0e1591d8ea82e3b3fd907e2aa3d29e6814 100644 --- a/web/support/kb/general/createLUKSEncryptedVolume.rst +++ b/web/support/kb/general/createLUKSEncryptedVolume.rst @@ -14,8 +14,8 @@ We assume that you have already a VM up and running. Then: * **list the current disks**. From the VM's command line issue the following command:: - # fdisk -l | grep 'Disk /dev' - + fdisk -l | grep 'Disk /dev' + and note down the Disk names (e.g. ``/dev/vda``). * **create a new volume**. From https://dashboard.cloud.garr.it, click on "Volumes" and then on "Create Volume", choose a name and a size and click on "Create Volume". @@ -30,30 +30,30 @@ We assume that you have already a VM up and running. Then: * **list the current disks**. From the VM's command line issue again the following command:: - # fdisk -l | grep 'Disk /dev' + fdisk -l | grep 'Disk /dev' You should find a new disk. This is usually ``/dev/vdb`` but we will refer to it as ``/dev/vdX`` hereafter. * **create a new partition on the new disk**. These commands will create the partition ``/dev/vdX1``:: - # parted -a optimal -- /dev/vdX mklabel gpt - # parted -a optimal -- /dev/vdX mkpart primary ext4 1MiB -2048s + parted -a optimal -- /dev/vdX mklabel gpt + parted -a optimal -- /dev/vdX mkpart primary ext4 1MiB -2048s Check that the mew partition ``/dev/vdX1`` exists with:: - # fdisk -l | grep '/dev/vdX1' + fdisk -l | grep '/dev/vdX1' This should output a line with the partition name and size. * **setup LVM**:: - # pvcreate /dev/vdX1 - # vgcreate encvg /dev/vdX1 - # lvcreate -l100%FREE -n encvol encvg + pvcreate /dev/vdX1 + vgcreate encvg /dev/vdX1 + lvcreate -l100%FREE -n encvol encvg * **setup the encrypted partition**. Issue the command and follow the instructions on the screen:: - # cryptsetup -v -s 512 luksFormat /dev/encvg/encvol + cryptsetup -v -s 512 luksFormat /dev/encvg/encvol WARNING! ======== @@ -68,17 +68,17 @@ We assume that you have already a VM up and running. Then: * **open the encrypted partition, create a filesystem and mount it**:: - # cryptsetup open --type luks /dev/encvg/encvol ev - # mkfs.ext4 /dev/mapper/ev - # mkdir /mnt/encrypted - # mount /dev/mapper/ev /mnt/encrypted - # df -h - # echo "this will be automatically encrypted" > /mnt/encrypted/test.txt + cryptsetup open --type luks /dev/encvg/encvol ev + mkfs.ext4 /dev/mapper/ev + mkdir /mnt/encrypted + mount /dev/mapper/ev /mnt/encrypted + df -h + echo "this will be automatically encrypted" > /mnt/encrypted/test.txt * **the operations to perform at each VM's boot** will be:: - # cryptsetup open --type luks /dev/encvg/encvol ev - # mount /dev/mapper/ev /mnt/encrypted + cryptsetup open --type luks /dev/encvg/encvol ev + mount /dev/mapper/ev /mnt/encrypted Resize @@ -88,8 +88,8 @@ If later you need more space on your encrypted volume, you can perform the follo * **unmount the encrypted partition and close it**:: - # umount /mnt/encrypted - # cryptsetup close ev + umount /mnt/encrypted + cryptsetup close ev * **detach the volume from the VM**. From https://dashboard.cloud.garr.it, click on "Volumes", then in the volume's dropdown menu choose "Manage Attachments", click on "Detach Volume" and confirm @@ -116,18 +116,18 @@ If later you need more space on your encrypted volume, you can perform the follo * **Extend the partition**:: - # parted -a optimal --script -- /dev/vdX resizepart 1 -2048s - # pvresize /dev/vdX1 - # lvextend -l +100%FREE /dev/encvg/encvol - # cryptsetup open --type luks /dev/encvg/encvol ev - # cryptsetup resize ev - # e2fsck -f /dev/mapper/ev - # resize2fs /dev/mapper/ev + parted -a optimal --script -- /dev/vdX resizepart 1 -2048s + pvresize /dev/vdX1 + lvextend -l +100%FREE /dev/encvg/encvol + cryptsetup open --type luks /dev/encvg/encvol ev + cryptsetup resize ev + e2fsck -f /dev/mapper/ev + resize2fs /dev/mapper/ev * **Mount and check the available space**:: - # mount /dev/mapper/ev /mnt/encrypted - # df -h + mount /dev/mapper/ev /mnt/encrypted + df -h