On 12/12/2017 10:39 AM, 'Tom Zander' via qubes-users wrote:
> On Tuesday, 12 December 2017 16:18:25 CET Connor Page wrote:
>> so in short, first create a qubes storage pool
>> qvm-pool --add <poolname> <driver> <options>
> In the spirit of a “howto”, can you fill in the actual values to allow one to
> add a second drive as the ‘private’ (home) partition *only* of a Qube?
>
>> if you go for a thin pool, create it first and use volume group and thin
>> pool names as options for qvm-pool.
> As the storage pools doc is missing readability, I have to say I have no
> clue what a “thin pool” is.
> What a “volume group” is.
Adding LVM objects can get convoluted. A thin pool is like a collection
of disk partitions that can easily grow and shrink as data is
added/removed; its a bit like a filesystem. The (supposed) advantage
over using an actual filesystem to hold disk images is speed; for
complex volume setups typical on servers, its also more flexible.
Overview and howto for LVM:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/lvm_definition
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/lv_overview#thinprovisioned_volumes
But if you use the file driver instead of LVM you won't need the above
and setup will be simplified (see last).
>
> Last, how does one create a btrfs filesystem on their “home” drive when using
> this pool concept?
If you want btrfs for the private volume, you can probably just
'qvm-block attach' the volume (see output of 'qvm-volume') to a
different, trusted appVM and do 'mkfs.btrfs /dev/xvdi'. Then detach it.
When you start the target VM it should auto populate the new fs with a
/home dir, etc. Alternately you could try btrfs-convert on it.
Keep in mind that Btrfs is like a simple-to-use LVM system itself, so
using it on top of LVM or another filesystem can be slow. The other way
around, normal VM fs/disk images on Btrfs is what I successfully used
for over a year on 3.2 until I upgraded; it was flexible but demanded
more CPU cycles and metadata use could get tricky.
>
>> P.S. I’m not sure lvm backend operates properly. File-based backend can
>> also be used instead. Just mount the secondary drive in dom0 and use the
>> old trusty file driver if worried.
> Using a file is going to cause lots of fragmentation and adds an unneeded
> layer that will just be able to introduce issues.
> What is the benefit of using pools?
>
> Doing a backup of a 1TB homedir can be done without the backup tool too ;)
An easier option is to use the file driver/backend as Connor suggests,
even if it may be a little slower. Then preparation is reduced to
encryption + formatting. Assuming your extra drive is /dev/sdb with one
partition...
$ sudo cryptsetup luksFormat /dev/sdb1
$ sudo cryptsetup luksOpen /dev/sdb1 newdisk-luks
$ sudo mkfs.ext4 /dev/mapper/newdisk-luks
$ sudo mkdir /mnt/newdisk
$ sudo mount /dev/mapper/newdisk-luks /mnt/newdisk
$ sudo chown root:qubes /mnt/newdisk
$ qvm-pool -a newpool file -o 1,/mnt/newdisk
Create a vm using newpool:
$ qvm-create -p VOLUME_NAME=newpool -t debian-9 newvmname
Getting this volume back online after reboot:
$ sudo cryptsetup luksOpen /dev/sdb1 newdisk-luks
$ sudo mount /dev/mapper/newdisk-luks /mnt/newdisk
To have it come online automatically, add entries in /etc/crypttab and
/etc/fstab respectively.