Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Clone VM, including vdisk, to new name - without modifying original

Featured Replies

 

Is it possible to clone a VM including its vdisk, resulting in 2 distinct, independent, but otherwise identical copies of the VM?

 

Maybe I'm misunderstanding the UI, so any additional info would be greatly appreciated. This is what I'm seeing/doing...

 

With the VM stopped, I select the clone option and then a window pops up asking for name and a couple of options:

 

image.png.e192dd0badd26d5c26ba83d2ec4e3061.png

 

I don't know if the "overwrite" option means to overwrite the original (doesn't make sense) or whether to overwrite any other clone with the same name I'm providing here (what I expect)

 

image.png.4e81ab83846acdfcf57bc07b8db67ba4.png

 

Either way, I deselect the overwrite option and then press the clone button - I have no clones at this point on the system. The result I get is the following error:

 

image.png.b445d3abcb503824de7c5763760a363a.png

 

New image file name exists. What image filename? At this point I don't know what's going on, because I don't have any clones, nothing with the clone name I just specified. It would be easier to understand if the filename it thinks already exists was displayed in the error.

 

Can anyone shed some light here?

 

 

Edited by Espressomatic

Solved by SimonF

  • Community Expert
3 minutes ago, Espressomatic said:

 

Is it possible to clone a VM including its vdisk, resulting in 2 distinct, independent, but otherwise identical copies of the VM?

 

Maybe I'm misunderstanding the UI, so any additional info would be greatly appreciated. This is what I'm seeing/doing...

 

With the VM stopped, I select the clone option and then a window pops up asking for name and a couple of options:

 

image.png.e192dd0badd26d5c26ba83d2ec4e3061.png

 

I don't know if the "overwrite" option means to overwrite the original (doesn't make sense) or whether to overwrite any other clone with the same name I'm providing here (what I expect)

 

image.png.4e81ab83846acdfcf57bc07b8db67ba4.png

 

Either way, I deselect the overwrite option and then press the clone button - I have no clones at this point on the system. The result I get is the following error:

 

image.png.b445d3abcb503824de7c5763760a363a.png

 

New image file name exists. What image filename? At this point I don't know what's going on, because I don't have any clones, nothing with the clone name I just specified. It would be easier to understand it the filename it thinks already exists was displayed in the error.

 

Can anyone shed some light here?

 

 

Which version are you running? Overwrite will overwrite and image file in the destination location if it exists.

 

  • Author

At the moment, 7.0.0beta2 as I just rolled back to it from beta3 to test something else.

 

I'm waiting on a reboot to get back to beta3 but can't do that right now as I need to wait for the wife who's on a video meeting. This system is dedicated as my edge router :)

 

 

6 minutes ago, SimonF said:

Which version are you running? Overwrite will overwrite and image file in the destination location if it exists.

 

 

Destination being the new name I enter in the clone window right?  So there is no existing clone with that name and I'd expect not to get that error.

 

My VM storage path is a ZFS dataset.  /mnt/nvme_pool/vm_hosts/XXXXX/ - where XXXXX is the folder for each VM.

 

After starting the clone process above, I end up with a new dataset (XXXX-newname) for each clone I attempt to create. Each path is empty after the error.

 

 

 

 

 

Edited by Espressomatic

  • Community Expert
15 minutes ago, Espressomatic said:

At the moment, 7.0.0beta2 as I just rolled back to it from beta3 to test something else.

 

I'm waiting on a reboot to get back to beta3 but can't do that right now as I need to wait for the wife who's on a video meeting. This system is dedicated as my edge router :)

 

 

 

Destination being the new name I enter in the clone window right?  So there is no existing clone with that name and I'd expect not to get that error.

 

My VM storage path is a ZFS dataset.  /mnt/nvme_pool/vm_hosts/XXXXX/ - where XXXXX is the folder for each VM.

 

After starting the clone process above, I end up with a new dataset (XXXX-newname) for each clone I attempt to create. Each path is empty after the error.

 

 

 

 

 

