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

On Sat, Oct 14, 2017 at 01:20:13AM +0200, Marek Marczykowski-Górecki wrote:
> 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.

Just tested with loop device, fdisk, and ext4. Looks like it works. Unless it
works only with loop?

> > > 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?
> 
> -- 
> 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.

- -- 
pozdrawiam / best regards       _.-._
Wojtek Porczyk               .-^'   '^-.
Invisible Things Lab         |'-.-^-.-'|
                             |  |   |  |
 I do not fear computers,    |  '-.-'  |
 I fear lack of them.        '-._ :  ,-'
    -- Isaac Asimov             `^-^-_>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJZ4UqVAAoJEL9r2TIQOiNRAiYQAJBN38BsvsKM8bC/6uXI2pMe
B0ZhoW2KCSQeEE2yWOarUJ3UHJzYqfxZuO0FMmZwGadNWQy2jSzgNjphMojpu9Me
kjJWr0Xf1W1ZTgtRde5HFgPr06Dgy8rHimljeRlxBPqWK0d4LYaXLmEy9+21Oim4
ayNxWmFsrXVv0/vg8WXMXKoho7saeti/Z1606f9m5sd/KCqSisyk6FvQiLSjhLIa
LHXx1N/gxbkw9/TlX9RShmBr5QpsJx4VC0cBDBz0eIDsfEuy2wynKZdUN9Bh4zI0
ubXwHxRF/6UilJf85pgDp8b4USo5fAckzX9HgRl8gNqegFmFRto+i4vX61zl85wU
SCTYa9lHZUSEdL/urLHOBF1ObsR6p6cWKKF2bIS4+/IV4HcXJiaAqN3EE36GL7Us
HlMp6biWBZSI6lJuBmNDQUbYsv2hJcFFBxSB3di48chRJgLdMpOqcWEMXad/zb1b
u/7nET5TE3AsRF39N6WI6FerKgG6q3bFeWPtvCrnXoTHWGE1etbrZ3o/4WlT+PKZ
kqel6j2vZC/3XVa2ZWDzgDuFJeScvgBfq22s8a7znyj1wJAUoX4aTq0SloXmo+RX
7T2Beg+LTq8gF2IvwJOrIGzPV1/WT+auAcXQVIFRCOX6JiOJrUR1h4NTPlP2CvBC
C0MYu1jM80Gs7T9nKbyt
=lTFr
-----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/20171013232158.GD21553%40invisiblethingslab.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to