I deleted original template while linked clones exist

wanning

New Member
Aug 21, 2021
3
0
1
29
I deleted the original template while linked clones exist. But I can still access the virtual machine. And I cannot find any template files in the storage pool.

I read the document, the original template cannot be deleted while linked clones exist. But I successfully deleted.

Why is this, can I continue to use the cloned virtual machine?
 
I think I may have found the reason. I am using lvm. So linked clone is equivalent to copying a file. And copy-on-write makes file copying fast. So I can safely delete the template.
 
I think I may have found the reason. I am using lvm. So linked clone is equivalent to copying a file. And copy-on-write makes file copying fast. So I can safely delete the template.

Hi @wanning, can you please explain better this process?

I am now starting to do some tests on templates and linked clones, until now I have always cloned LXCs and VMs starting from other LXCs and VMs, which I had created specifically for this purpose, as a base, without going through the templates.

Reading the documentation I was able to understand how the templates + linked clones concept saves time, but also above all disk space. Now, if however, a template linked to one or more linked clones were deleted, would this concept of space saving be canceled or would it continue to exist?

How would the remaining linked clones behave as they no longer have the base disc to start from?
 
Hi @wanning, can you please explain better this process?

I am now starting to do some tests on templates and linked clones, until now I have always cloned LXCs and VMs starting from other LXCs and VMs, which I had created specifically for this purpose, as a base, without going through the templates.

Reading the documentation I was able to understand how the templates + linked clones concept saves time, but also above all disk space. Now, if however, a template linked to one or more linked clones were deleted, would this concept of space saving be canceled or would it continue to exist?

How would the remaining linked clones behave as they no longer have the base disc to start from?

Under the hood. Link copy is ordinary file copy, no magic.

The file system simply records the location of each block in a file. No matter where it points. Therefore, only file node information needs to be copied for each copy. The copy action does not copy any file content.

When you modify the file after copying the file, the changed blocks in the file will point to other places, and the file system will allocate new space for them. The actual space occupied by the file will grow larger and larger until it is as large as its logical size.

If the file is deleted, it is equivalent to deleting the reference to blocks from the file system. If a block no longer has any references. Then the file system will reclaim them. So it is difficult to say how much space can be freed by deleting a file.

Sometimes it is difficult to estimate how much space a file will physically occupy after a period of time. Moreover, frequent requests for file system allocation of space will cause a lot of overhead. So the full copy still exists. Copy a file in its entirety. It is no longer necessary to dynamically allocate space when modifying files.
 
Last edited:
Under the hood. Link copy is ordinary file copy, no magic.

The file system simply records the location of each block in a file. No matter where it points. Therefore, only file node information needs to be copied for each copy. The copy action does not copy any file content.

When you modify the file after copying the file, the changed blocks in the file will point to other places, and the file system will allocate new space for them. The actual space occupied by the file will grow larger and larger until it is as large as its logical size.

If the file is deleted, it is equivalent to deleting the reference to blocks from the file system. If a block no longer has any references. Then the file system will reclaim them. So it is difficult to say how much space can be freed by deleting a file.

Sometimes it is difficult to estimate how much space a file will physically occupy after a period of time. Moreover, frequent requests for file system allocation of space will cause a lot of overhead. So the full copy still exists. Copy a file in its entirety. It is no longer necessary to dynamically allocate space when modifying files.

Thanks, that appears to be similar to what happens with APFS on macOS.

So, when it’s possible it’s recommended to use the linked cloning process when creating new LXCs/VMs?

I’ve also noticed that if I restore a backup of a LXC created with linked cloning it will be restored as a full clone.
 

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!