Wiping a virtual disk

Here you can provide suggestions on how to improve the product, website, etc.
Post Reply
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Wiping a virtual disk

Post by birdie »

Oftentimes I need to recreate a VM while starting with a blank virtual disk. Currently I either have to remove an old virtual disk and create a new one, or boot any live Linux CD and run dd if=/dev/zero of=/dev/sda which takes quite a lot of time.

Please consider this feature for the Virtual Media Manager.

Thank you.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Wiping a virtual disk

Post by mpack »

Hmm. This might be a rare occasion where a snapshot is actually useful. Snapshot the blank disk and revert to it whenever you want a blank disk again.

Personally I wouldn't do that. I'd just make a backup copy of the blank VDI and restore from that to wipe the disk.
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Wiping a virtual disk

Post by birdie »

mpack wrote:Hmm. This might be a rare occasion where a snapshot is actually useful. Snapshot the blank disk and revert to it whenever you want a blank disk again.

Personally I wouldn't do that. I'd just make a backup copy of the blank VDI and restore from that to wipe the disk.
Snapshots often break in various ways which is why I wouldn't want to use them for this particular use case.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Wiping a virtual disk

Post by mpack »

birdie wrote:Snapshots often break in various ways which is why I wouldn't want to use them for this particular use case.
Nobody would ever accuse me of being a snapshot fan (*). That is why my second paragraph offered an alternative.

(*) I wrote CloneVDI in order to avoid snapshots. At that time there was no mention of cloning in the VirtualBox UI.
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Wiping a virtual disk

Post by birdie »

mpack wrote:
birdie wrote:Snapshots often break in various ways which is why I wouldn't want to use them for this particular use case.
Nobody would ever accuse me of being a snapshot fan (*). That is why my second paragraph offered an alternative.

(*) I wrote CloneVDI in order to avoid snapshots. At that time there was no mention of cloning in the VirtualBox UI.
I still want to get this feature :roll:

It must be relatively easy to implement: a single button and a minimum amount of code.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Wiping a virtual disk

Post by scottgus1 »

One thing that the developers have said before (and I used to have a link to it but I lost the link file) is that the devs only have time (and not enough of it) to work on Oracle's paying customers' bugs & enhancements. Becoming an Oracle paying customer starts at either $1220 or $6100 US, depending on what a 'socket' is. Too rich for my wallet.

That said, the only way we freeloaders could get an enhancement is to have it coincide with what the paying customers want, have the devs fall so over the top in love with it that they can plant the idea in the minds of the paying customers to love it too so the devs can work on it, or code it ourselves. User code is considered for insertion.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Wiping a virtual disk

Post by fth0 »

birdie wrote:Oftentimes I need to recreate a VM while starting with a blank virtual disk. Currently I either have to remove an old virtual disk and create a new one, or boot any live Linux CD and run dd if=/dev/zero of=/dev/sda which takes quite a lot of time.
I must be missing something from your description, because to me it seems to be quite simple to do with the current Virtual Media Manager implementation. Consider the following workflow:

In the Virtual Media Manager, you create a dynamically allocated virtual disk as a copy template. This virtual disk will only use 2 MB of real disk space, and contain x GB of virtual sectors filled with zeros (in contrast to your dd result, if you don't compact that afterwards). Whenever you need a new blank virtual disk, you clone the copy template, and replace the old virtual disk file in the VM's configuration with it. What am I missing?
birdie
Posts: 428
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Wiping a virtual disk

Post by birdie »

scottgus1 wrote:One thing that the developers have said before (and I used to have a link to it but I lost the link file) is that the devs only have time (and not enough of it) to work on Oracle's paying customers' bugs & enhancements. Becoming an Oracle paying customer starts at either $1220 or $6100 US, depending on what a 'socket' is. Too rich for my wallet.

That said, the only way we freeloaders could get an enhancement is to have it coincide with what the paying customers want, have the devs fall so over the top in love with it that they can plant the idea in the minds of the paying customers to love it too so the devs can work on it, or code it ourselves. User code is considered for insertion.
Gotcha. In this case I kinda don't understand the rationale of the subforum existence :wink: Suggestions are welcome only to allow people to ... blow off steam? :lol:
fth0 wrote:I must be missing something from your description, because to me it seems to be quite simple to do with the current Virtual Media Manager implementation. Consider the following workflow:

In the Virtual Media Manager, you create a dynamically allocated virtual disk as a copy template. This virtual disk will only use 2 MB of real disk space, and contain x GB of virtual sectors filled with zeros (in contrast to your dd result, if you don't compact that afterwards). Whenever you need a new blank virtual disk, you clone the copy template, and replace the old virtual disk file in the VM's configuration with it. What am I missing?
That's a lot of steps (also error prone) vs a single button or a a single item in the right click mouse menu.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Wiping a virtual disk

Post by scottgus1 »

birdie wrote:blow off steam? :lol:
Partially. 8) It's also for discussing an idea or for finding out that there's an easy workaround. Or for finding out it won't go anywhere... :(

I can see how a quick 'reset disk' button could come in handy if one is doing a lot of reinstalling a guest OS that likes to do auto-partitioning.

I can also (fore)see a slew of forum posts:
Clueless User wrote:I hit the reset disk button and hit Reset and Erase All Data in the warning boxes and now my guest with the only copy of my extremely important files won't boot!
A possible workaround until a source code guru makes the button is to make a manual copy of the disk file (with the guest shut down) in the guest's folder. It would have the same UUID as the original disk but a different file name. If the first disk is deleted, the copy can be copied again then renamed to the original name, then the guest disk will be reset.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Wiping a virtual disk

Post by mpack »

scottgus1 wrote: A possible workaround until a source code guru makes the button is to make a manual copy of the disk file (with the guest shut down) in the guest's folder. It would have the same UUID as the original disk but a different file name. If the first disk is deleted, the copy can be copied again then renamed to the original name, then the guest disk will be reset.
Which was precisely my suggestion in paragraph 2 of my first reply. :)

Seriously, this is much more powerful than the suggested button. Instead of a special case "nuke em all" button, the copy can preserve any state that's useful to the user, or multiple states. It's what disk cloning was made for.
Post Reply