I understand that people with a need to make sensitive data unrecoverable use file shredding to achieve it. This means writing over the physical areas of the storage media in more or less sophisticated patterns with the aim of eliminating any physical traces of the information.

Virtual machines add a layer of virtualization to disk access. I'm curious about whether this affects file shredding attempts within the virtual machine.

Virtual machine disks can be backed by physical partitions which I suspect (?) would increase the chance of file shredding working. But the typical thing seems to be to use a file in the host file system to back the virtual machine disk. I'm unclear on how such an image file is used exactly. Is it possible the virtualization system would leave traces of a shredded file in the disk image even if a normally-effective shredding procedure was used?

Is file shredding effective in a virtual machine?

EDIT: My question seems ambiguous after some consideration. It seems there are multiple circumstances at the disk or volume layers unrelated to virtualization that can make normally-effective file shredding procedures ineffective. Examples mentioned below are SSDs, LVM volumes, files on network file systems.

I'd like to update the question slightly to target the virtualization system precisely.

Assuming file shredding would be effective if performed directly on the backing of a virtual disk, would the same procedure performed on the virtual disk from within the VM still be effective?

Can disk virtualization prevent an effective file shredding procedure from having the desired effect?

  • 1
    Depends on the virtual disk format (there are more than one commonly used) and the software ... Btw., SSDs are another problem.
    – deviantfan
    Nov 7, 2016 at 0:43

3 Answers 3


Not reliably.

Some virtual disk formats can be configured to use thin provisioning (disk space aren't allocated until it is used), and SATA supports TRIM command, which can be used to return blocks to unallocated pool.

Some virtual machines also supports snapshotting, and copy-on-write linked virtual disks shared between multiple multiple virtual machines. Some cloud providers can transparently teleport virtual machines, which requires copying the entire virtual disks to another physical machine, for load balancing or to allow hardware maintenance/failures. Virtual disk images can be copied around by defragment/scrubbing tool running on the host. The virtual machine's disk allocator is also free to rearrange disk blocks to optimize writes.

Unless you control the entire stack and takes steps to prevent these from causing leakage, you can't be sure that shredding would also work on the virtual machine even if you're sure that shredding works on the host machine.

The only way to be sure you're not leaking sensitive data, when using virtual machines, is to encrypt the sensitive data.


As Lie Ryan said, not reliably.

In general, there is no guarantee that a write to a virtual disk in a VM will write to the same physical block. It may write to a completely different physical block and if that happens then 'scrubbing' doesn't overwrite the old physical record.

If that happens, then the old record will remain on the physical drive. That doesn't make it easy to access. The links to the old block are gone and it won't last forever. Because the block is now 'freed', it will be overwritten sooner or later, but until that happens, it hasn't really been scrubbed and someone with access to the physical disk can brute force search for it, if they choose to do so.

Encryption, done properly, can help. Using a RAM disk instead of a physical disk can help too, in some circumstances.


The allocated disk space for the VM will get the exact same properties as the true disk space, with the difference that it is contained in the VM disk files. Shredding will work just as on the physical disk, since a shredding app will rewrite the sectors. So practically, using a disk shredded from inside a VM will shred the actual disk sectors the VM file occupies.

This applies both for the allocated VM disk space (where you use container files) and physical disk access by the VM (where you directly access a partition).

So yes, shredding has the same effect and efficiency.

  • 9
    This is only true if you pass through a block device directly to the VM. If you use a flat file, LVM volume or similar your "shredding" may very well end up being buffered by the host (transparent to the VM). Nov 7, 2016 at 12:49
  • I have practically tested. The results show that it is no more buffered than the standard disk cache. The tests were done under VMware 8 and 10with Windows XP, 7 and 10. I will soon test also on the latest version, but I doubt such things suffer drastic changes.
    – Overmind
    Nov 7, 2016 at 13:52
  • 5
    Have you tested using Linux with huge amounts of RAM ? VM servers usually have around 64-128GB of RAM, and Linux will happily buffer disk writes in RAM if it can. I wouldn't be surprised if your erase writes would stay buffered for hours while the sensitive data you wanted to erase is still on the physical disk. Nov 7, 2016 at 14:06
  • 2
    @Lycan you would most likely have even more layers of buffering - first buffering in the VM host, and second on the storage server itself. Nov 7, 2016 at 20:24
  • 2
    @Overmind the host system may do more buffering that's invisible to the eyes of the VM, so writing without caching in the VM doesn't guarantee that the host won't buffer your writes. Nov 8, 2016 at 12:12

You must log in to answer this question.