On 7/23/2010 10:51 PM, Dan Langille wrote:
On 7/23/2010 10:42 PM, Daniel O'Connor wrote:

On 24/07/2010, at 11:55, Freddie Cash wrote:
It's theoretical as I have not investigated how to create sparse
files on FreeBSD, nor have I done this. It's based on several
posts to the zfs-discuss mailing list where several people have
done this on OpenSolaris.

FYI you would do.. truncate -s 1T /tmp/fake-disk1 mdconfig -a -t
vnode -f /tmp/fake-disk1

etc..

Although you'd want to determine the exact size of your real disks
from geom and use that.


$ dd if=/dev/zero of=/tmp/sparsefile1.img bs=1 count=0 oseek=2000G
0+0 records in 0+0 records out 0 bytes transferred in 0.000025 secs
(0 bytes/sec)

$ ls -l /tmp/sparsefile1.img -rw-r--r-- 1 dan wheel 2147483648000
Jul 23 22:49 /tmp/sparsefile1.img

$ ls -lh /tmp/sparsefile1.img -rw-r--r-- 1 dan wheel 2.0T Jul 23
22:49 /tmp/sparsefile1.img

Going a bit further, and actually putting 30MB of data in there:


$ rm sparsefile1.img
$ dd if=/dev/zero of=/tmp/sparsefile1.img bs=1 count=0
oseek=2000G
0+0 records in
0+0 records out
0 bytes transferred in 0.000030 secs (0 bytes/sec)

$ ls -lh /tmp/sparsefile1.img
-rw-r--r--  1 dan  wheel   2.0T Jul 23 22:59 /tmp/sparsefile1.img

$ dd if=/dev/zero of=sparsefile1.img bs=1M count=30 conv=notrunc
30+0 records in
30+0 records out
31457280 bytes transferred in 0.396570 secs (79323405 bytes/sec)

$ ls -l sparsefile1.img
-rw-r--r--  1 dan  wheel  2147483648000 Jul 23 23:00 sparsefile1.img

$ ls -lh sparsefile1.img
-rw-r--r--  1 dan  wheel   2.0T Jul 23 23:00 sparsefile1.img
$


--
Dan Langille - http://langille.org/
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to