给虚拟机的虚拟硬盘增加容量(vmdk file)

我使用虚拟机主要是为了使用Windows XP系统来访问网银、进行在线支付。当初安装时是用VMWare Player的,后来换成了VirtualBox 3。Windows XP越来越臃肿,虚拟机硬盘空间不够了。在网上搜索后找到了增加虚拟硬盘容量的方法:使用QEMNGParted,不用安装“庞大”的VMWare软件。特别说明一下最初创建虚拟硬盘时也是使用的QEMU工具。

具体步骤如下:
1. VMDK格式转成RAW格式

$ qemu-img convert -f vmdk winxp.vmdk -O raw winxp.raw

2. 新建一个RAW格式的文件,后面会用到

$ qemu-img create -f raw temp.img 512M

3. 用cat命令把temp.img多次追加到winxp.raw文件后,达到扩容的目的。

$ cat winxp.raw temp.img temp.img temp.img temp.img temp.img temp.img temp.img temp.img > winxp.img

4. 再转成原来的VMDK格式

$ qemu-img convert -f raw winxp.img -O vmdk winxp.vmdk

5. 用下载Gparted Live CD 的iso文件作为光盘启动虚拟机,可以看到硬盘物理空间已经变成了8G。修改硬盘上面的分区大小就行了,也可以创建新的分区。

参考:

http://www.cyberciti.biz/tips/howto-resize-vmware-virtual-harddisk-size.html#comments

http://qemu-forum.ipi.fi/viewtopic.php?t=846&highlight=

Leave a Reply

Your email address will not be published. Required fields are marked *

*

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.
For more help see http://daringfireball.net/projects/markdown/syntax

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>