Does the XML have volumes in a different path? can you post XML? Beta4 is due soon

  • Author

Here's the XML for the VM

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='3'>
  <name>pfSense Firewall</name>
  <uuid>c1a5ff0a-7bcc-d017-ecff-7d7c616a6361</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="FreeBSD" icon="pfSense2.png" os="freebsd" webui="" storage="default"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='4'/>
    <vcpupin vcpu='2' cpuset='8'/>
    <vcpupin vcpu='3' cpuset='9'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-9.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/c1a5ff0a-7bcc-d017-ecff-7d7c616a6361_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' clusters='1' cores='2' threads='2'/>
    <cache mode='passthrough'/>
  </cpu>
  <clock offset='utc'>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='no'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/mnt/nvme_pool/vm_hosts/pfSense_Router/vdisk1.qcow2' index='1'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <serial>pfsense</serial>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xb'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xd'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:62:24:28'/>
      <source bridge='br4'/>
      <target dev='vnet4'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:62:24:30'/>
      <source bridge='br5'/>
      <target dev='vnet5'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/run/libvirt/qemu/channel/3-pfSense Firewall/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='qemu-vdagent'>
      <source>
        <clipboard copypaste='yes'/>
        <mouse mode='client'/>
      </source>
      <target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' sharePolicy='ignore'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </video>
    <watchdog model='itco' action='reset'>
      <alias name='watchdog0'/>
    </watchdog>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

 

  • Author

Here's a thought...  Is the check for an existing destination path (existing clone) happening AFTER the path is created? (on beta 2?)

 

I used another VM on a different system running beta 3 and both check-marks defaulted to un-checked (unlike beta2) and the clone process worked, unlike beta2 on the first system.

 

I've rebooted the first system to beta3, but I can't take down the VM right now to try cloning it again.

 

Beta3 still doesn't remove the VM's dataset when removing the VM and disks from the VM panel.

 

 

Edited by Espressomatic

  • Author

Well, nevermind about the above.  On my edge router system I still can't clone the pfSense VM, regardless of the check-marks. Something's odd.

 

Take a look a this error - it thinks the source and destination names are the same, no matter what I use for a destination name. This is with the Overwrite check-box checked.

 

Screenshot2024-10-18at10_42_07PM.thumb.png.9070ace767346491eac1c666da8ab6df.png

  • Community Expert
4 hours ago, Espressomatic said:

Well, nevermind about the above.  On my edge router system I still can't clone the pfSense VM, regardless of the check-marks. Something's odd.

 

Take a look a this error - it thinks the source and destination names are the same, no matter what I use for a destination name. This is with the Overwrite check-box checked.

 

Screenshot2024-10-18at10_42_07PM.thumb.png.9070ace767346491eac1c666da8ab6df.png

I have added so addition entries into the log please can you put this file in /usr/local/emhttp/plugins/dynamix.vm.manager/include and try again.

 

Also can you provide 

cat /boot/config/domain.cfg 

 

libvirt_helpers.php

  • Author

Here's domain.cfg

 

SERVICE="enable"
IMAGE_FILE="/mnt/nvme_pool/system/libvirt/libvirt.img"
IMAGE_SIZE="1"
DEBUG="no"
DOMAINDIR="/mnt/nvme_pool/vm_hosts/"
MEDIADIR="/mnt/nvme_pool/vm_isos/"
VIRTIOISO="/mnt/nvme_pool/vm_isos/virtio-win-0.1.208-1.iso"
BRNAME="br0"
VMSTORAGEMODE="auto"
DISABLE="no"
HOSTSHUTDOWN="shutdown"
TIMEOUT="60"
CONSOLE="web"
RDPOPT="no"
USAGE="N"
USAGETIMER="3"

 

and diagnostics after installing the new php file, rebooting, and trying the clone operation

 

 

trillian-diagnostics-20241019-1057.zip

  • Community Expert
4 minutes ago, Espressomatic said:

Here's domain.cfg

 

