/dev/zero equivalent in Mac OS X
(too old to reply)
Cameron Kay
1999-11-06 09:27:01 UTC
I want to run some simple tests on how fast my disk is on my Mac OS X
Server but their doesn't seem to be a /dev/zero. Is there an equivalent?

The test are as follows

Write Test:
# dd if=/dev/zero bs=1024k of=tstfile count=1024

Read test:
# dd if=tstfile bs=1024k of=/dev/null

- Cameron

Cameron Kay
Computer Technology Co-ordinator
College of Design, Fine Arts and Music
Massey University at Wellington
Wellington, New Zealand

Ph: +64 4 801 5799
Fax: +64 4 801 2799
Mobile: +64 21 661 285
Fabien Roy
1999-11-06 21:33:50 UTC
You can use mkfile to create a /dev/zero like file.
Create a one gig "empty" file.
mkfile -n 1g bigfile

Note that "-n" prevents the blocks allocation of the file, only the size is
recorded and reading this file will make the kernel to give you nulls.
So your test will be:
dd if=bigfile bs=1024k of=tstfile count=1024
Post by Cameron Kay
# dd if=/dev/zero bs=1024k of=tstfile count=1024
UNIX is so powerful!
BTW is it possible to do the same on NT? ;-)

Have fun!



mkfile - create a file

mkfile [ -nv ] size[b|k|m|g] filename ...

mkfile creates one or more files that are suitable for use
as NFS-mounted swap areas. The sticky bit is set, and the
file is padded with zeroes by default. The default size
unit is bytes, but the following suffixes may be used to
multiply by the given factor: b (512), k (1024), m
(1048576), and g (1073741824).

-n Create an empty filename. The size is noted, but
disk blocks aren't allocated until data is written
to them.

-v Verbose. Report the names and sizes of created

If a client's swap file is removed and recreated, it must
be re-exported before the client will be able to access
it. This action may only be done when the client is not

chmod(2), stat(2), exportfs(8), sticky(8)

// Fabien Roy
// Senior Manager, MIS
// MediaRing Inc.
// 99 West Tasman Drive
// Suite 280
// San Jose, CA 95134
// fabien-***@mediaring.com
// Tel: (408) 383-9222 #109
// Fax: (408) 383-9223
// http://www.mediaring.com