How to move the disks from one VM to another VM
In some scenarios, you may want to move the disks from one VM to another VM.
In such cases, you may add VM disk to the Image service as described in the How to make Image from VM disk section or you can also directly clone the disk to the destination VM using the following commands:
Power off the VM.
Run the following command to check the disk UUID of the source VM:
nutanix@cvm$ acli vm.get <source vm name or UUID>
Clone source VM disk and attach it to the target VM:
nutanix@cvm$ acli vm.disk_create <target VM name or UUID> clone_from_vmdisk=<vmdisk_uuid from Source VM> bus=<target bus> [index=<target index>]
After cloning a disk, the management of the newly cloned disk is independent from the source disk. If you delete the source VM or source disk, it will not have an affect on the cloned disk.
———————————————–
nutanix@NTNX-XXXXXXXXX-A-CVM:200.86.244.111:~$ ncli vm list name=VM_NAME
Id : 0005a48c-d7d8-6469-639b-ac1f6b3bb906::948e4310-929a-4115-84c9-73b46dc4da5c
Uuid : 948e4310-929a-4115-84c9-73b46dc4da5c
Name : VM_NAME
VM IP Addresses :
Memory : 7.9 GiB (8,485,076,992 bytes)
Virtual CPUs : 6
VDisk Count : 4
VDisks : 0005a48c-d7d8-6469-639b-ac1f6b3bb906::NFS:4:0:407962, 0005a48c-d7d8-6469-639b-ac1f6b3bb906::NFS:4:0:407966, 0005a48c-d7d8-6469-639b-ac1f6b3bb906::NFS:4:0:442879, 0005a48c-d7d8-6469-639b-ac1f6b3bb906::NFS:4:0:407964
Protection Domain : Windows
Consistency Group : VM_NAME
nutanix@NTNX-XXXXXXXXX-A-CVM:200.86.244.111:~$
acli vm.disk_create NEW_VM_NAME clone_from_vmdisk=e9859514-1b6d-44f2-a638-23dcb66abb2a bus=scsi index=2
nutanix@NTNX-XXXXXXXXX-A-CVM:200.86.244.111:~$ acli vm.get NEW_VM_NAME
NEW_VM_NAME {
can_clear_removed_from_host_uuid: True
config {
agent_vm: False
allow_live_migrate: True
boot {
device {
disk_addr {
bus: “scsi”
index: 0
}
}
firmware_config {
nvram_disk_spec {
clone {
container_id: 39
snapshot_group_uuid: “cbe732c0-2cc7-4130-bd65-e275a95f54b4”
vmdisk_uuid: “371b6c3e-2fcb-4a31-8974-b9bc10d34ec0”
}
}
nvram_disk_uuid: “06a455c7-6ec5-4af2-8685-74da34f3cbe7”
nvram_storage_vdisk_uuid: “39850a87-064e-4672-ab56-43c7361ed0a9”
}
hardware_virtualization: False
secure_boot: False
uefi_boot: True
windows_credential_guard: False
}
cpu_passthrough: False
disable_branding: False
disk_list {
addr {
bus: “scsi”
index: 0
}
container_id: 66249
container_uuid: “34871655-ab42-4d7b-bdbe-95275e41deca”
device_uuid: “dbd95625-64ca-414c-b010-7812b845cab7”
naa_id: “naa.6506b8d301b77c0638754e4ed5b4a878”
source_vmdisk_uuid: “892a2eee-32a5-4c6f-8167-39f85141d191”
storage_vdisk_uuid: “58065b1c-cd07-4e30-af7d-e7fc6a7cbc64”
vmdisk_size: 193273528320
vmdisk_uuid: “0caac6ab-0b82-4444-a671-75cdc1133585”
}
disk_list {
addr {
bus: “scsi”
index: 1
}
container_id: 66249
container_uuid: “34871655-ab42-4d7b-bdbe-95275e41deca”
device_uuid: “539284cf-8149-4898-9148-d9fcc92ca927”
naa_id: “naa.6506b8d2f1b31bf97d457592b5cb6ff1”
source_vmdisk_uuid: “065d2347-8323-4ed9-8d99-a19ad05b8d0a”
storage_vdisk_uuid: “a89c40b6-d7ae-44d2-9c47-512a69462e40”
vmdisk_size: 3221225472000
vmdisk_uuid: “e9859514-1b6d-44f2-a638-23dcb66abb2a”
}
disk_list {
addr {
bus: “scsi”
index: 2
}
container_id: 66249
container_uuid: “34871655-ab42-4d7b-bdbe-95275e41deca”
device_uuid: “2ad821c0-baa5-48e8-8889-307c4e2da647”
naa_id: “naa.6506b8d2f48b035ce45bf4d9b00936d2”
source_vmdisk_uuid: “35e32528-1b5f-4dcc-a0ef-0389d83d123c”
storage_vdisk_uuid: “02dbc9f9-d8da-4e8b-b9e0-767956a1a354”
vmdisk_size: 1636382539776
vmdisk_uuid: “44bdc9c8-c4a9-4749-abf9-bdaaab8f7d92”
}
disk_list {
addr {
bus: “ide”
index: 0
}
cdrom: True
container_id: 66249
container_uuid: “34871655-ab42-4d7b-bdbe-95275e41deca”
device_uuid: “8eabc4a0-398b-429e-a76c-f5cca145f6ef”
naa_id: “naa.6506b8d55ec77b698ff9344f247f36a2”
source_nfs_path: “/CONT_RF2_GEN_WORKLOADS/.ngt/948e4310-929a-4115-84c9-73b46dc4da5c/nutanix_guest_tools.iso”
storage_vdisk_uuid: “b54bf5af-4573-4786-a9af-32be68d75890”
vmdisk_size: 387205120
vmdisk_uuid: “e68b9c2e-9ca2-4982-a6d5-c84971dba7ed”
}
hwclock_timezone: “America/Sao_Paulo”
machine_type: “pc”
memory_mb: 8092
name: “SERVERCAM”
nic_list {
mac_addr: “00:50:56:92:4f:88”
network_name: “Rede_DCIM”
network_type: “kNativeNetwork”
network_uuid: “14c907ae-2646-4058-870e-788ca1f8b0ae”
type: “kNormalNic”
uuid: “2a760de5-a13f-49d8-ac81-f24cebe7d370”
vlan_mode: “kAccess”
}
num_cores_per_vcpu: 6
num_threads_per_core: 1
num_vcpus: 1
num_vnuma_nodes: 0
vga_console: True
vm_type: “kGuestVM”
}
host_name: “200.86.244.216”
host_uuid: “995e3ed8-9513-4656-b695-13ff0d803fa9”
is_rf1_vm: False
logical_timestamp: 78
state: “kOn”
uuid: “948e4310-929a-4115-84c9-73b46dc4da5c”
}
nutanix@NTNX-XXXXXXXXX-A-CVM:200.86.244.111:~$
Leave a Reply