-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Sat, Oct 14, 2017 at 01:17:48AM +0200, Wojtek Porczyk wrote:
> On Sat, Oct 14, 2017 at 12:22:28AM +0200, Marek Marczykowski-Górecki wrote:
> > There is a problem with our shiny new templates for Qubes 4.0. Partition
> > table there make it hard to resize root filesystem.
> > 
> > Current partition layout of a template in Qubes 4.0 is:
> > 1. xvda1: root filesystem (almost all available space)
> > 2. xvda2: EFI system partition (empty, prepared for PVHv2 boot with 
> > VM-provided kernel)
> > 3. xvda3: BIOS boot (grub2 installed, used when `kernel=''`)
> > 
> > This makes resizing root volume hard, because one need to move xvda[23]
> > data to the (new) end of the disk first. Also, having partitions at all
> > (de facto required by grub2), makes online resize of root volume
> > hard/impossible.
> > 
> > Proposed solution: reorder partitions to 1. ESP, 2. BIOS boot, 3. root
> > filesystem. This will not solve online resize problem, but will allow
> > offline one (with VM restart in the middle). 
> 
> Why won't it solve online resizing? If you're growing the last partition, it
> works OK.

You can't reload partition table while it is used (something from there
is mounted). At least Linux doesn't support it.

> > The problem is, it is a bit late for changing such fundamental thing...
> > Affected components:
> >  - template builder[1]
> >  - initrd[2] (responsible for mounting root filesystem)
> > 
> > So, at this stage, changing partition layout (dropping support for the
> > current one, adding support for the new one) IMO is out of the options.
> > The only possibility (if at all) is to add support for new layout and
> > keep support for the current one. In a way not breaking the current
> > setup.
> > 
> > Alternatively, we can keep it as is (and change later - like in Qubes
> > 4.1). And for now document how to extend root volume manually. Something
> > like:
> > 1. Shutdown VM (TemplateVM/StandaloneVM)
> > 2. Use `qvm-volume` to extend root volume
> > 3. Set VM kernel to some version (if was set to empty - i.e. VM provided)
> > 3. Start VM
> > 4. Launch fdisk, remove all partitions
> > 5. Re-create partition 1 with new size - almost the whole disk - minus 
> > 202M, set its type to "Linux"
> > 6. Re-create partition 2 with size 200M, set its type to "EFI system 
> > partition"
> > 7. Re-create partition 3 with size 2M, set its type to "BIOS boot"
> > 8. Restart VM (to reload partition table)
> > 9. Re-install grub (`grub2-install /dev/xvda`)
> > 10. Restore original kernel property (if changed in step 3)
> > 
> > A lot of things can go wrong in the process.
> > 
> > Yet another option would be to automate the above in initrd, before
> > mounting root filesystem - so it is possible to reload partition table
> > there, without VM restart. This would require copying data of partitions
> > 2 & 3. Not sure if grub will survive such thing (because of moving BIOS
> > boot partition). It is fragile operation, too.
> > 
> > Any preference, or maybe another solution?
> > 
> > Tracking issue:
> > https://github.com/QubesOS/qubes-issues/issues/3173
> > 
> > [1]
> > https://github.com/QubesOS/qubes-linux-template-builder/blob/master/prepare_image#L59-L76
> > - and other places there assuming root fs is on the first partition
> > [2] https://github.com/QubesOS/qubes-linux-utils/tree/master/dracut
> 

- -- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJZ37jdAAoJENuP0xzK19csF4MH/RE9ZON//Yc7YIpVqXNompJq
aKzh5xgcsVjG+BrGymim23yMEFVlwXz0jE/UOb4otefW4MPLxEb8EzuwPjeo4kCY
7gJzzbvxJ3O71iSxCjHoVoCS7NGiuJbjM61mI+y8LqWHRTv5a7gRoTbnim9p1q82
2mVACgvSMTRoYVuoBRw78mb6741Y35OCpdYnpRQOve2VZS6B5GcEev/Xm1W2KVz4
uU6i9CbZ6er3Vf3mNeQrOZaiu3yCkVW9f6hk6ZKG3tSBC2QYWGODW50an04SavPS
ymM3OhwLfZ4DDbLwWAEbEVwjqYIu93BFXBDVxDjSrzgo3ncJF+5t/fGVmIyPKXU=
=1nep
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-devel+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-devel@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-devel/20171013232013.GN1059%40mail-itl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to