the container is a thin snapshot of an image, it doesn't have the block, but it
has a pointer to the block on the nearest parent image where it does exist, and
it reads the block from there. The block now exists in the container's memory.
### Writing files
**Writing a new file**: With the `devicemapper` driver, writing new data to a
container is accomplished by an *allocate-on-demand* operation. Each block of
the new file is allocated in the container's writable layer and the block is
written there.
**Updating an existing file**: The relevant block of the file is read from the
nearest layer where it exists. When the container writes the file, only the
modified blocks are written to the container's writable layer.
**Deleting a file or directory**: When you delete a file or directory in a
container's writable layer, or when an image layer deletes a file that exists
in its parent layer, the `devicemapper` storage driver intercepts further read
attempts on that file or directory and responds that the file or directory does
not exist.
**Writing and then deleting a file**: If a container writes to a file and later
deletes the file, all of those operations happen in the container's writable
layer. In that case, if you are using `direct-lvm`, the blocks are freed. If you
use `loop-lvm`, the blocks may not be freed. This is another reason not to use
`loop-lvm` in production.
## Device Mapper and Docker performance
- **`allocate-on demand` performance impact**:
The `devicemapper` storage driver uses an `allocate-on-demand` operation to
allocate new blocks from the thin pool into a container's writable layer.
Each block is 64KB, so this is the minimum amount of space that is used
for a write.
- **Copy-on-write performance impact**: The first time a container modifies a
specific block, that block is written to the container's writable layer.
Because these writes happen at the level of the block rather than the file,
performance impact is minimized. However, writing a large number of blocks can
still negatively impact performance, and the `devicemapper` storage driver may