Linux
$ fallocate -l 10G gentoo_root.img
$ dd if=/dev/zero of=./gentoo_root.img bs=4k iflag=fullblock,count_bytes count=10G
$ truncate -s 10G gentoo_root.img
OS X, Solaris, SunOS and probably other UNIXes
# mkfile 10240m 10Gigfile
HP-UX
# prealloc 10Gigfile 10737418240