LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-27-2018, 09:45 PM   #1
skagnola
Member
 
Registered: May 2017
Distribution: CentOS
Posts: 41

Rep: Reputation: Disabled
CentOS 6 copied disk not converting with qemu-img


Hello!

Running into an odd issue. I copied a couple VM disks using dd. That went fine. Output size and all is about where it should be.

I then went to info one of the images, and it came back as expected...

Code:
qemu-img info disk_rt.img
image: disk_rt.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 12G
cluster_size: 65536
Format specific information:
    compat: 0.10
    refcount bits: 16
Next was converting it, but this is where the issue lies. Upon initiating the conversion, the task completes instantly and is only 5MB. No errors. This disk was added to the root lv some time in the past, expanding its space.

Code:
qemu-img convert -p -f qcow2 -O vmdk disk_rt.img disk_rt_vda
Code:
5.0M Apr 28 02:08 disk_rt_vda
The OS disk went fine with converting. It was also a qcow2, of course.

Code:
qemu-img info disk_os.img
image: disk_os.img
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 25G
cluster_size: 65536
Format specific information:
    compat: 0.10
    refcount bits: 16
Code:
qemu-img convert -p -f qcow2 -O vmdk disk_os.img disk_os_vda

Code:
18G Apr 28 02:07 disk_os_vda
Not really sure if because of this added in disk being part of a partitioned OS disk, a separate disk set up as an lvm to supplement, is causing this?

For some reason qemu-img is not seeing much for it to convert.
 
Old 04-28-2018, 09:22 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Perhaps very little of that new disk was actually used. The conversion only processes clusters that are actually mapped, i.e., clusters that were written to at least once since the volume was created.

Last edited by rknichols; 04-28-2018 at 09:45 AM.
 
1 members found this post helpful.
Old 04-28-2018, 10:01 AM   #3
skagnola
Member
 
Registered: May 2017
Distribution: CentOS
Posts: 41

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Perhaps very little of that new disk was actually used. The conversion only processes clusters that are actually mapped, i.e., clusters that were written to at least once since the volume was created.
Huh, that's interesting. Did not know that. I guess I will continue with the process and see what happens.
 
Old 04-28-2018, 11:22 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
FWIW, I just tried creating a 10GB qcow2 file with option "preallocation=full" so that it took up the full 10GB on disk, did nothing but create a partition formatted to ext4. "qemu-img map --output=json" showed every cluster with '"zero": false, "data": true"'. Running "qemu-img convert" to convert it to vmdk yielded a tiny file. Converting that tiny vmdk file back to qcow2 almost instantly yielded a tiny qcow2 file that nonetheless contained the partitioning and filesystem that I had created.
 
Old 04-28-2018, 05:25 PM   #5
skagnola
Member
 
Registered: May 2017
Distribution: CentOS
Posts: 41

Original Poster
Rep: Reputation: Disabled
rknichols thanks for the info. I went ahead with the disk imports/clones and the VM came up fine!

Due to my lack of experience with qemu-img, I figured the output file size noted in the OS would be close to the actual full disk size following the conversion. Definitely good info to know only mapped clusters are worked.

;-)
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lsblk reports qemu-img created disk is only 200k nbritton Linux - Virtualization and Cloud 1 04-28-2018 12:47 PM
Copied initrd.img to a new location msimpason Linux - Newbie 2 08-08-2016 02:33 AM
[SOLVED] centos 6.2 live cd copied to disk: no operating system on re-boot needsleep Linux - Newbie 3 04-05-2012 11:03 AM
[SOLVED] lousy qemu-img performance converting to qcow2 ... if you use a hard drive Skaperen Linux - Virtualization and Cloud 8 06-01-2011 03:42 AM
After qemu-img, qemu is not capable to detect the C drive (empty) frenchn00b Linux - General 3 10-18-2009 05:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:59 AM.

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