Unable to delete a VM disk

light2089

New Member
May 5, 2022
7
0
1
Hi,

I am unable to delete a vm disk. This should be something seemingly trivial, but even after destroying the VM, the disks cannot be deleted! The disks were not connected to the VM in the first place. I think they are from when I might converted one of the VMs to a snapshot.

1651726415107.png
Doing a rm -rf .... does not work. Neither does removing it from the GUI. Also, there is no 101.conf
 
Code:
root@proxmox:~# stat /var/lib/vz/images/101/vm-101-disk-0.qcow2
  File: /var/lib/vz/images/101/vm-101-disk-0.qcow2
  Size: 32217432064     Blocks: 47610392   IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 36571146    Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-05-05 00:21:47.404849086 -0400
Modify: 2021-12-24 19:06:33.492555006 -0500
Change: 2021-12-24 19:32:39.420284185 -0500
 Birth: 2021-12-23 06:04:41.720348067 -0500
Code:
root@proxmox:~# findmnt -T /var/lib/vz
TARGET SOURCE                       FSTYPE OPTIONS
/      /dev/mapper/proxmox--vg-root ext4   rw,relatime,errors=remount-ro

Thank you for the super quick reply!
 
Last edited:
Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root)

Hmm, the file is set to read only permissions, even for the owner. Did you run any chmod call on that file or directory?

Anyhow, you should be able to resolve this by allowing write-modifications for the owner:

chmod o+w /var/lib/vz/images/101/vm-101-disk-0.qcow2

Then retry deletion.
 
chmod was one of the first things I tried!

Code:
root@proxmox:~# chmod o+w /var/lib/vz/images/101/vm-101-disk-0.qcow2
chmod: changing permissions of '/var/lib/vz/images/101/vm-101-disk-0.qcow2': Operation not permitted

So the natural question would be then to change the ownership:

Code:
root@proxmox:/var/lib/vz/images/101# chown root:root *
chown: changing ownership of 'vm-101-disk-0.qcow2': Operation not permitted
chown: changing ownership of 'vm-101-disk-1.qcow2': Operation not permitted
root@proxmox:/var/lib/vz/images/101# chown root *
chown: changing ownership of 'vm-101-disk-0.qcow2': Operation not permitted
chown: changing ownership of 'vm-101-disk-1.qcow2': Operation not permitted
 
Can you show me the output of:
Bash:
grep '/dev/mapper/proxmox--vg-root' /proc/mounts

It looks a bit like the directory could be mounted read only
 
  • Like
Reactions: Stoiko Ivanov
Here it is:
Code:
root@proxmox:~# grep '/dev/mapper/proxmox--vg-root' /proc/mounts
/dev/mapper/proxmox--vg-root / ext4 rw,relatime,errors=remount-ro 0 0
 
Parent directories seem to have correct permission:
Code:
root@proxmox:/var/lib/vz# ls -l
total 20
drwxr-xr-x 2 root root 4096 Dec 23 04:04 dump
drwxr-xr-x 4 root root 4096 Dec 23 06:04 images
drwxr-xr-x 2 root root 4096 Dec 23 04:04 private
drwxr-xr-x 2 root root 4096 Dec 24 17:11 snippets
drwxr-xr-x 4 root root 4096 Jan 31 08:41 template

Code:
root@proxmox:/var/lib/vz/images# ls -l
total 8
drwxr----- 2 root root 4096 Dec 23 06:00 100
drwxr----- 2 root root 4096 May  5 00:24 101

Moreover, other images that were actually attached to VM 101 that were in the directory 101 were recently successfully deleted when I removed the VM. It is just these two images where I am facing this issue. Note that these images are from when I inadvertently changed VM101 to a template. Thereafter, I recreated VM101 again, which I later deleted. Not sure if they still think they are a part of template?

But I still gave it a try:
Code:
root@proxmox:/var/lib/vz/images# chmod o+w 101
root@proxmox:/var/lib/vz/images# ls -lr
total 8
drwxr---w- 2 root root 4096 May  5 00:24 101
drwxr----- 2 root root 4096 Dec 23 06:00 100
root@proxmox:/var/lib/vz/images# cd 101
root@proxmox:/var/lib/vz/images/101# ls -l
total 23806032
-r--r--r-- 1 root root 32217432064 Dec 24 19:06 vm-101-disk-0.qcow2
-r--r--r-- 1 root root      917504 Dec 24 12:43 vm-101-disk-1.qcow2
root@proxmox:/var/lib/vz/images/101# rm *
rm: cannot remove 'vm-101-disk-0.qcow2': Operation not permitted
rm: cannot remove 'vm-101-disk-1.qcow2': Operation not permitted
 
Last edited: