How do convert dynamic to static vdi?

This is for discussing general topics about how to use VirtualBox.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How do convert dynamic to static vdi?

Post by BillG »

The only way to ensure that disks are not fragmented is to never use them. If you actually use a disk, physical or virtual, fixed or dynamic,and change any of the data stored on it, it will fragment.
Bill
jmouriz
Posts: 1
Joined: 20. Jun 2011, 09:54
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: MSW32 XP & MSW32 7

Re: How do convert dynamic to static vdi?

Post by jmouriz »

juanma@ramona:~/.VirtualBox/HardDisks$ VBoxManage clonehd dynamic.vdi static.vdi --format VDI --variant Fixed
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: aec9cc2f-5879-43c5-988f-d042f42513f3
juanma@ramona:~/.VirtualBox/HardDisks$ ls -l
total 18301932032
-rw------- 1 juanma juanma 10737463296 2011-06-20 04:53 static.vdi
-rw------- 1 juanma juanma 7564468736 2011-06-20 04:42 dynamic.vdi
Russell
Posts: 4
Joined: 11. Jul 2011, 00:15
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: winxp

Re: How do convert dynamic to static vdi?

Post by Russell »

I have a problem

Code: Select all

suse111desktop:/media/sd_bkp_1000G_3 # VBoxManage clonehd winxp2003_new.vdi winxp2003_new_static.vdi --format VDI --variant Fixed
VBoxManage: error: Cannot register the hard disk '/media/sd_bkp_1000G_3/winxp2003_new.vdi' {7e0eda8a-47c3-4956-9128-3b86de67d16c} because a hard disk '/root/.VirtualBox/HardDisks/winxp2003.vdi' with UUID {7e0eda8a-47c3-4956-9128-3b86de67d16c} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, pMedium.asOutParam())" at line 209 of file VBoxManageDisk.cpp
suse111desktop:/media/sd_bkp_1000G_3 #

stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: How do convert dynamic to static vdi?

Post by stefan.becker »

Have you read and checked the error message?
Russell
Posts: 4
Joined: 11. Jul 2011, 00:15
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: winxp

Re: How do convert dynamic to static vdi?

Post by Russell »

stefan.becker wrote:Have you read and checked the error message?
I don't know how to check it.
What file should I read?
I don't know what it means.



TY
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: How do convert dynamic to static vdi?

Post by stefan.becker »

... because a hard disk '/root/.VirtualBox/HardDisks/winxp2003.vdi' with UUID {...} already exists ...
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How do convert dynamic to static vdi?

Post by Sasquatch »

Just to point it out more noticeable:
VBoxManage clonehd winxp2003_new.vdi
VBoxManage: error: Cannot register the hard disk '/media/sd_bkp_1000G_3/winxp2003_new.vdi' because a hard disk '/root/.VirtualBox/HardDisks/winxp2003.vdi' already exists.
See the problem? You have a VDI with that UUID already, but it has a different name.

In addition, why are you running VB as root in the first place? If that's your default user, then why the hell are you running Linux as root all the time? You should run everything as normal user, unless you are too familiar with Windows and it's default to running things as admin all the time (and applications that nag you when you don't run them with admin privs). Linux is made to run as unprivileged user.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Russell
Posts: 4
Joined: 11. Jul 2011, 00:15
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: winxp

Re: How do convert dynamic to static vdi?

Post by Russell »

stefan.becker wrote:... because a hard disk '/root/.VirtualBox/HardDisks/winxp2003.vdi' with UUID {...} already exists ...
Now it is working

I had a virtual HD
/root/.VirtualBox/HardDisks/winxp2003.vdi

I simply moved it in /media/sd_bkp_1000G_3/ and renamed it winxp2003_new.vdi,
Left the directory /root/.VirtualBox/HardDisks empty.

I solved the problem, removing/detaching winxp2003.vdi in the vbox manager (gui)
Last edited by Russell on 11. Jul 2011, 22:37, edited 1 time in total.
Russell
Posts: 4
Joined: 11. Jul 2011, 00:15
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: winxp

Re: How do convert dynamic to static vdi?

Post by Russell »

Sasquatch wrote: In addition, why are you running VB as root in the first place? If that's your default user, then why the hell are you running Linux as root all the time? You should run everything as normal user, unless you are too familiar with Windows and it's default to running things as admin all the time (and applications that nag you when you don't run them with admin privs). Linux is made to run as unprivileged user.
I usually use linux as root, since some years.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How do convert dynamic to static vdi?

Post by Sasquatch »

Sounds harsh, but I hope you crash your system soon and learn that you should run as unprivileged user. Linux is not Windows, running as root all the time is very dangerous and even Linux veterans don't run as root unless they want to play Russian Roulette with their system.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
paradxum
Posts: 1
Joined: 21. Jul 2011, 04:48
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: WinXP, Win7, WinSvr2008, Solaris, MacOS, Linux(various flavors)

Re: How do convert dynamic to static vdi?

Post by paradxum »

So this kinda drove me nuts. This is the first google result and doesn't really give an answer so:

Step one: Disconnect from any VM's it's connected to
VBoxManage modifyvm WinXP --hda none

Step two: Remove the disk from the media registry
VBoxManage closemedium disk /path/to/disk.vdi

Step three: Clone the Disk (with the clone set as a fixed type)
VBoxManage clonehd disk1.vdi disk1a.vdi --format VDI --variant Fixed

Step four: Connect the new disk to the VM (automagically registeres the disk)
VBoxManage modifyvm WinXP --hda /path/to/disk1a.vdi
Post Reply