LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 05-19-2012, 12:47 AM   #1
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Rep: Reputation: 11
qcow2 image file causing guest install to fail due to insufficient space


I'm trying to deploy a Linux guest in KVM on RHEL 6.2 using a pre-created image for the backing store.
I create the image with qemu-img and then the guest using virt-install. The guest boots off my DVD ISO, but when I get to the point in the installer to setup the disk partition if fails claiming there is not enough space - either showing it as 0kb or 256kb.

The image file is of type qcow2 and I expected the space to be allocated (i.e. it to grow from 256kb up to max of 20GB as required) as the install progressed and during actual usage.

I must be getting confused somewhere along the way so any pointers would be greatly appreciated.

Thanks.

How I created the image file:

Code:
[root@bled1 images]# qemu-img create -f qcow2 \
> rhel-6.2-x86_64_fred.qcow2 20G
Formatting 'rhel-6.2-x86_64_fred.qcow2', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536
[root@bled1 images]# ll
total 136
-rw-r--r--. 1 root root 262144 May 18 17:24 rhel-6.2-x86_64_fred.qcow2
[root@bled1 images]# qemu-img info rhel-6.2-x86_64_fred.qcow2
image: rhel-6.2-x86_64_fred.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 136K
cluster_size: 65536
Code:
cat /proc/version
Linux version 2.6.32-220.17.1.el6.x86_64 (mockbuild@x86-003.build.bos.redhat.com) (gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Thu Apr 26 13:37:13 EDT 2012
 
Old 05-19-2012, 01:44 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I have seen some installers that seem not to follow the speed of the grow.

Pre-allocate the disk then. I forget the option in qemu-img or just get a premade virtual disk of the size you want.
 
Old 05-20-2012, 11:42 AM   #3
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
the disk you created is sparse. you can verify it with `ls -lsah`, I guess you simply don't have 20Gb free for the disk to grow into
 
Old 05-21-2012, 06:44 AM   #4
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 11
Thanks for the replies.
I want to use thin-provisioning for the guests so pre-allocating in full is not a feasible solution.

I have plenty of free space:

Code:
/dev/sda3             1.3T   20G  1.3T   2% /home
I tried creating this with the preallocation metadata option:

Code:
# qemu-img create -f qcow2 -o size=20G,preallocation=metadata rhel-6.2-x86_64_fred.qcow2
Formatting 'rhel-6.2-x86_64_fred.qcow2', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 preallocation='metadata'
# qemu-img info rhel-6.2-x86_64_fred.qcow2                   image: rhel-6.2-x86_64_fred.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 3.3M
cluster_size: 65536
This created a sparse file that is shown by ls to be ~21GB in size, but its actually only using a few MB. The installer recognises this as the correct size and I can install ok. After which the file is now consuming ~2GB.

When I create the qcow2 file without this preallocation option the file size is shown by ls to be only 256KB. Does anyone else have any examples on what sizes they see?
 
Old 05-21-2012, 10:48 AM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I guess you could boot to some live cd image and then format it and copy random stuff to it until it grows some maybe 8G or whatever size plus of expected image. Installers sometimes use more space then delete it at end of operation so grow the disk maybe 25% larger. Then use the installer again to partition the image file and format it. It still should be same size.

Guess your location of the file might hold some size limits.


If you created the file full then it should be 21G in disk size.

Make it a raw disk then and re-test. I have almost never had a raw disk not work. Just change the name to the correct vm image. Otherwise it's use is exactly the same and as far as I can tell a bit faster.

If it fails on the raw disk then... dunno.

Guess it could be that you have some huge fragmentation issue. A copy binary to similar file might fix it then use the new name.

Last edited by jefro; 05-21-2012 at 03:19 PM.
 
Old 05-21-2012, 10:53 AM   #6
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
wait, it's in /home? might be a permission or selinux issue. the permissions and context for libvirt are by default properly set for /var/lib/libvirt/...
 
Old 05-22-2012, 03:22 AM   #7
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 11
Thanks again for the replies.

I did set the context of the file correctly, but I also disabled SELinux just to make sure

Maybe I wasn't clear, it does work now, but only if I create the qcow2 image with the preallocation=metadata option. This file is only ~3MB and grows without issue during the installation to end up being ~2GB in size. The guest system does think it has a 20GB disk available, so I'm sure the file will be able to grow fine to the full 20GB size limit as and when it is used by the guest.

I just don't understand why I need to use this preallocation=metadata option - as far as I know it should work fine with just the defaults. Does anybody else see the same issue as me or does it just work fine?
 
Old 05-22-2012, 06:47 AM   #8
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
works fine for me, but I generate the images using virt-manager or RHEV, qemu-img hardly ever needs to be nudged manually
 
Old 05-22-2012, 03:27 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
"The installer recognises this as the correct size and I can install ok"

I missed that.

Mark as solved then.
 
Old 05-25-2012, 04:53 AM   #10
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 11
A colleague managed to figure out the issue.

It was actually all down to the location of image file. Libvirt treats it differently if it is not in the standard /var/lib/libvirt/images location.

The logfile for the guest shows it being used as a raw format.

If you move the same image file to the default location, creating a guest with the same parameters using that same image file then results in it being used correctly and the format being shown as qcow2.

You can also use an option with virt-install (disk=myimg.qcow2,format=qcow2) to force it to use the correct format.
 
Old 05-25-2012, 07:35 AM   #11
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
this is what I was talking about in http://www.linuxquestions.org/questi...4/#post4684060
 
Old 06-03-2012, 05:40 PM   #12
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by dyasny View Post
this is what I was talking about in http://www.linuxquestions.org/questi...4/#post4684060
No, you were referring to the SELinux file context considerations for using a non-default location for your images, which was clearly NOT the issue in this case as I have outlined in the solution above.

Thanks for taking the time to respond though.
 
Old 06-04-2012, 01:53 AM   #13
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by maccas17 View Post
No, you were referring to the SELinux file context considerations for using a non-default location for your images
I actually said selinux OR permissions
 
Old 06-05-2012, 03:27 AM   #14
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by dyasny View Post
I actually said selinux OR permissions
Yes you did, but it wasn't EITHER

Permissions are 711 and owned by root:

Code:
ll -d /var/lib/libvirt/images
drwx--x--x. 2 root root 4096 May 25 13:31 /var/lib/libvirt/images
Actual permissions on an image file are 600 when created using virt-manager or 644 using qemu-img (with default umask).

libvirt behaves the same whatever the permissions on the file or its directory. To reiterate what I already stated above, if when you create the guest with virt-install you use ",format=qcow2" then irrespective of the location of your image file it is used as a qcow2 format file, as opposed to being used as a raw format file.

Thanks for trying to help me with this issue.
 
1 members found this post helpful.
Old 11-01-2018, 07:37 AM   #15
xelvias
LQ Newbie
 
Registered: Nov 2018
Posts: 1

Rep: Reputation: Disabled
I had the same issue but specifying the format as qcow2 solved my problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Xen RAW image to KVM qcow2 makes Win2k8 guest BSOD Savaan Linux - Virtualization and Cloud 9 12-31-2011 11:59 AM
Insufficient disk space for netbeans install Ruffus77 Linux - Newbie 7 05-05-2008 07:03 PM
boot failure due to insufficient space ?? samik Fedora - Installation 3 07-27-2005 01:22 PM
Printing: Insufficient File Space esael Linux - Hardware 3 09-19-2002 12:35 AM
Red Hat 7.1 Install error - insufficient disk space KIRKR Linux - Software 5 01-09-2002 04:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 01:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration