From a78075a4429b91aba7e1f1d6ccb1018fd8086605 Mon Sep 17 00:00:00 2001 From: zetigu <81594452+zetigu@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:18:49 -0400 Subject: [PATCH 01/87] Add instruction for using Btrfs as a qvm-pool I reformated the article to devide it in 2 section, one concerning LVM pools and the other Btrfs pool. The synthax should be close to the original. Awaiting comments. --- .../secondary-storage.md | 79 ++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/user/advanced-configuration/secondary-storage.md b/user/advanced-configuration/secondary-storage.md index 90faca71..8de061cd 100644 --- a/user/advanced-configuration/secondary-storage.md +++ b/user/advanced-configuration/secondary-storage.md @@ -20,6 +20,24 @@ You want to store a subset of your AppVMs on the HDD. Qubes 4.0 is more flexible than earlier versions about placing different VMs on different disks. For example, you can keep templates on one disk and AppVMs on another, without messy symlinks. +You can query qvm-pool to list available storage drivers. + +``` +qvm-pool --help-drivers +``` +qvm-pool driver explaination : +``` + refers to using a simple file for image storage and lacks a few features. + refers to storing images on a filesystem supporting copy on write. + refers to a directory holding kernel images. + refers to LVM managed pools. +``` +In theory, you can still use file-based disk images ("file" pool driver), but it lacks some features such as you won't be able to do backups without shutting down the qube. + +Additionnal storage can also be added on a Btrfs filesystem. A unique feature of Btrfs over LVM is that data can be compressed transparently. The subvolume can also be backuped using snapshots for an other layer protection and Btrfs supports different level of redundancy and is able to be expanded/shrinked easily. Revelant information will be provided after LVM section. + +### LVM storage + These steps assume you have already created a separate [volume group](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/vg_admin#VG_create) and [thin pool](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/thinly_provisioned_volume_creation) (not thin volume) for your HDD. See also [this example](https://www.linux.com/blog/how-full-encrypt-your-linux-system-lvm-luks) if you would like to create an encrypted LVM pool (but note you can use a single logical volume if preferred, and to use the `-T` option on `lvcreate` to specify it is thin). You can find the commands for this example applied to Qubes at the bottom of this R4.0 section. @@ -39,6 +57,24 @@ Take note of the VG and thin pool names for your HDD, then register it with Qube qvm-pool --add lvm_thin -o volume_group=,thin_pool=,revisions_to_keep=2 ``` +### BTRFS storage +Theses steps assume you have already created a separate Btrfs filesystem for your HDD, that it is encrypted with LUKS and it is mounted. It is recommended to use a subvolume as it enables compression and excess storage can be use for other things. + + +It is possible to use already available Btrfs storage if it is configured. In dom0, available Btrfs storage can be displayed using : +``` +mount -t btrfs +``` +To register the storage to qubes : + +```shell_session +# is a freely chosen pool name +# is the mounted path to the second btrfs storage +qvm-pool --add file-reflink -o dir_path=,revisions_to_keep=2 +``` + +#### Using the new pool + Now, you can create qubes in that pool: ``` @@ -59,9 +95,7 @@ For example: qvm-prefs template ``` -In theory, you can still use file-based disk images ("file" pool driver), but it lacks some features such as you won't be able to do backups without shutting down the qube. - -### Example HDD setup +#### Example HDD setup Assuming the secondary hard disk is at /dev/sdb (it will be completely erased), you can set it up for encryption by doing in a dom0 terminal (use the same passphrase as the main Qubes disk to avoid a second password prompt at boot): @@ -84,6 +118,8 @@ luks-b20975aa-8318-433d-8508-6c23982c6cde UUID=b20975aa-8318-433d-8508-6c23982c6 Reboot the computer so the new luks device appears at /dev/mapper/luks-b209... and we can then create its pool, by doing this on a dom0 terminal (substitute the b209... UUIDs with yours): +##### For LVM + First create the physical volume ``` @@ -107,6 +143,40 @@ Finally we will tell Qubes to add a new pool on the just created thin pool ``` qvm-pool --add poolhd0_qubes lvm_thin -o volume_group=qubes,thin_pool=poolhd0,revisions_to_keep=2 ``` +#### For Btrfs + +First create the physical volume + +``` +#