Expanding on this topic:
If virt-resize is given a disk image that looks like this:
filesystem
|
LV
|
+-------- VG ------+
PV 100% full PV 100% full
/dev/sda1 /dev/sda2
If asked to expand 'filesystem', which we assume fills up 100% of its
container, then obviously the expansion has to "cascade down" so that
eventually we need to expand one or both of the partitions. Which
partition is arbitrary (but this is a rather atypical case).
Now imagine that virt-resize is given this disk image and asked to
increase the size of 'filesystem':
filesystem
|
LV
|
VG
|
PV 80% full
/dev/sda1
If the requested increase is smaller than the remaining free space in
the PV, this could be done without resizing the partition at all.
However the user would hardly need to use virt-resize for this, since
they could just do exactly the same thing within the guest (or even
from the host, using guestfish). It seems to me that if the user is
using virt-resize at all, then any request to resize a filesystem must
translate into a request to change the size of a partition. So we
might say that a requested increase of 1GB of 'filesystem' cascades
down so the LV and PV are also increased by 1GB, even if there was
space in the PV to start with.
It's trickier when we consider shrinking.
filesystem
|
LV
|
VG
|
PV 100% full
/dev/sda1
If the user requests that 'filesystem' is shrunk by 20%, we could
end up either with:
filesystem
|
LV
|
VG
|
PV 80% full
/dev/sda1 (same size as before)
or with:
filesystem
|
LV
|
VG
|
PV 100% full
/dev/sda1 (shrunk to 80% of previous size)
If the user is using virt-resize at all, then obviously only the
second scenario makes sense.
And how about this situation:
fs1 fs2
| |
LV1---LV2
|
VG
|
PV 100% full
/dev/sda1
User requests that /dev/sda1 is shrunk by some amount. We need to
take that space from fs1 and fs2 (assuming they have free space).
Potentially there could be many different ways to achieve this.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top