CloneVDI tool - Discussion & Support

Discussions related to using VirtualBox on Windows hosts.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: CloneVDI tool - Discussion & Support

Post by mpack »

The Partition Info shows one relatively small (0.5MB) FAT32 partition, and a large partition that it identifies as "Linux Swap". Probably CloneVDI considers everything in a swap partition as discardable.

If this is an LVM partition manager layout: CloneVDI doesn't support LVM.

CloneVDI doesn't support extended/logical MBR partitions either. This is only maybe the second time I've seen them being used since I created CloneVDI. This feature was created back in a very peculiar time period - maybe it lasted a year or so - when disks had grown large, but the ability of DOS to manage those sizes had not kept up. So to get around the DOS size limit you could add more partitions, but MBR had a limit of four. So the hack was to define a new partition type of "extended", and inside of that you create a secondary MBR containing four more "logical partitions" nested inside the extended partition.

I have no idea why you would be using the logical partitions hack when you have less than four partitions, or why you would use it at all when you aren't limited by that old version of DOS. It's possible that LVM uses this hack for some reason - I don't see LVM being used a lot.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: CloneVDI tool - Discussion & Support

Post by mpack »

p.s. I note that your symptoms are very similar to "AlsoBort" from just a few posts up. But he said that he is using encryption.

p.p.s. You don't need CloneVDI to make backups - in fact clones are not good backups, because a good backup preserves a working state, it does not change that state as a clone does. To back up a VM simply copy the VM folder to secondary storage. No additional tools are needed.
TDIT
Posts: 21
Joined: 21. Feb 2016, 16:45

Re: CloneVDI tool - Discussion & Support

Post by TDIT »

Hi all,

Using CloneVDI version 4.01 on a Windows 10 host. Receiving "Got OS Error 23 when reading from source disc" after 1%.

Can anyone advise what this error is referring to?

The VDI file is a windows install, bootable and okay.

Drive VDI file is on is a Samsung EVO SSD. Lots of free space (5 times vdi size). No errors on it and no errors in VDI file structure itself, So not sure where the issue may be.

Cheers
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: CloneVDI tool - Discussion & Support

Post by mpack »

Windows error 23 means a CRC error on the drive, that is a low level hardware error.

If you doubt the error then you can copying the VDI yourself outside of CloneVDI. In fact it would be really great if you can get that VDI onto another drive, because currently it looks like you may have lost it (*).

You can also try enabling the compaction option: if you're very lucky the error will be on an unused part of the image and CloneVDI will skip over it.

(*) There are tools available that will copy files, ignoring errors. This may be your last resort - you'd have to accept whatever data losses result.

Finally, if you still have access to an original VDI that was copied onto the SSD then that would be best of all.
Leloup78
Posts: 188
Joined: 21. Oct 2017, 15:13

Re: CloneVDI tool - Discussion & Support

Post by Leloup78 »

Bonjour,
Goal: Free the excess memory occupied by the VM.
Host: Win10 on SSD
Guest: Linux
VirtualBox release: 7.0.12


Initial state of the VM
VM_intial_state.png
VM_intial_state.png (52.5 KiB) Viewed 134629 times
Expected VM status
VM_expecting_state.png
VM_expecting_state.png (42.96 KiB) Viewed 134629 times
So, 13.72Gio reduction is expecting.
My attempts
First attempt:
From Guest:
The first step in resolving this error is to stop any processes that are writing to the disk.
service rsyslog stop
systemctl stop systemd-journald.socket
systemctl stop systemd-journald.service

Disable Swap Partitions
swapon -s

if enabled swap partitions:
sudo swapoff -a

remount the partition as read-only.
mount -n -o remount,ro -t ext2 /dev/sda2 /
(mount -n -o remount,ro -t ext2 /dev/sda2 /mnt)
zerofree -v /dev/sda2
fstrim -v /
(fstrim -v /mnt)
halt

From Host:
C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifymedium disk "Linux Mint 21.1 Xfce Clone3-disk1.vdi" --compact
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Result is : /dev/sda still 62.72Gio. No reduction.

Second attempt: CloneVDI tool
CloneVDITool.png
CloneVDITool.png (11.25 KiB) Viewed 134629 times
Result is : 30.72Mio reduction only.
What did I miss? what I didn't understand? Do, you have any idea?
Regards,
Leloup
Leloup78
Posts: 188
Joined: 21. Oct 2017, 15:13

Re: CloneVDI tool - Discussion & Support

Post by Leloup78 »

I tried the Clone VDI tool for two VM. So, picture above is for the second VM. Sorry for confusion.
Otherwise, whatever VM, result is the same.
Tki2000
Posts: 5
Joined: 11. Jun 2007, 23:21

