Qvm-create: --root-copy-from vs --root-move-from

The qvm-create doc shows two options whose difference in behaviour is not immediately obvious. At first I thought that “move” could mean that the source file would be removed after being copied to the new lvm volume, but that seemed awkward and is not what happens. Is it just a remnant of pre-lvm era ?

       --root-copy-from=FILENAME, -r FILENAME
              Use provided root.img instead of default/empty one (file will be copied). This option is mutually exclusive with --root-move-from.

       --root-move-from=FILENAME, -R FILENAME
              Use provided root.img instead of default/empty one (file will be moved). This option is mutually exclusive with --root-copy-from.

In fact, when given a file whose size is smaller than the VM’s rootfs size, both will yell:

app: Error importing root volume (but VM created): Data import failed: not enough data (copied 771339878 bytes, expected 10737418240 bytes)

The “copied xxx bytes” seems to imply the data was indeed copied, but in reality (and with any of those 2 options), what we get is a volume full of zeros.

I can’t find a documented way of setting the system volume size on qvm-create command-line. It’s not unthinkable that it would be possible through --prop, but the manpage lists only a couple of example properties and no pointer to an exhaustive list.

I can make sure the image matches the expectation with the following, and that indeed gets me a proper copy:

dd if=/dev/zero of=myrootfs.img count=0 bs=1 seek=10737418240

… and indeed now that the copy does happen, with --root-move-from the file gets removed.

To wrap up, there several points:

  • documenting current behavior (pushed MR)
  • how to create system volume with specific size ?
  • documentation of possible --prop values

We are not,as yet, out of a “pre-lvm era”.
File based storage is fully supported under 4.0, will be deprecated in
4.1 and removed in 4.2.
The doc should make it clear that these options work as stated under that

If you feel https://github.com/QubesOS/qubes-core-admin-client/pull/185 needs changes in light of this clarification, I’ll gladly update it. For now I have the feeling that my wording update equally describes both situations from the user’s point of view (or does it really matter that in the pre-lvm case we do have a move and not an unlink ?