Most file systems support growing the filesystem. To grow a filesystem, you need to next and the end of your block device. Sometimes that is as easy as making your partition larger. If you are using a volume management solution, you can make your volume bigger. What if you are using qcow2 with xen? How do you make your virtual disk bigger?
I have searched around and the most common answer I come across is to covert the qcow2 virtual disk to a raw file, then grow the raw file. Those same people argue that I shouldn't use qcow2 anyways because raw files are much faster. To me, snapshot support is much more valuable than then modest performance gains of using raw files.
My first step was to give a second disk to the VM. For my gaming VM, I copied the games to the second disk without too many issues. I updated my backup script to snapshot this disk every week. For my other Widows VM, I added a disk but didn't add it to backup. That data isn't important to me.
I eventually found that newer versions of Qemu have a resize subcommand in qemu-img. I didn't know about it since Xen uses an older version of Qemu. I tried to use it but it won't work with images that have snapshots. I take weekly snapshots, so that is not going to work. I could use the convert subcommand to convert a snapshot to a standalone qcow2 image. Then, I could resize the image and start using it, but I haven't tried that yet.
For the future, I don't know what to do. One idea is to exploit the fact that qcow2 files do not preallocate disk space. I can create the disk as a 1TB disk, but only create a 40GB partition. If I need to "grow" my disk, then I make the partition bigger. The filesystem can grow to fill the new partition size. It is an ugly solution, but it should work.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.