I’ve been using Virtualbox for my test VMs forever basically and recently I decided that I would give virt-manager a try. So far I really like it a lot! But I found something curious.
First, here is a screenshot of the part that is odd.
If I create the disk image by using the default option then the disk image allocates the full amount of space. If I instead select the option to create a custom image it is a dynamically growing image. And here is the verification.
> du -sh *
The first one above was created by selecting the default option and the second was created using the custom option. Both are 16G images and both appear to be the same file format.
> file opensuse15.1.qcow2
opensuse15.1.qcow2: QEMU QCOW Image (v3), 17179869184 bytes
> file test.qcow2
test.qcow2: QEMU QCOW Image (v3), 17179869184 bytes
The problem here is that I would always like to have them created as the dynamically allocated image but I might sometimes forget that I would need to go through that extra step to do it
Is there a way to have it create the dynamically allocated images by default?
Looking at my KVM images, they appear to be sparse files. They are full size according to “ls -l” output. But when I use “ls -s” they are significantly smaller. So maybe that’s already the default.
Thanks for the reply. No it’s definitely not the default for virt-manager specifically. I just created a new one with the default options and it’s fully allocated.
> ls -sh testagain.qcow2
If I create the disk using either qemu-img or by selecting the custom option in virt-manager then it creates it as sparse. It’s only the default option in virt-manager that is doing this and that’s what I’m asking about.
Do you use virt-manager and if so does it fully allocate the disk if you create a new VM and just click through the default options?
I just tested this. And, yes, it was fully allocated.
Looking at images that I have, most are not fully allocated. Some were created manually with virt-install. And some were created using virt-manager, but that may have been under openSUSE Leap 15.0. So perhaps this has changed between 15.0 and 15.1.
Not sure what is being asked here?
Seems to likely simply be a difference reporting what the fully allocated size is vs the current size of a sparse file.
Can probably be verified by various tools… I’d actually be surprised if du reported the fully allocated file size instead of the actual current size… If that was how it might have been reported in the past, then I’d have considered that a bug and someone could have fixed that.
I’m asking about the default settings in virt-manager specifically. The default appears to be to create the disk images as not sparse.
It’s definitely not a reporting issues and yes, it can be verified using various tools. Like with “du” and “ls -s”. Both of those specifically tell you the allocated size. Let me show you what I mean. Let’s start with a normal “ls -l” which does not know about allocation sizes (I am adding -h to the commands below just to make it easier to look at. That doesn’t change the size reported, just the way it’s reported). Notice that below shows both files as 17G.
> ls -lh test*
-rw------- 1 root root 17G Mar 14 18:22 test1.qcow2
-rw------- 1 root root 17G Mar 14 18:22 test2.qcow2
Now let’s see how much space is actually allocated to them on the disk.
> ls -sh1 test*
> du -sh test*
Both of those tools report the same thing. “test1” is fully allocated while “test2” is not. I created both of those images using virt-manager and the only difference was that “test1” was created using the “New VM” automatic settings and “test2” was created manually. Neither of those methods gives any options to change the behavior and also I have not been able to find any settings in the configuration files. So I’m just kind of stuck. Lol.
The only problem here is that I want to change the default. I create VMs regularly and it’s kind of annoying to not be able to just click through sometimes. Any suggestions?