[SOLVED] Adding a new volume for existing VM

foadk

Member
Mar 25, 2020
19
0
6
36
Hi.
I have created a VM which uses thin LVM. Now I want to start a fresh VM with the same id and back up old data. For that, I have renamed my disk (i.e vm-101-disk-0) to vm-101-disk-0-old and. Now I want to create a new volume.
The thing is I have a template which I create my Vms from, and I want my new volume to be based on my template volume (vm-100-disk-0, 100 is the id of template).
Now, to create new volume, if I use lvcreate --snapshot to create a snapshot from base volume, then when I start a vm, it throws an error:
Could not open '/dev/vmsthin/vm-101-disk-0': No such file or directory
(vmsthin is my vg)
It seems when i create a snapshot, it doesn't create a /dev/dm-index and mentioned file which refers to that block device.
So what should I do? when I clone a template, it automatically creates a volume based on template's volume. how can I achieve something like that?
 
Hi,
please don't manually rename volumes. PVE is here, so that you don't have to do everything yourself. Of course you can always read the source if you're interested in the details. I guess you need to do
Code:
lvchange -kn vmsthin/vm-101-disk-0
lvchange -ay vmsthin/vm-101-disk-0


But I think the approach below is preferable (also if ever need to do this again):

I'd suggest to change the disk name in /etc/pve/qemu-server/101.conf to vm-101-disk-0-old (or alternatively rename the disk itself back to vm-101-disk-0). Then do the following (though I'm not sure why you'd the new VM to have ID 101):
  1. make a full clone of 101
  2. remove 101
  3. make a clone of 100 with ID 101
 
Thanks.
Now i know the snapshot thing was totally irrelevant!
I did something like what you described.
 

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!