Split VirtualBox VM disk images

Problem: I have a laptop with opensolaris installed. I have a portable hard disk with FAT32 which I used to store media so that I can use it in Solaris/Linux/Windows. I want to store OS images (to run them as VMs using VirtualBox ) which generally are >4G and FAT32 cannot have a single file exceeding this size.

One way to get around this was to zip them which reduces the size drastically to <=4G and hence be stored on the USB disk. This way I would have to unzip it, save somewhere to use it, zip it back when done and store the updated one. This was cumbersome and time consuming.

Recently, while running through the help output of VBoxManage, I noticed that VBoxManage's createhd takes a --variant option which can take Split2G as option!

$ VBoxManage createhd
VirtualBox Command Line Management Interface Version 3.1.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Usage:

VBoxManage createhd         --filename <filename>
                            --size <megabytes>
                            [--format VDI|VMDK|VHD] (default: VDI)
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--type normal|writethrough] (default: normal)
                            [--comment <comment>]
                            [--remember]

I didn't notice this before. I knew something like this was available for VMWare. Then I thought I would give this a try:

So, I created a new 10G hard disk image using VBoxManage,

VBoxManage createhd --filename /space/vdis/ubuntu9.10.vmdk --size 10000 --format VMDK --variant Split2G -remember
VirtualBox Command Line Management Interface Version 3.1.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Disk image created. UUID: f96d6fd9-a9b4-4383-8429-8c794d48370a

And what you get is: 

ls -1 /space/vdis/ubuntu9.10\*
/space/vdis/ubuntu9.10-s001.vmdk
/space/vdis/ubuntu9.10-s002.vmdk
/space/vdis/ubuntu9.10-s003.vmdk
/space/vdis/ubuntu9.10-s004.vmdk
/space/vdis/ubuntu9.10-s005.vmdk
/space/vdis/ubuntu9.10.vmdk

The disk image file is broken into 2G individual pieces, which can now be stored on FAT32. The image to use inside VirtualBox would be /space/vdis/ubuntu9.10.vmdk

Note that the Split2G variant seems to only work with --format VMDK, probably to be compatible with VMWare VMDK images. It doesn't seem to work with the VDI format.

The next part was to convert my existing disk images to this variant so that I can happily store them on my USB disk. This way, I can run VMs from the disk images directly!

To convert the existing disk images to this format,

  • I had to create another disk (with Split2G variant)
  • attach this disk as the secondary disk to the existing VM (with the old VDI as the primary)
  • use gparted or any partition manager, and make a copy of the older disk onto the new one.

P.S: sometimes one would need to setup the boot loader to find this new disk, and/or make the partition active before booting from it.

And you should be done!

Comments:

Thanks, I didn't realize that was an option either. My external drive is actually formated for ntfs, so can store the full 16GB VDI. But I'm sure it will come in handy at some point.

I'm curious why you don't format your external drive to ntfs, especially if you ever want to keep large videos in AVI format on it (another use for my external drive).

Posted by Alan Steinberg on January 29, 2010 at 03:03 PM IST #

Thanks for posting this very useful info.

A couple of comments:

1. My experience is, ntfs-3g is quite slow (even relative to vfat/FAT32) in Solaris, is this the reason you want to use FAT32 instead of ntfs?

2. Have you tried to use the zfs compression option to create your Solaris vdi?

Posted by W. Wayne Liauh on January 29, 2010 at 04:18 PM IST #

Alan, I wanted to use my external drive (out of the box!) with my existing OS installations, esp. Solaris, apart from Linux and Windows. Hence preferred FAT32 over NTFS.
Solaris FAT32 (pcfs) support is much more stable vs the NTFS support, via ntfs-3g (FUSE).
Yes ZFS compression does help reduce on-disk usage, but I need to finally store the VDI on a FAT32 disk!

Posted by Ravi Chandra Nallan on February 09, 2010 at 09:36 AM IST #

Just an idea, what if you used the command: >vboxmanage clonehd hd1.vdi hd2.vmdk --format VMDK --variant Split2G --type normal --remember

Posted by Aaron on June 24, 2010 at 08:31 AM IST #

Aaron, you are daemn right!

Posted by jose on September 03, 2010 at 08:48 PM IST #

I guess it is more suitable to use the clone method, to convert your VDI to a new disk, instead of breaking the partitions

Posted by Jan on November 04, 2010 at 09:10 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

ravee

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today