[SOLVED] how to move or clone a ceph disk to another kvm

RobFantini

Famous Member
May 24, 2012
2,009
102
133
Boston,Mass
hello
i have a 800GB disk that i'd like to clone and have used with another existing KVM.

has anyone a suggestion on how to do that?
 
Last edited:
Hi!

You'll have to do some command line work: Create a copy of the disk, rename and qm importdisk.
What is the output of the following?
Code:
cat /etc/pve/storage.cfg
qm config <source_vm_id>
qm config <target_vm_Id>
 
Hi!

You'll have to do some command line work: Create a copy of the disk, rename and qm importdisk.
What is the output of the following?
Code:
cat /etc/pve/storage.cfg
qm config <source_vm_id>
qm config <target_vm_Id>

cat /etc/pve/storage.cfg :
Code:
..
rbd: nvme-4tb
        content images,rootdir
        krbd 0
        pool nvme-4tb
..
qm config 4121
Code:
bootdisk: scsi0
cores: 1
ide2: none,media=cdrom
memory: 16384
name: rsnapshot
net0: virtio=72:EB:6F:90:14:F9,bridge=vmbr0,tag=3
numa: 0
onboot: 1
ostype: l26
scsi0: nvme-4tb:vm-4121-disk-0,cache=writeback,discard=on,size=8G
scsi1: nvme-4tb:vm-4121-disk-1,cache=writeback,discard=on,size=1000G
scsihw: virtio-scsi-pci
smbios1: uuid=54a678d3-5c8b-463c-8849-922dbc84bba7
sockets: 2
vmgenid: 17fd38db-8be2-446f-a692-87c4cf64bff1
and the target

qm config 224
Code:
bootdisk: scsi0
cores: 2
ide2: none,media=cdrom
memory: 2048
name: fbcadmin
net0: virtio=CE:62:F5:25:5F:53,bridge=vmbr0,tag=3
numa: 0
onboot: 1
ostype: l26
protection: 1
scsi0: nvme-4tb:vm-224-disk-0,cache=writeback,discard=on,size=12G,ssd=1
scsihw: virtio-scsi-pci
smbios1: uuid=6df028b8-3f5b-48d8-a532-08db6950f481
sockets: 1
vmgenid: 138984aa-5c9a-4fb2-89a7-bbf991edcefa
 
Having a shared storage makes this easier. Depending on your exact setup you might have to enter some additional parameters (for example rbd -p ...), but basically it is
Code:
rbd cp vm-4121-disk-1 vm-224-disk-1
qm rescan --vmid 224
And then attach the unused vm-224-disk-1 in the Hardware view in the GUI.
 
Hello Dominic, thank you for the response + excuse the delay in trying this.

Code:
rbd --pool nvme-4tb  cp vm-100-disk-0 vm-108-disk-2
rbd: error opening default pool 'rbd'
Ensure that the default pool has been created or specify an alternate pool name.

however this works
Code:
rbd --pool nvme-4tb   ls
base-113-disk-0
base-118-disk-0
vm-100-disk-0
vm-101-disk-0
vm-101-disk-1
..
vm-108-disk-0
vm-108-disk-1
..

I checked man rbd and could not figure out the correct syntax yet..
 
I just tried the exact syntax and actually ran in the same problem as you did.

The solution starts further down the man page in the IMAGE, SNAP, GROUP AND JOURNAL SPECS section:
You may specify each name individually, using --pool, (...) but this is discouraged in favor of the above spec syntax.
Even further down, in the example section, the authors show said syntax which really worked when I tried it. I hope I did no search&replace mistakes in the following example. It should work like this:

Code:
root@pveA:~# ceph osd pool ls
nvme-4tb
root@pveA:~# rbd -p nvme-4tb ls
vm-102-disk-0
root@pveA:~# rbd cp nvme-4tb/vm-102-disk-0 nvme-4tb/vm-103-disk-0
Image copy: 100% complete...done.
root@pveA:~# rbd -p nvme-4tb ls
vm-102-disk-0
vm-103-disk-0
root@pveA:~# qm rescan --vmid 103
rescan volumes...
VM 103: add unreferenced volume 'nvme-4tb:vm-103-disk-0' as 'unused0' to config
root@pveA:~# qm set 103 --scsi1 nvme-4tb:vm-103-disk-0
update VM 103: -scsi1 nvme-4tb:vm-103-disk-0

Just in case that you've read it to do this task: I just changed the moving disk images guide to this syntax.
 
thanks this worked:
Code:
rbd cp nvme-4tb/vm-100-disk-0 nvme-4tb/vm-108-disk-2
Image copy: 100% complete...done.

qm rescan --vmid 108
rescan volumes...
VM 108: add unreferenced volume 'nvme-4tb:vm-108-disk-2' as 'unused0' to config
 
  • Like
Reactions: Dominic

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!