Coreutils dd
From wikinotes
dd is a tool for converting/copying files (primarily system devices exposed as files)
Usage
# create fake disk drive sudo dd if=/dev/zero of=mydisk.img bs=1M count=1200 # 1M at a time, 1200 times (1G) sudo mkfs.ext4 mydisk.img # NOTE: on FreeBSD, you'll need to create a virtual block device # for the image using: # mdconfig -a -t vnode -f /path/to/image.img -u 0 # link image to virtual device # mount -t ext2fs /dev/md0 /mnt # mount the virtual-device, instead of disk file # mdconfig -d -u 0 # unlink image from virtual device