How to move VMs including templates to another disk in the same server (ZFS) PVE 4.4

turdor

Member
Apr 2, 2017
52
1
13
45
Hi all! There is a ton of HowTo move VMs from one Server/Cluster to another, but I found nothing on how to move stuff inside same server to different HDD.
Simple question:
Added a new HDD to my SSD in PVE 4.4 (with "zpool create -f storage01 /dev/sdb", and added it in GUI then, so it shows as a local storage) and stuck with how to move VMs and templates.
1. So I have 100% full SSD and need to move all VMs to a new HDD.


All the story:
2. Then I need to use 2-3 VMs all the time on SSD and will use temporarily another 2-3 VMs on SSD and then will archive them to HDD and will run them occasionally from there or will move back in forth HDD<>SSD when needed.

3. It is not clear for me how clones will be managed on different disks - do I need to move template and clone each time? Or have main templates on SSD (for better speed) and all the clones on HDD... seems like I misconcept ZFS and do not fully understand how thin provisioning work on 2 separate disks. Or shall I just use full clones?

4. Next step I will add external storage, but I plan to use it for backups only. Also I have exactly same server hardware in case something will break (I swap MB few times already - all passthrough keep working)

I'm a digital artist and it's sort of portfolio - I will have few basic Templates (Win10, Win Server 2016, OSX, Linux) and the rest will be their clones w. thin provisioning, also there might be few VMs for each installation (usually no more than 3). All templates have Direct Pass Through of Videocards and USBs. I know there is some sort of differentiation on SSD/HDD in ZFS , but I definitely need to read more on it - I have Mastering Proxmox 2nd edition, but some things are not in depth there. Any advice on reading please?

Thanx a lot!
 
Hi,

move disk is what you are looking for.

Go to the virtual disk and select the vdisk.
On the top of the frame there is a button "move disk".

This can be done online.
 
but note that this will break your linked clone -> template connection.
 
but note that this will break your linked clone -> template connection.
Thanx Fabian and Wolfgang for the answer!

is it correct what in my scenario I only able to use full (independent) clones and linked only if I keep both template and clone on SSD?

Is there a way to have a container of containers? Or archive? Would say an independent (I mean by independent - I can move it to any PVE) set of:
1. Template (win)
2. Two linked clones (2x win)
3. Full clone (linux)

Or it will not work automatically coz linked clones implemented on ZFS level and need to be done a lot of manual changes to move them?

What about Nested Virtualization? PVE inside PVE? Am I able to passthrough videocards, HDD and USB in that scenario?
 
Last edited:
Thanx Fabian and Wolfgang for the answer!

Or it will not work automatically coz linked clones implemented on ZFS level and need to be done a lot of manual changes to move them?

is this relevant to raw ZFS too?
http://chari.titanium.ee/copy-proxmox-linked-clone-to-new-server/



Copy proxmox linked clone to new server
2015/12/11 Bharath Chari Hardware, Tips and Tricks, Virtualization


These instructions are for Proxmox, but the general principle applies for all qemu linked clones.

All steps in the shell prompt need to performed as root.

Existing server setup – change according to your VMIDs

Base template :
VMID 101 and location is /var/lib/vz/images/101 (filename is base-101-disk-1.qcow2)
VMID 101 disk type is Virtio/Network is Virtio, format is qcow2
Linked Clone :
VMID 102 and location is /var/lib/vz/images/102 (filename is vm-102-disk-1.qcow2), format is qcow2

Shut down the clone. Copy both files to the new server, to /var/lib/vz/ (Since this is most likely on a different volume from the rest of the system, copying the files here will make it faster to move them to the final locations). You can now restart the clone.

New server – Change according to your desired VMIDs

Steps to be completed via the Proxmox GUI

1) Create a VM with virtio disk and network and mark it as a template. Do not waste time installing an OS. Let’s presume this VMID is 110, so the template location will be /var/lib/vz/images/110 and the filename will be base-110-disk-1.qcow2
2) Create a VM as a linked clone. Assume this to be VMID 111, so the VM location will be /var/lib/vz/images/111 and the filename will be vm-111-disk-1.qcow2. Do not start the linked clone.

Steps to be completed via the shell prompt

For the template:

cd /var/lib/vz/images/110
# Proxmox marks the base template as immutable (which it should!), so this needs to be done
chattr -i base-110-disk-1.qcow2
rm base-110-disk-1.qcow2
mv /var/lib/vz/base-101-disk-1.qcow2 .
mv base-101-disk-1.qcow2 base-110-disk-1.qcow2
# make the template immutable again
chattr +i base-110-disk-1.qcow2
For the linked clone:

cd /var/lib/vz/images/111
rm vm-111-disk-1.qcow2
mv /var/lib/vz/vm-102-disk-1.qcow2 .
mv vm-102-disk-1.qcow2 vm-111-disk-1.qcow2
qemu-img info vm-111-disk-1.qcow2
#You will see that the base file points to old location. This needs to be changed by rebasing the image
qemu-img rebase -u -b ../110/base-110-disk-1.qcow2 vm-111-disk-1.qcow2
You can go back to the proxmox interface and start the clone. Fingers crossed. It should work as it did on the old server.
 
Last edited:
no, this does not apply to ZFS. a similar manual procedure for ZFS is possible, but you need to know what you are doing (manual recursive send/receive from old pool to new pool, manual editing of storage.cfg or guest configs). if you want to attempt it, I strongly recommend testing it using a nested PVE installation first, until you are sure it works the way you expect it to work - that way you are not risking your actual VMs and data!
 
I strongly recommend testing it using a nested PVE installation first

OK - good strategy! Thanx a lot!

But for now as my main disk is 100% full (39MB available), may I just make new VMs/templates from each to a new local disk w "Create VM"?
1. Make a new full VMs from each template to a new HDD
2. Convert all of them back to templates on same new location and erase temporary VMs (may I make templates from templates directly?)
3. Make templates from all linked clones to a new HDD
4. Make full VMs from those new templates and erase temporary templates

So I believe I will have after that independent Templates and VMs, not clones all in new HDD. Please correct me if I'm wrong?
Then can I just move VMs back to SSD and move their VDisks to HDD if needed?
 
if you don't care about preserving the existing template to linked clone relationship and existing snapshost, you can just do a full clone of each VM to the new storage. if you want, you can then convert all of the full clones to templates and create linked clones again. instead of full clones you could also just move the disks to the new storage if no snapshots exists, otherwise you have to delete the snapshots first.
 
Hi,
Go to the virtual disk and select the vdisk.
On the top of the frame there is a button "move disk".
Thanx Wolfgang!
Did not realised first it's in Hardware-HardDisk of VMs, so used clone but definitely will use it!

How can I rename manually disk names please?
 

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!