how to know linked clone or used by another vm/lxc before remove it

Zaman

Active Member
Apr 15, 2019
78
3
28
30
Hello,
as the title i want to make sure this is linked clone connected to that base image
so how to know that?
Best Regards
 
you can tell from the volid (if a volume is a linked clone, it will reference a base volume).
 
you can tell from the volid (if a volume is a linked clone, it will reference a base volume).
I Created Linked Clone but no sign on volume ID
Code:
create linked clone of drive scsi0 (local-lvm:base-102-disk-0)
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "vm-113-disk-0" created.
  WARNING: Sum of all thin volume sizes (1.61 TiB) exceeds the size of thin pool pve/data and the size of whole volume group (<893.72 GiB).
TASK OK
So I'm missing something ?
 
i have many templates that named as base-* if its linked clone, how to know to which disj is linked?
i want to remove some disks but i need to know if title linked to another disk or not?
thanks
 
I Created Linked Clone but no sign on volume ID
Code:
create linked clone of drive scsi0 (local-lvm:base-102-disk-0)
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "vm-113-disk-0" created.
  WARNING: Sum of all thin volume sizes (1.61 TiB) exceeds the size of thin pool pve/data and the size of whole volume group (<893.72 GiB).
TASK OK
So I'm missing something ?
when try full clone get this
Code:
create full clone of drive ide2 (ssd4-out:vm-107-cloudinit)
  Logical volume "vm-116-cloudinit" created.
create full clone of drive scsi0 (ssd4-out:vm-107-disk-0)
  Logical volume "vm-116-disk-0" created.
 
LVM-thin is the exception - linked clones in LVM thin are fully independent of their base image (each can be deleted without interfering with the other). so while the base image is renamed to "base-...", the linked images have a regular volume ID and continue to work even if you delete the base image/volume.
 
  • Like
Reactions: singlecask
LVM-thin is the exception - linked clones in LVM thin are fully independent of their base image (each can be deleted without interfering with the other). so while the base image is renamed to "base-...", the linked images have a regular volume ID and continue to work even if you delete the base image/volume.
Interesting! I would have expected something like that with ZFS (with its copy-on-write) instead but it appears not to be the case (as clone copies entire disks en linked won't allow removal).
 
the way snapshots (and following from that, linked clones) are implemented in ZoL and LVM-Thin are really different ;)
 
I Created Linked Clone but no sign on volume ID

So I'm missing something ?
I think you need to seach all (other) VMs to see if the base-drive is referenced. Something like grep ':base-100-disk-[0-9]*/' /etc/pve/qemu-server/*.conf for usages of the disks of VM template 100.
 
Last edited:
Hi,
you can also do pvesh get /nodes/<node name>/storage/<storage ID>/content for the storage of the base image and see if it's mentioned in the parent column somewhere.
And Proxmox VE itself should also check if a base image is still in use when removing a template.
 
Last edited:
Follow-up question (sorry to revive this thread, but it's not that old):

When I list the contents of the node (lvm-thin) like you explained, fiona, none of the LXCs I created as linked clones show up with a "parent" entry. Does that mean they aren't really linked clones but full clones? Or is the cloning handled by LVM somehow, but invisibly to the user?

If it's the latter, does that mean I can lvrename (and adapt the corresponding config file) or delete templates, even if I created linked clones from them, without destroying anything?

Or if I'm unhappy with a lvm-thin template because I forgot something, I could just clone it, add a missing feature, convert it to a new template and delete the old one? Even if I created linked clones from it?

I'm sorry I have to ask all these questions, I'm new to this and trying to grasp the concepts. So much to learn. ;)
 
  • Like
Reactions: Zaman
Hi,
Follow-up question (sorry to revive this thread, but it's not that old):

When I list the contents of the node (lvm-thin) like you explained, fiona, none of the LXCs I created as linked clones show up with a "parent" entry. Does that mean they aren't really linked clones but full clones? Or is the cloning handled by LVM somehow, but invisibly to the user?

If it's the latter, does that mean I can lvrename (and adapt the corresponding config file) or delete templates, even if I created linked clones from them, without destroying anything?

Or if I'm unhappy with a lvm-thin template because I forgot something, I could just clone it, add a missing feature, convert it to a new template and delete the old one? Even if I created linked clones from it?

I'm sorry I have to ask all these questions, I'm new to this and trying to grasp the concepts. So much to learn. ;)
yes, LVM-thin is an exception here, because AFAIK the linked clones there are independent of the parent volume. Basically, every volume references its extents and as long as a single volume references an extent, the extent is not freed up. So you can remove or rename the parent without affecting the linked clone.
 
  • Like
Reactions: singlecask

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!