Resize dom0

329 views
Skip to first unread message

Zbigniew Łukasiak

unread,
Feb 18, 2017, 5:23:32 AM2/18/17
to qubes-users
There are instructions how to resize a VM at
https://www.qubes-os.org/doc/resize-root-disk-image/ - but this cannot
apply to dom0 - because it requires stopping the VM and then running
commands in dom0. What would be the procedure for resizing dom0 root
partition?

--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

tezeb

unread,
Feb 18, 2017, 7:45:45 AM2/18/17
to Zbigniew Łukasiak, qubes-users
On 02/18/17 11:23, Zbigniew Łukasiak wrote:
> There are instructions how to resize a VM at
> https://www.qubes-os.org/doc/resize-root-disk-image/ - but this cannot
> apply to dom0 - because it requires stopping the VM and then running
> commands in dom0. What would be the procedure for resizing dom0 root
> partition?
>

It's just a linux, and by default dom0 root fs is ext4, which can be
grown while mounted, so 'standard' resizing procedure should do. Please
take into account that there is ext4 on LVM on LUKS and each have to be
grown separately. All commands run as root from dom0(do backups and be
carefull!!!).
Thanks to LVM there are two alternative solutions.

First one, if you have space after LUKS partition on your HDD/SSD:
0. grow physical partition using fdisk or gparted.
1. grow LUKS container using "cryptsetup resize".
2. grow (LVM) physical volume using "pvresize".
3. grow (LVM) logical volume(default name: root) using "lvextend".
4. grow ext4 filesystem using "resize2fs".

Alternatively you can extend root by extending LVM, but this will
require providing two(or more) passwords while booting(because each part
of LVM will need to be decrypted before "merging" it into root partition).
0. Create new partition using fdisk/gparted.
1. Create new encrypted luks container using "cryptsetup luksFormat".
2. Mount newly created luks container.
3. Initialize (LVM) physical volume on newly created luks container
using pvcreate.
4. Add newly created physical volume to LVM volume group (by default
named: qubes_dom0) using "vgextend".
5. grow (LVM) logical volume using "lvextend".
6. grow ext4 filesystem using "resize2fs".
7. remember to recreate initramfs including both LUKS containers and new
lvm settings

As always with filesystem changing operations, backup everything before
proceding and be extremly carefull. I'm also not providing full
commands(it's hard to do from the top of my head), so RTFM to get better
understanding of each of above-mentioned commands.

To analyze current state of LVM useful commands are: pvdisplay,
vgdisplay and lvdisplay. Additionally all used devices shall be visible
in /dev/mapper.

Regards,
tezeb

signature.asc

Manuel Amador (Rudd-O)

unread,
Feb 18, 2017, 1:02:52 PM2/18/17
to qubes...@googlegroups.com, Zbigniew Łukasiak
It is the standard procedure to enlarge any root partition on any Linux — enlarge encrypted volume, enlarge LVM physical volume, enlarge enlarge LVM logical volume, enlarge root file system. You will have to do this from a rescue initramfs or another Linux system you booted from.


On February 18, 2017 2:23:29 AM PST, "Zbigniew Łukasiak" <zzb...@gmail.com> wrote:
There are instructions how to resize a VM at
https://www.qubes-os.org/doc/resize-root-disk-image/ - but this cannot
apply to dom0 - because it requires stopping the VM and then running
commands in dom0. What would be the procedure for resizing dom0 root
partition?

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Zbigniew Łukasiak

unread,
Feb 20, 2017, 1:26:15 PM2/20/17
to qubes-users
Thanks for the instructions. Unfortunately I have no space after the
partition - and I did not want to have two passwords - so I created a
new partition with enough space. I tried copying (with dd) the old
partition into the new one and then proceeding with the instructions -
but that failed with duplicate UUIDS (and it seems I am lucky I did
not corrupt the system completely with that). So I am back here asking
how can I clone the QubesOS system into the bigger partition? I don't
want to corrupt the system.

Additional question is that apparently I don't have encryption on the
physical partition level - but rather at the logical volume level:

[root@dom0 zby]# lvdisplay
--- Logical volume ---
LV Path /dev/qubes_dom0/01
LV Name 01
VG Name qubes_dom0
...

[root@dom0 zby]# cryptsetup luksDump /dev/qubes_dom0/00
LUKS header information for /dev/qubes_dom0/00

Version: 1
Cipher name: aes
Cipher mode: xts-plain64
Hash spec: sha256
Payload offset: 4096
MK bits: 512
...


Is that normal? This was my first QubesOS installation so I don't
think I tried anything non-standard then. It is also set on the other
lv /dev/qubes_dom0/01 - but I still enter just one password.

I guess this would change the instructions sequence.

Z.

Zbigniew Łukasiak

unread,
Feb 21, 2017, 5:00:15 AM2/21/17
to qubes-users
My current plan is to install a new QubesOS system into the big free
partition - and then move stuff there. I don't have anything valuable
in dom0 - so it is about moving the VMs. Is there a clean way to do
that? Would it work if I just copy /var/lib/qubes into the new system?


Cheers,
Zbigniew
Reply all
Reply to author
Forward
0 new messages