Created
September 11, 2023 15:09
-
-
Save cleanerspam/0f1c37d501ea5b88b575c642251ff8f2 to your computer and use it in GitHub Desktop.
How to edit contents inside a Virtualbox windows.vdi and make a new vdi from the previous one ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all vdi cant be directly modified in an easy way on Linux | |
Lets suppose we have all our virtualbox files inside Virtaulbox folder in home directory | |
VBoxManage clonehd ~/Virtualbox/windows11/windows11.vdi output.img --format RAW | |
Above command will make a clone of your current vdi , remeber the output.img will have the fuoll size the windows11.vdi was allocated | |
now we have got a clone of windows11.vdi , in form of output.img | |
sudo losetup -P /dev/loop0 output.img | |
Above command will mount the output.img as loop device on /dev/loop0 | |
Now , open Dolphin file manager of KDE Plasma , on left sideview it will show an unmounted Partition mount it | |
Now you can see the contents of .vdi that was first changed to .img then it was mounted as loop device | |
Edit replace the files as needed | |
Now unmount the partition from dolphin using right click and if you get device busyt error it is because a terminal or some file is opened in the mounted directory | |
After unmount from dolphin is sucessfull run the command | |
sudo losetup -d /dev/loop0 | |
Above command will unmount the output.img from the loo[ device | |
VBoxManage convertfromraw --format VDI output.img windows11.vdi | |
This command will make an optimized vdi file from output.img | |
After that go in Virtualbox App settings and remove the windows11.vdi and in Filemanger chnage the name of windows11.vdi to windows11.vdi.original.backup | |
And move the newly created windows11.vdi to Virtualbox appropriate folder and from Virtualbox App reselect the windowds11.vdi as attached hard disk . | |
Now run the VirtualbMachine the vdi file should work as intended |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment