Hello All,
I have an issue: i would like to clone a VM (Debian 9) while it is running.
Is it possible ?
My case:
I have no acess to this machine (root password is lost)
This VM holds production softwares and i am afraid that if i stop it (for cloning) not all services will reboot afterwards.
So i need to clone it, to try safely to find root password (with linux safe reboot techniques) without touching the main VM
Thanks for advices,
GG.
VM cloning when VM is ON
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: VM cloning when VM is ON
Practically speaking, no, you cannot clone a VM while it is running, at least not from the outside. Attempting that would leave potentially corrupted hard disk and config settings, and the guest OS in a crashed state if you're lucky.
Also, not a "Windows Hosts" question. I'll move this topic to "Using VirtualBox".
Also, not a "Windows Hosts" question. I'll move this topic to "Using VirtualBox".
-
- 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: VM cloning when VM is ON
You can simply copy the virtual disk image alone (in the Virtual Media Manager), create a new VM with the same settings as the existing VM, and attach the virtual disk image to it. The copied virtual disk image may have some file system corruption, but the guest OS can probably repair it.
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: VM cloning when VM is ON
Trying fth0's idea, I started an XP guest on a Windows 10 host, selected the running guest's disk file in Virtual Media Manager, and hit 'Copy', and got this:
However, I was successful copying the running disk in Explorer. I then shut down the guest and released, removed & kept the the old disk file from Virtual Media Manager. I then attached the live copy, and the guest started again just fine. A disk scan might happen one day, but the guest did boot from the Explorer-started copy. I don't know what other host OS's will do.Failed to create the virtual disk image storage F:\VirtualboxGuests\XP\XP_copy.vdi. Failed to lock source media 'F:\VirtualboxGuests\XP\XP.vdi'. Result Code: VBOX_E_INVALID_OBJECT_STATE (0x80BB0007) Component: MediumWrap Interface: IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}
Are you sure getting the existing root password is possible? There's plenty about resetting the root password, not so much about discovering what the old password was.gg75 wrote:try safely to find root password
Re: VM cloning when VM is ON
Thanks for your help !!
yes when i said "finding the password" i meant reseting it.
I tried to use the copy of the VDI and create a new VM on it. This VM starts well, i also managed to change passwords (by booting the GRUB in safemode..), but i have the feeling that when i tried to connect with the very user that is logged on the first VM, his session is corrupted on my copied VM. And i cant access this session.
I think the copy is in a unstable state for this very user which makes sens since it is the user who is logged while i copy the VDI, no?
GG.
yes when i said "finding the password" i meant reseting it.
I tried to use the copy of the VDI and create a new VM on it. This VM starts well, i also managed to change passwords (by booting the GRUB in safemode..), but i have the feeling that when i tried to connect with the very user that is logged on the first VM, his session is corrupted on my copied VM. And i cant access this session.
I think the copy is in a unstable state for this very user which makes sens since it is the user who is logged while i copy the VDI, no?
GG.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: VM cloning when VM is ON
I'll note that the OP asked about cloning the VM, not about cloning a disk. If you haven't addressed how it would cope with (say) live snapshots then you haven't answered the question asked.
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: VM cloning when VM is ON
You have an extremely excellent point there! No snapshots in my test guest...mpack wrote:If you haven't addressed how it would cope with (say) live snapshots then you haven't answered the question asked.