SERVICE="enable"
IMAGE_FILE="/mnt/nvme_pool/system/libvirt/libvirt.img"
IMAGE_SIZE="1"
DEBUG="no"
DOMAINDIR="/mnt/nvme_pool/vm_hosts/"
MEDIADIR="/mnt/nvme_pool/vm_isos/"
VIRTIOISO="/mnt/nvme_pool/vm_isos/virtio-win-0.1.208-1.iso"
BRNAME="br0"
VMSTORAGEMODE="auto"
DISABLE="no"
HOSTSHUTDOWN="shutdown"
TIMEOUT="60"
CONSOLE="web"
RDPOPT="no"
USAGE="N"
USAGETIMER="3"

 

and diagnostics after installing the new php file, rebooting, and trying the clone operation

 

 

trillian-diagnostics-20241019-1057.zip 97.42 kB · 0 downloads

Rebooting will revert, log is in the screen display not syslog.

  • Author

Gotcha.

 

OK, looks like it's checking the source twice:

 

Screenshot2024-10-19at11_10_18AM.png.0582614021aab26f95d985b8fe39281e.png

 

Also odd, sometimes the clone window appears with both boxes checked, sometimes empty. Also, clicking in the filename field automatically selects all the text and it's impossible to deselect it with any mouse clicks - need to use the cursor keys.

Edited by Espressomatic

  • Community Expert
3 minutes ago, Espressomatic said:

Gotcha.

 

OK, looks like it's checking the source twice:

 

Screenshot2024-10-19at11_10_18AM.png.0582614021aab26f95d985b8fe39281e.png

I need to work out why it is not replacing the name

		if ($config['disk'][0]['new'] != "") {
		foreach ($config["disk"] as $diskid => $disk) {
			$file_clone[$diskid]["source"] = $config["disk"][$diskid]["new"] ;
			$config["disk"][$diskid]["new"] = str_replace($vm,$clone,$config["disk"][$diskid]["new"]) ;
			$pi = pathinfo($config["disk"][$diskid]["new"]) ;
			$isdir = is_dir($pi['dirname']) ;
			if (is_file($config["disk"][$diskid]["new"])) $file_exists = true ;
			write("addLog\0".htmlspecialchars("Checking from file:".$file_clone[$diskid]["source"]));
			write("addLog\0".htmlspecialchars("Checking to file:".$config["disk"][$diskid]["new"]));
			write("addLog\0".htmlspecialchars("File exists value:". ($file_exists ? "True" : "False")));
			$file_clone[$diskid]["target"] = $config["disk"][$diskid]["new"] ;
			}

 

  • Community Expert
  • Solution
9 minutes ago, Espressomatic said:

Gotcha.

 

OK, looks like it's checking the source twice:

 

Screenshot2024-10-19at11_10_18AM.png.0582614021aab26f95d985b8fe39281e.png

 

Also odd, sometimes the clone window appears with both boxes checked, sometimes empty. Also, clicking in the filename field automatically selects all the text and it's impossible to deselect it with any mouse clicks - need to use the cursor keys.

Ah your path and VM name do not match.

 

I have fixed the check boxes for next release.

  • Author

You got it. After renaming the VM:

 

Screenshot2024-10-19at11_32_40AM.png.068c8efc0e49b05084b7b3298e6724fd.png

 

Is it normal for a VM on zfs to fail cp and need rsync?

 

Screenshot2024-10-19at11_32_48AM.thumb.png.4f1fa5814fe8d955f5bb0ee95439a181.png

 

 

  • Community Expert
8 minutes ago, Espressomatic said:

You got it. After renaming the VM:

 

Screenshot2024-10-19at11_32_40AM.png.068c8efc0e49b05084b7b3298e6724fd.png

 

Is it normal for a VM on zfs to fail cp and need rsync?

 

Screenshot2024-10-19at11_32_48AM.thumb.png.4f1fa5814fe8d955f5bb0ee95439a181.png

 

 

I don't believe zfs supports copy on write unlike btrfs hences fails back to rsync.

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.