Nem Posted August 16, 2016 Share Posted August 16, 2016 Is it possible to clone a VM that has already been created, and have it behave completely independently of the original? Quote Link to comment
betaman Posted August 17, 2016 Share Posted August 17, 2016 Check out this thread: https://lime-technology.com/forum/index.php?topic=49104.0 Quote Link to comment
jonp Posted August 17, 2016 Share Posted August 17, 2016 If the VM is stored on a BTRFS-formatted device, you can use the cp command to create reflink copies which are essentially the best of snapshots and clones in a single method: cp --reflink /path/to/vdisk.img /path/to/snapshotorclone.img The only catch is that both the source and destination file must exist in the same BTRFS volume. This can be inside a btrfs pool or a single btrfs device. An example of an INVALID use of the command: cp --reflink /mnt/disk1/domains/domain1/domain1.img /mnt/disk2/domains/domain2/domain2.img This won't work even if both disk1 and disk2 are btrfs because they will be separate volumes. Also, you cannot use this command through the user share file system (/mnt/user). Instead, always path through the device itself (e.g. /mnt/disk or /mnt/cache). 1 Quote Link to comment
Nem Posted August 18, 2016 Author Share Posted August 18, 2016 I just tried that but its giving me an error: cp: failed to clone ‘/mnt/cache/VM/UbuntuNew/vdisk1.img’ from ‘/mnt/cache/VM/UbuntuBase/vdisk1.img’: Invalid argument What I ran was: cp --reflink /mnt/cache/VM/UbuntuBase/vdisk1.img /mnt/cache/VM/UbuntuNew/vdisk1.img Both source and destination are on my SSD, which is BTRFS formatted A file shows up at the destination but its size is 0, so at least the paths are correct Quote Link to comment
Javsay Posted December 11, 2016 Share Posted December 11, 2016 Figured out the soloution. Two things seem to create the problem you mentioned about invalid argument and 0KB. 1. If COW (Copy on Write) settings are disabled then this happens - this setting is in the share settings and you have to set it to "Auto" instead of "disabled" when creating the share 2. If you create your VM disk folders through the network/SAMBA I.e. You access it from my network places and you create subdirectories via that in Windows then try to cf reflink to there. The way around this is is, go to your VM, create a vdisk through the settings panel in a new folder of your choice, going via usershares to navigate to the folder of your choice.. Then delete the vdisk1.img and use the standard instructions posted above and being aware of not doing from 1 disk to another or going via user shares. This seems to do the trick, I'm new to UNRAID but that worked for me. Hope it helps! 1 Quote Link to comment
Javsay Posted December 18, 2017 Share Posted December 18, 2017 Also, figured out that you can only reflink to the exact same folder. So in the case of @Nem, if he had done the above, to not get the error he got, he would need to have done: cp --reflink /mnt/cache/VM/UbuntuBase/vdisk1.img /mnt/cache/VM/UbuntuBase/disk1.img You can then copy the image to another folder however you cannot reflink from e.g. UbuntuBase to UbuntuNew, it has to the same folder it appears. Quote Link to comment
sjohn Posted October 27, 2022 Share Posted October 27, 2022 I cloned a Debian VM and all I had to do was copy the vdisk and reinstall grub, filesystem included an efi partition 512MB and LVM2 vgroup with / /var /tmp /home. The main trick was getting past the yellow efi CLI. # Copy vdisk ssh unraid cd /mnt/disk1/domains cp -rp DebianTemplate/vdisk1.img NewMachineName # Double check the owner and permissions are the same as other VM's ls -ld *; ls -l */vdisk1.img # Use chown and chmod if owner and permissions don't match # Create a new VM called NewMachineName but leave startup ISO blank # If use vdisk location as automatic and the machine name is the same as the directory you copied to NewMachineName in this case # it will automagically show you the vdisk location correctly otherwise manually adjust the vdisk location. # Boot and you get the yellow efi shell menu # Type exit (if I recall correctly) to get another graphical boot system test menu it looks like a UEFI/BIOS # The last entry I think where you navigate the file system # Go to to EFI or efi # then debian # then select grub and it boots into grub # login as root user, open a terminal, and run update-grub # check where is the efi filesystem with lsblk # reinstall the grub to the efi paritition created on the original install in my case /devvda1 grub-install /dev/vda1 .. and it boots I would guess you could copy and Windows vdisk the same way and navigate the efi CLI to boot to windows and do a boot repair. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.