{"id":193,"date":"2017-06-30T23:51:28","date_gmt":"2017-06-30T23:51:28","guid":{"rendered":"http:\/\/info.ffteixeira.net\/2017\/06\/30\/convert-your-disk-file-from-raw-to-qcow2\/"},"modified":"2017-06-30T23:51:28","modified_gmt":"2017-06-30T23:51:28","slug":"convert-your-disk-file-from-raw-to-qcow2","status":"publish","type":"post","link":"https:\/\/blog.ffteixeira.net\/?p=193","title":{"rendered":"Convert your disk file from raw to qcow2"},"content":{"rendered":"<p>Use Virtual machines, such as within KVM, then you may be running raw disk images.<\/p>\n<p>Converting them to Qcow2 will give you some advantages, such as the <u>ability to snapshot your V<\/u>M. Here we will show you how to:<\/p>\n<ul>\n<li>&nbsp;&nbsp;&nbsp; Check your disk file&#039;s format to see if it is raw or qcow2<\/li>\n<li>&nbsp;&nbsp;&nbsp; Convert your disk file from raw to qcow2<\/li>\n<\/ul>\n<p><strong>Check Your Format<\/strong><\/p>\n<p>You can test your disk file with the following command:<\/p>\n<p><strong><code>qemu-img info [disk filename]&nbsp;<\/code><\/strong><\/p>\n<p>If it is a <u>raw image format<\/u>, you should get output similar to below:<\/p>\n<p><em>image: images.programster.org.img&nbsp;<br \/>file format: raw&nbsp;<br \/>virtual size: 30G (32217432064 bytes)&nbsp;<br \/>disk size: 30G&nbsp;<\/em><\/p>\n<p>If it is a <u>qcow2 image format<\/u>, then it will output something similar to:<\/p>\n<p><em>image: images.programster.org.qcow2&nbsp;<br \/>file format: qcow2&nbsp;<br \/>virtual size: 30G (32217432064 bytes)&nbsp;<br \/>disk size: 4.8G&nbsp;<br \/>cluster_size: 65536&nbsp;<br \/>Format specific information:&nbsp;<br \/>&nbsp;&nbsp;&nbsp; compat: 1.1<br \/>&nbsp;&nbsp;&nbsp; lazy refcounts: false<\/em><br \/>&nbsp;<\/p>\n<p><strong>Convert Raw To Qcow2<\/strong><\/p>\n<p>Simply enter the following command:<\/p>\n<p><code><strong>qemu-img convert -p -f raw -O qcow2 [input filename] [output filename]&nbsp;<\/strong><\/code><\/p>\n<p>After the operation completes, you may wish to delete the original input file. You will need to update any configs that utilize the new image, such as through sudo virsh edit [VM ID] for KVM. E.g. change the type from raw to qcow2 and update the path.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>The convert option tells<strong> qemu-img<\/strong> that we want to copy an existing image file to a new image file.<\/li>\n<li>The <strong>-p<\/strong> option tells the qemu-img tool that I want to know about the progress of the copy operation.<\/li>\n<li>The <strong>-f<\/strong> option specifies the format of the original input file.<\/li>\n<li>The <strong>[input filename]<\/strong> parameter is the disk name of the input file.<\/li>\n<li>The <strong>-O<\/strong> option specifies the format that we want to use for the output file.<\/li>\n<li>The <strong>[output filename]<\/strong> parameter is the disk name of the output<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/blog.programster.org\/qcow2-conversion-and-snapshotting\/\" target=\"_blank\" rel=\"noopener noreferrer\">Credits<\/a>|<a href=\"http:\/\/azertech.net\/content\/kvm-qemu-qcow2-qemu-img-and-snapshots\" target=\"_blank\" rel=\"noopener noreferrer\">Credits<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use Virtual machines, such as within KVM, then you may be running raw disk images. Converting them to Qcow2 will give you some advantages, such as the ability to snapshot your VM. Here we will show you how to: &nbsp;&nbsp;&nbsp; &hellip; <a href=\"https:\/\/blog.ffteixeira.net\/?p=193\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[22,32,34],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-kvm-qemu","tag-qcow2","tag-qemu-img"],"_links":{"self":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193"}],"version-history":[{"count":0,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=\/wp\/v2\/posts\/193\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ffteixeira.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}