When a logical volume is destroyed, the data still exists on the hard disk and is still accessible (using a tool like
dd) to any volumes allocated on top of those blocks which haven't been written to with new data.
Does such a tool or utility exist in Linux/Unix which could mark these blocks on a hard drive as 'dirty' which would then cause the specific block to be zeroed on the first read or write of the block?
An example of this in practice is on Amazon Elastic Block Storage. According to the Amazon EBS documentation:
When you create a new EBS volume or restore a volume from a snapshot, the back-end storage blocks are allocated to you immediately. However, the first time you access a block of storage, it must be either wiped clean (for new volumes) or instantiated from its snapshot (for restored volumes) before you can access the block. This preliminary action takes time and can cause a 5 to 50 percent loss of IOPS for your volume the first time each block is accessed. Performance is restored after the data is accessed once.
The safest option is to zero out the entire destroyed volume before reallocation but that reduces IOPS of the hard drive to other volumes so that'd be a last resort option (this is just a test environment with some VMs for myself). Is there a built in solution which replicates what Amazon EBS does above?