is a terribly inefficient way of creating a test image. It wastes 10GB of disk space. It takes dozen of seconds to run. Etc. Instead you can create a sparse file of 10GB that takes 0 bytes on disk. The creation of such a file is instantaneous:
The key is seek=XXX. The filesystem will not allocate blocks before this offset. An application reading before this offset will just read virtual zero bytes.
Otherwise, this is a nice succinct article showcasing the snapshot/clone feature and send/receive snapshot deltas between 2 systems.
Edit: on Mac OS X, UFS supports sparse file, but not HFS+. On Linux, all major fs support sparse files.
Yes, the better way is by using the fallocate program which uses the posix_fallocate syscall, which makes a new file with a given size containing whatever happened to be on disk at the time. Basically malloc for filesystems.
Otherwise, this is a nice succinct article showcasing the snapshot/clone feature and send/receive snapshot deltas between 2 systems.
Edit: on Mac OS X, UFS supports sparse file, but not HFS+. On Linux, all major fs support sparse files.