Tagged: virtualbox Toggle Comment Threads | Keyboard Shortcuts

  • BrainwreckedTech 4:11 pm on January 8, 2012 Permalink | Reply
    Tags: dynamic, fixed, , , , vboxmanage, vdi, virtualbox,   

    HOWTO: Convert VDIs Between Fixed-Sized and Dynamic In VirtualBox 

    Virtualbox Logo While there is no way to actually switch a VDI between fixed-size and dynamic, you can clone the existing VDI into a new one with different settings with VBoxManage.

    VBoxManage clonehd [old-VDI] [new-VDI] --variant Standard
    VBoxManage clonehd [old-VDI] [new-VDI] --variant Fixed

    If you want to expand the capacity of a VDI, you can do so with

    VBoxManage modifyhd [VDI] --resize [megabytes]

    Resizing only works for dynamic VDI images. However, you can combine the resize information with the conversion information to expand fixed-size VDIs. (E.g., convert a fixed-size image to dynamic, expand it, and then convert the dynamic image back to a fixed-size image.)

    If you want to compact the image as much a possibly, be sure to zero out the free space. This can be done in Linux by using the dd command to write endless zeros to a file and then deleting that file. (With the caveat of the reserved space of EXT and other file systems.)

     
    • Jeff Kroll 11:47 am on January 11, 2012 Permalink | Reply

      Thanks for the info. One question: does the word following “-variant” essentially tell VBoxManage what is getting changed to what, i.e. putting “Standard” after “-variant” tells it that it’s changing a fixed to a dynamic?

      • BrainwreckedTech 12:36 pm on January 13, 2012 Permalink | Reply

        It only specifies what the new –variant type is going to be. Standard = dynamic.

    • Jeff Kroll 2:56 pm on January 13, 2012 Permalink | Reply

      Got it. Thanks.

    • Juliano 9:45 pm on January 22, 2012 Permalink | Reply

      Please help me with this:

      I am entering this on Terminal:

      VBoxManage clonehd [ /Users/JulianoCB/VirtualBox\ VMs/Windows\ XP\ SP3\ Clone/Windows\ XP\ SP3\ Clone.vdi][new.vdi] -variant Standard

      But then I get this error:

      VBoxManage: error: Could not find file for the medium ‘/Users/JulianoCB/[‘ (VERR_FILE_NOT_FOUND)
      VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium, callee nsISupports
      Context: “OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())” at line 210 of file VBoxManageDisk.cpp

      Could not find the file but I droped from finder.

      How could I fix this??
      I am not very familiar with Terminal…

      • BrainwreckedTech 11:26 pm on January 27, 2012 Permalink | Reply

        First off, leave off the [ and the ] as those are used to indicate variables. They’re used in documentation of command line programs (DOS/Windows/Linux/Unix) as they’re aren’t very many formatting options available on the command line.

        Second, with the surrounding white space, the [ is being interpreted as a relative file name. I take it you were in your home directory /Users/JulianoCB when you attempted to execute this command, hence /Users/JulianoCB/[ cannot be found.

        Lastly, and pre-emptively, make sure you are using a double dash when using --variant. WordPress tries to be helpful and interprets -- as — unless it occurs in monospace text (pre, tt, code, etc.).

    • Jeff Kroll 10:47 am on February 20, 2012 Permalink | Reply

      One of the reasons I was so glad to find your instructions was due to a problem with a vdi that I was–and still am, sigh–experiencing. I originally created a fixed XP vdi. Later I changed it to a dynamic one and I remember it adjusting it itself, make itself bigger, automatically. But something must have changed and for months it has remained as it is today, never growing bigger.

      Via the Virtual Media Manager, I can see that the virtual size of the hd is 48.83 and the actual size is 9.99 gb. Inside Windows, properties of the C drive indicate it is just under 10, but it always stays there. I can’t install any new software & I regularly get alerts about a space problem.

      I decided to use the process you detail above to clone a copy back into a fixed size. It worked and in the Virtual Media Manager it is listed as virtual size 48.83 and the actual size is listed as the same. Yet upon opening, the properties of the C drive are listed the same as the non-working dynamic version, i.e., about a 10 gig drive!? Despite changing the clone from dynamic to fixed, apparently the problem got cloned over.

      Any guesses on what is wrong or a way for me to fix it (hopefully without having to install a new XP system from scratch, with all its time consuming updates)?

      • BrainwreckedTech 3:50 pm on February 22, 2012 Permalink | Reply

        Did you change the partition table after making the virtual disk bigger? If not, it’s the partition table limiting you to the old 10GB size, not Windows. You say you checked the properties of the C: drive, but this would have been a lot clearer if you used Disk Manager instead.

        I wouldn’t use Windows’ Disk Manager to change the partition size, though. Find a good Linux live CD and use parted or fdisk instead. That way you can be sure that the only thing you change is the end boundary of the partition that holds Windows’ C: drive.

        Also be sure to run chkdsk /r /f after changing the size of any disk Windows has access to.

        • Jeff Kroll 6:50 pm on February 22, 2012 Permalink | Reply

          I have gparted. As far as I can see, there is no separate partition for Windows. The VM is just part of my Mint partition, I think, and that’s got plenty of space, about 142 gigs. In detail sda1 is Ubuntu 10 (that I never use), sda2 says extended, sda6 is Mint, sda7 is a swap and sda5 is a swap. Could send the screenshot showing that, if needed.

          • BrainwreckedTech 11:16 am on February 25, 2012 Permalink | Reply

            It sounds like you’re talking about the partitions on “metal” aka your actual machine. What I meant was to check to your partitions inside your virtual machine. When you clone/expand a virtual disk, all data is kept in tact including partition table data inside the MBR of the virtual disk.

            • Jeff Kroll 5:16 pm on February 25, 2012 Permalink | Reply

              Thanks for the clarification. I’ll check into that!

    • Jeff Kroll 5:45 pm on March 5, 2012 Permalink | Reply

      Ok, I researched how to use the .iso version of gparted-live to boot into my virtual xp & after a few tries I successfully re-sized the xp drive from 10 gigs to its full 50. Upon booting normally into my virtual xp I checked the C: drive and. lo & behold, the full 50 was recognized! Thanks for the guidance & patience.

    • Aldous 4:08 am on July 11, 2012 Permalink | Reply

      I have followed your instructions, but cannot now make VirtualBox recognise the new .vdi file.
      When I go to ‘virtual media manager’ it does not show up. Any ideas about how I can use this new .vdi file? I’ve checked in the vbox manual, but found nothing useful.
      Thanks

      • BrainwreckedTech 5:44 pm on July 21, 2012 Permalink | Reply

        You have to add the VDI to a VM before it’ll show up in the Virtual Media Manager.

        I feel your pain on this one. VirtualBox can’t seem to balance intuition and ease-of-use. It doesn’t help that VB3 used to have an Add option.

    • Jorge 1:16 pm on August 6, 2012 Permalink | Reply

      Please help. I followed the discussions with great interest because I had the first problem here reported. I have a Windows host and an Ubuntu guest. So I followed the “clonehd” and “resize” procedures and got a new bigger vdi. I then changed the HD specs in the VM to set the SATA controller to the new vdi. However when I run the VM I got the following error: VBOX_E_INVALID_OBJECT_STATE (0x80BB0007). Thanks in advance.

    • Gilesaj 12:16 am on November 4, 2012 Permalink | Reply

      I have created a clone using your directions and I tried tp resized the disk but got an error to say it could not do that type. I assume that the conversion from fixed to standard did not work ??

      C:\Program Files\Oracle\VirtualBox>VBoxManage clonehd “C:\Users\giles\VirtualBox
      VMs\WEB_SERVER_CENTOS6_Clone\WEB_SERVER_CENTOS6_Clone.vdi” “C:\Users\giles\Vir
      tualBox VMs\CENTOS6_WEB_SERVER\CENTOS6_WEB_SERVER.vdi” –variant Standard
      0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%
      Clone hard disk created in format ‘VDI’. UUID: 56835b5d-f6fd-4a6b-99cc-993e976cf
      a0e

      C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd “C:\Users\giles\VirtualBox VMs\CENTOS6_WEB_SERVER\CENTOS6_WEB_SERVER.vdi” –resize 40
      0%…
      Progress state: VBOX_E_NOT_SUPPORTED
      VBoxManage.exe: error: Resize hard disk operation for this format is not impleme
      nted yet!

      • Gilesaj 8:27 pm on November 4, 2012 Permalink | Reply

        I see where I went wrong. It worked just fine I put in 40 for 40 Gig when I should have entered 40960 mb. It is increasing the size of the disk as I type.

        Thanks for the article it helped me out of a tight spot.

    • Manne 5:06 pm on December 22, 2012 Permalink | Reply

      nice how-to for changing fixed size discs to dynamically in virtualbox.

      thx

      helped me a lot, im running vbox on a qnap NAS server. so every thing is a bit difficult due to the f****g QNAP kernel

    • x2es 10:38 am on February 4, 2013 Permalink | Reply

      How to do with snapshots tree created from VDI which should be converted?
      Before I found this HOWTO I has compact my fixed VDI with –compact option. Now all works fine – which problems may appears?

      • BrainwreckedTech 8:45 pm on February 6, 2013 Permalink | Reply

        Cloning will not keep the snapshot tree in tact. You can use clonehd on a snapshot, with the result being a VDI with no snapshots itself, but still a clone of the entire hard drive state you selected.

        Snapshots are stored as “diffs” with a UUID for the file name. You can use the GUI to find what the UUID is for the snapshot you want to clone from.

    • Anonymous 3:27 am on April 4, 2013 Permalink | Reply

      Really nice! I found out that it is a huge waste with fixed storage when storing the image on an SSD. Better go dynamic then…

    • Jao 12:53 am on May 21, 2013 Permalink | Reply

      I encounter also this problem and only works in VDI format HD the vmdk format will through the same error, I guess the same HD format like VHD..only works on vdi and i confirm it..

    • Miguel 11:55 am on June 3, 2013 Permalink | Reply

      When i execute the command it just consume space in my hd but doesn’t do anything.

      /mnt/space$ sudo vboxmanage clonehd /var/ford/Developer.vdi developer.dvi –variant Fixed
      0%…

    • John 2:36 pm on September 25, 2013 Permalink | Reply

      Worked for me, vbox 4.2.18, Windows 7 x64 host with Ubuntu 12.04 VM. Using initially fixed VDI, from instructions above, ran:

      VBoxManage clonehd [old-VDI] [new-VDI] –variant Standard
      VBoxManage modifyhd [VDI] –resize [megabytes]

      Created a new VM in vbox and specified to use the existing, newly resized VDI disk (probably could have just removed the existing disk in the media manager and then specified the new disk). Next, downloaded a gparted Live ISO (search in google for this, I didn’t have any problems finding it), booted the VM using the gparted ISO. Then moved my swap partition to the end of the new disk using instructions in this forum:

      http://superuser.com/questions/100379/how-to-move-a-partition-to-the-end-in-gparted

      (Ignored the warning message about corrupting the boot sector because the OS does not boot from the swap space), then resized the primary partition in gparted. Rebooted the VM, and voila, a bigger hard disk.

      Thanks a million!

  • BrainwreckedTech 8:40 am on April 20, 2010 Permalink | Reply
    Tags: , oracle, qemu, , , sonic cd, vbemp, virtual machine, virtualbox, , , windows 95, windows 98   

    QEMU Vs. VirtualBox, Round 1 

    Goal

    Play Sonic CD in a VM. Sonic CD is a very old 2D game that only runs in Windows 9x clients without the Sonic CD PC Fix patch. It was originally an OEM-only pack-in that was written in Intel’s DirectScreen API. Later, the game went retail and the DirectScreen calls were re-mapped to DirectX.

    Things Neither Emulator Can Do Yet:

    Neither emulator can play CD audio tracks. No music for you!

    (More …)

     
    • mmj 8:06 pm on October 25, 2010 Permalink | Reply

      How would something like this fare in Wine?

    • Super-Oli 2:12 pm on February 9, 2013 Permalink | Reply

      Thanks a lot for the splash-screen hint!!!

    • matt_ 7:36 pm on March 7, 2014 Permalink | Reply

      If the program ran, it would run at near native or native speeds (or sometimes even faster believe it or not).

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Follow

Get every new post delivered to your Inbox.

Join 41 other followers