Re: CloneVDI tool - Discussion & Support

Post by Tki2000 »

As the release notes state, CloneVDI does not support lvm partitioning.
You have a lvm partitioning scheme, so it cannot compress anything inside the image because it cannot read anything in that format.
I never use lvm partitioning. I use plain partitioning inside a VM and ext4 filesystem so I always get the images compressed Ok.
Tki2000
Posts: 5
Joined: 11. Jun 2007, 23:21

Re: CloneVDI tool - Discussion & Support

Post by Tki2000 »

mpack. Is there any possibility to support lvm partition scheme in CloneVDI?

Right now, if I want the VM images to compress I have to do a manual partition installation with MBR/GPT and ext4.
I have no problem with that, the VM in enclosed on a properly dimensioned file and won't grow up, but many automatic installers do lvm partitions. I do not like them as I see them fragile as a logical partition in Windows, but should help with many Linux/FreeBSD VM images.

Will you take the challenge? As LVM can cross the physical disk boundary it is not easy, I know... Perhaps for single disks...
Tki2000
Posts: 5
Joined: 11. Jun 2007, 23:21

Re: CloneVDI tool - Discussion & Support

Post by Tki2000 »

Very sorry.
I just realized that mpack is no longer with us.
I will miss him a lot.

viewtopic.php?t=110912
ShamballaJones
Posts: 1
Joined: 23. Mar 2025, 16:32
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Window 11, Windows 10, Xubuntu

Re: CloneVDI tool - Discussion & Support

Post by ShamballaJones »

An excellent utility tool! Simple to use, effective and solidly made. Many thanks!

CloneVDI ran faultlessly on Linux (Kubuntu 24.10) via Wine and the Q4Wine GUI (I'd previously installed some of the standard WIne packages from the repository, presumably including the Win32 support.)

Using it, I was able to shrink a seriously bloated Windows 11 VM back down to a sensible size: from around 200GB down to around 30GB, and 17GB as an OVA. I also shrank the VDIs for several Linux VMs by around 1/3.

CloneVDI is able to shrink both a VM's vdi file and the VDI files of it's accompanying snapshots. When attempting to start the resulting shrunken VM, however, VB complains of mismatched UUIDs in the snapshot files (even with the 'keep UUID' option enabled in CloneVDI). At that point, I considered updating the VB metadata file to reference the new UUIDs but decided that was too likely to result in a pear-shaped situation.

FWIW, the method that worked for me was to clone the VM, thereby coalescing the snapshots into the clone's single VM vdi file, then using CloneVDI to shrink that single file. This method is simple, effective and reasonably quick, and leaves the original VM unaltered.

Again, many thanks for this utility. Maybe VB should adopt it as an official part of the toolkit?
Not tense, Just terribly alert....
PNO3
Posts: 1
Joined: 16. Apr 2025, 19:57

Re: CloneVDI tool - Discussion & Support

Post by PNO3 »

Hi everyone,

I just started using VB a couple of weeks ago and am new to this tool. I was able to set up a VM even managed to turn my existing windows 10 PC into a VM to test, (not a real accomplishment but I'm happy I was able to figure it out). Unfortunately however even though the windows file system is only 80GB, the physical size of the VDI is now over 500GB. I did some digging and was pointed to this tool as the least painful method to compact the image, but when I try to run it on my VDI the validation results are shown in red as "source file is not a recognized VDI file format". For the heck of it I ran it anyway and got no errors, but when I try to mount in VB I get an error say that the UUID already exists. I specifically kept the "Generate new UUID" box checked. Is there a way to fix this?
Dazur09
Posts: 16
Joined: 15. Nov 2018, 18:55
Primary OS: MS Windows 11
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 11, Windows 10, Windows 7
Location: Switzerland

Re: CloneVDI tool - Discussion & Support

Post by Dazur09 »

Hi,
Do I see it right you didn't get a response since April?
I use this tool from time to time, very handy! Since recently I also get that warning of "source file is not a recognized VDI file format". When clicking "Repair" then comes an intimidating warning, but as you write also, no problem when continuing.
I'm not sure how you want to use the shrinking, I select "Keep old UUID" and "Compact drive while copying", and then when the cloning is done, I copy the name of the old disk (Source), delete it and rename the clone (Destination) with the old disk name. So the UUID is the same and the name as well, just the disk size is now shrinked.
m2i
Posts: 9
Joined: 2. Nov 2017, 18:57
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7, Windows 10

Re: CloneVDI tool - Discussion & Support

Post by m2i »

Tki2000 wrote: 26. Jan 2024, 09:24 Very sorry.
I just realized that mpack is no longer with us.
I will miss him a lot.

viewtopic.php?t=110912
Post Reply