I need a little help with renaming Virtual Disk on Storage with ZFS file system.

Joogser

Member
Jun 30, 2019
25
4
8
38
Russian Federation
habr.com
Hello Сolleagues.

On a board Proxmox VE 6.0-4 without subscription.
I need a little help with Virtual Disk renaming on Storage with ZFS file system. Why I need it:

1. I need change ID of VM.
2. Also I have to change ID for virtual disk in order to avoid an issue in future.

So, first step is very easy and clear, need just rename configuration filename:
Code:
cd /etc/pve/nodes/Here_is_a_name_of_our_node/qemu-server/

For example need rename 103 in 120. So, lets rename it by:
Code:
mv 103.conf 120.conf

Also I have to change ID name for virtual disk:
Code:
nano 120.conf
.....................
.....................
virtio0: NVME:vm-103-disk-0,cache=writeback,size=120G
.....................
.....................

We can see in this config file, virtual disk has 103 id number, need change it on 120. So, change it & save.

Now I need rename this disk image from vm-103-disk-0 make vm-120-disk-0.

This disk image storing on NVME disk with ZFS format file system.

BUT! I can't rename it via CLI, because mounted disk showing like an empty in midnight commander.
VM disks on ZFS storage do not use a file but a "zvol". zvols are block devices that do not show up if you go into the directory where the pool ist mounted.

rename_disk_zfs-jpg.11219

Code:
zfs list
rename_disk_zfs_2-jpg.11220

Please, give me an idea how to resolve my issue, thanx.
 

Attachments

  • rename_disk_zfs.jpg
    rename_disk_zfs.jpg
    62.5 KB · Views: 558
  • rename_disk_zfs_2.jpg
    rename_disk_zfs_2.jpg
    72.1 KB · Views: 536
Last edited:
I would not recommend you to perform a change of the VMID in such a way as all of our stack relies on consistency of this ID. If you really want to change it, I would recommend to perform a backup and restore to a different ID.
This can all be easily done in the WebUI without risk of destroying something. Just perform the backup, go to the storage where the backup is located, click on restore and select the new VMID.
Once your VM with new ID is up and running, you can destroy the old one as it is no longer needed.
 
I would not recommend you to perform a change of the VMID in such a way as all of our stack relies on consistency of this ID. If you really want to change it, I would recommend to perform a backup and restore to a different ID.

Okay, if it is possible, could you tell which way I should use to restore performed backup? I have made one test backup of VM, but when I try to restore this backup, I can't give new ID for VM, this option just is not available :(

Take a look on a screen shots below:

step_to_restore-jpg.11223

-----------
step_to_restore2-jpg.11222

I did try shutdown this VM and tried restore this VM when it's turned off, result is same.
-----------
step_to_restore3-jpg.11224

------------
 

Attachments

  • step_to_restore2.jpg
    step_to_restore2.jpg
    78.6 KB · Views: 515
  • step_to_restore.jpg
    step_to_restore.jpg
    90 KB · Views: 511
  • step_to_restore3.jpg
    step_to_restore3.jpg
    51.5 KB · Views: 502
Last edited:
Hello,

Just use this command :

Code:
zfs rename NVME/vm-103-disk-0 NVME/vm-120-disk-0

Good Day

in my case, I had to rename it because I decided to migrate my data drive from an old VM to a new VM and my storage obviously didn't have enough space to rsync it. So my goal was to detach my data drive from the old VM and attach it to the new VM, which is easy to do by simply moving the line
virtio2: rpool:vm-103-disk-0,backup=0,cache=writeback,discard=on,replicate=0,size=100000G from my /etc/pve/qemu-server/oldVM.conf to /etc/pve/qemu-server/newVM.conf
 

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!