using dm-zero to test large filesystems w/o all those pesky disks
Quoted 14 lines
From
Documentation/device-mapper/zero.txtin the kernel:To create a sparse device, start by creating a dm-zero device that's the desired size of the sparse device. For this example, we'll assume a 10TB sparse device.
TEN_TERABYTES=
expr 10 \* 1024 \* 1024 \* 1024 \* 2# 10 TB in sectors
echo "0 $TEN_TERABYTES zero" | dmsetup create zero1Then create a snapshot of the zero device, using any available block-device as the COW device. The size of the COW device will determine the amount of real space available to the sparse device. For this example, we'll assume
/dev/sdb1is an available 10GB partition.
Quoted 6 lines
echo "0 $TEN_TERABYTES snapshot
/dev/mapper/zero1/dev/sdb1p 128" | \
dmsetup create sparse1This will create a 10TB sparse device called
/dev/mapper/sparse1that has 10GB of actual storage space available. If more than 10GB of data is written to this device, it will start returning I/O errors.
It should be quite possible to use this sort of thing for large ext4 filesystem testing.
Further tricks could be done to mark certain regions of the filesystem as full, and then place dm error targets under those regions, so that if any IO happens in this region it will return an error; this could maybe help catch wraparounds & overflows...
-Eric