Quantcast
Channel: Admins Goodies » image
Viewing all articles
Browse latest Browse all 10

VM running perfectly when its disk image is deleted?

$
0
0

Question

Does anyone has such experience that you accidentally delete the used disk image when virtual machine is running?

I would expect that the virtual machine will fail immediate, but, surprisingly, it still running perfectly. I have tried to execute many I/O commands and even create very large files by “dd” which are totally more larger then the vm’s memory size. But it is still live.

Can anyone explain why?

Server info:
ubuntu 12.04 with KVM and libvirt installed from default repo.
VM’s disk image is qcow2 format.

Asked by user1817188

Answer

Deleting a file does not actually delete the file, it reduces the number of names pointing to an inode. If both the number of names and the number of open file descriptors to the file reach 0, the data gets deleted.

So if you delete a file that’s still open by some application, that application can still happily use that file. Only when the last file descriptor gets closed, the file gets deleted (and then you’ll see the used space is reclaimed again).

Answered by arjarj

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images