[CentOS] KVM Questions

Sun May 10 00:00:08 UTC 2015
Leon Fauster <leonfauster at googlemail.com>

Am 09.05.2015 um 23:19 schrieb Paul R. Ganci <ganci at nurdog.com>:
> On 05/08/2015 11:41 PM, James Hogarth wrote:
>> was wondering if this procedure might work to do what I desire:
>> 
>> 1.) Shutdown the VMs
>> 2.) Archive the VM image directory /home/vmimages to a network drive
>> 3.) Use parted or fdisk to delete present /home partition
>> 4.) Use parted or fdisk to re-create smaller/home partition and new vm-images
>> 5.) Create XFS file system on /home and /vm-images
>> 6.) Extact VM image directory archive into /vm-images
>> 7.) Use virt-manager to change default location of images to /vm-images
>> 
>> Is there any chance that after all this the VMs would actually start up
>> again especially after a re-boot?
>> 
>>> They are just disk images so as long as you don't mind deleting home then
>>> this will work.
> So it turns out this was even easier than I expected. The home partition was actually built upon LVM so some relatively simple use of LVM allowed me to do exactly what I wanted. However I have some very subtle issue that I don't understand. virt-manager, df and du incorrectly think this:
> 
>> df
> Filesystem                               1K-blocks     Used Available Use% Mounted on
> /dev/mapper/centos_mric--srv2-root        52403200  5717192  46686008  11% /
> devtmpfs                                  16378220        0  16378220   0% /dev
> tmpfs                                     16388924       88  16388836   1% /dev/shm
> tmpfs                                     16388924     9224  16379700   1% /run
> tmpfs                                     16388924        0  16388924   0% /sys/fs/cgroup
> /dev/mapper/centos_mric--srv2-home       433378560    32928 433345632   1% /home
> /dev/sda1                                   508588   219764    288824  44% /boot
> /dev/mapper/centos_mric--srv2-vm--images  67858700 16294864  51563836  25% /vm-images
> 
>> du -k /vm-images
> 16261904	/vm-images
> 
> But ls has it correct:
> 
>> ls -alt /vm-images
> total 16261908
> -rw-------.  1 qemu qemu 51547734016 May  9 15:15 centos7.0-1.qcow2
> -rw-------.  1 qemu qemu 12887130112 May  9 15:15 centos7.0.qcow2
> drwxr-xr-x. 21 root root        4096 May  9 15:13 ..
> drwxr-xr-x.  2 root root          52 May  9 13:39 .
> 
> Any idea how I make this correct?
> 
> There are no side effects that I see but it is extremely puzzling to me as to why the new partition does not have the correct size. It appears the larger of the two VM images is not getting counted.



modern filesystems and image formats do not allocate the whole space if not neccessary (qcow2 feature).

--
LF