{"id":2010,"date":"2009-06-26T19:54:19","date_gmt":"2009-06-26T23:54:19","guid":{"rendered":"http:\/\/blogs.n1zyy.com\/n1zyy\/?p=2010"},"modified":"2009-06-26T19:54:19","modified_gmt":"2009-06-26T23:54:19","slug":"resizing-an-ext3-xen-disk-image","status":"publish","type":"post","link":"https:\/\/blogs.n1zyy.com\/n1zyy\/2009\/06\/26\/resizing-an-ext3-xen-disk-image\/","title":{"rendered":"Resizing an ext3 Xen disk image"},"content":{"rendered":"<p>I&#8217;ve seen this a few other places and it didn&#8217;t quite work. Let&#8217;s say you download a half-gig barebones Linux VM to use with Xen. It runs great, but you want more than 500MB of disk space. Here&#8217;s exactly what I had to do:<\/p>\n<ul>\n    <li>Shut down the virtual machine and make sure nothing is using the disk image!<\/li>\n    <li>Make a backup of the current image (cp imagefile.img imagefile.img_backup) in case anything goes awry<\/li>\n    <li>Make a blank file with dd of the size you want to add, e.g., dd if=\/dev\/zero of=10gig.img bs=1024 count=10000000 for a 10GB image. This may take a bit.<\/li>\n    <li>Append that to the end of your file, e.g., cat 10gig.img >> imagefile.img<\/li>\n    <li>&#8220;Mount&#8221; it as a loopback device: losetup \/dev\/loop0 imagefile.img<\/li>\n    <li>Run an fsck, which <strong>will<\/strong> find errors, since growing a filesystem this way is bizarre: e2fsck -f \/dev\/loop0<\/li>\n    <li>After that completes, resize the filesystem. This may take a while: resize2fs \/dev\/loop0<\/li>\n    <li>&#8220;Delete&#8221; the loopback device (think &#8220;unmount&#8221;): losetup -d \/dev\/loop0<\/li>\n    <li>Start your VM up, and it should now see 10GB extra space!<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve seen this a few other places and it didn&#8217;t quite work. Let&#8217;s say you download a half-gig barebones Linux VM to use with Xen. It runs great, but you want more than 500MB of disk space. Here&#8217;s exactly what &hellip; <a href=\"https:\/\/blogs.n1zyy.com\/n1zyy\/2009\/06\/26\/resizing-an-ext3-xen-disk-image\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2010","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/2010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/comments?post=2010"}],"version-history":[{"count":0,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/2010\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/media?parent=2010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/categories?post=2010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/tags?post=2010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}