Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow shrinking storage volumes #3725

Open
marmarek opened this issue Mar 20, 2018 · 1 comment
Open

Allow shrinking storage volumes #3725

marmarek opened this issue Mar 20, 2018 · 1 comment
Labels
C: core C: storage P: minor Priority: minor. The lowest priority, below "default." T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@marmarek
Copy link
Member

While proper resizing filesystem first is tricky and not planned to be supported anytime soon, there are still cases where shrinking volume can be useful. For example installing/reinstalling template with root volume smaller than default one. This is especially the case for unikernel based systems.

Related: #3169 (comment)

@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. C: core P: minor Priority: minor. The lowest priority, below "default." labels Mar 20, 2018
@marmarek marmarek added this to the Release 4.0 milestone Mar 20, 2018
@marmarek marmarek self-assigned this Mar 20, 2018
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Mar 20, 2018
Right now Admin API backend will refuse to shrink volume anyway, but
we're planning to relax this restriction. Make sure the client side
(qvm-volume tool here, GUI VM settings already have this in place) will
employ appropriate safety check.

QubesOS/qubes-issues#3725
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Mar 20, 2018
Right now Admin API backend will refuse to shrink volume anyway, but
we're planning to relax this restriction. Make sure the client side
(qvm-volume tool here, GUI VM settings already have this in place) will
employ appropriate safety check.

QubesOS/qubes-issues#3725
marmarek added a commit to marmarek/qubes-core-admin-client that referenced this issue Mar 20, 2018
Right now Admin API backend will refuse to shrink volume anyway, but
we're planning to relax this restriction. Make sure the client side
(qvm-volume tool here, GUI VM settings already have this in place) will
employ appropriate safety check.

QubesOS/qubes-issues#3725
@SuzanneSoy
Copy link

I also tried to shrink a VM's disk (in my case the private.img) immediately after creating it. It is possible, but the system does not recognize it happening:

$ qvm-volume resize --force dummytest:private "$((1024*1024*1024))"
For your own safety, shrinking of private is disabled. If you really know what you are doing, use `truncate` on appvms/dummytest/private manually.
$ truncate -s 1G /var/lib/qubes/appvms/dummytest/private.img && echo ok.
ok.
$ qvm-volume resize --force dummytest:private "$((1024*1024*1024))"
For your own safety, shrinking of private is disabled. If you really know what you are doing, use `truncate` on appvms/dummytest/private manually.
$ qvm-volume info dummytest:private size
2147483648 # Still the original size of 2 GiB
$ qvm-volume config dummytest:private size "$((1024*1024*1024))"
Invalid property: size

After that point, if I start the VM (i.e. its first boot) it seems that df -h reports the correct size within the VM, but qvm-volume does not detect the new, shrinked size.

What's worse is that if I make a backup of that VM, delete the original, restore it and start it, df -h shows that the disk image has been enlarged to the default size (2 GiB). I suppose that it would be possible to truncate the private.img file just after restoring the backup, but it seems hazardous to do so since at that point there is an actual filesystem on-disk (so putting the wrong size, say 1000*1000*1000 instead of 1024*1024*1024 would likely wreck the data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: core C: storage P: minor Priority: minor. The lowest priority, below "default." T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
Development

No branches or pull requests

4 participants