cancel
Showing results for 
Search instead for 
Did you mean: 

How to create dummy IGB file

Alokbehria
Occasional Contributor

How to create dummy IGB file

Hi All,

 

We are sitting on HPUX Itanium and we are facing some disk performance issue and exploring a way to create 1G dummy file on different disks and compare the timings. Thanks in advance.

 

Regards

Alok

6 REPLIES
Patrick Wallek
Honored Contributor

Re: How to create dummy IGB file

The command you want is 'prealloc'

 

# prealloc /some/dir/afile 1000000000

 

Will create a 1 billion byte file.

 

 

Alokbehria
Occasional Contributor

Re: How to create dummy IGB file

 

Thanks Patric for the help. Will this command create 1G dummy file along with the timings.

 

Regards

 

Patrick Wallek
Honored Contributor

Re: How to create dummy IGB file

>>Will this command create 1G dummy file along with the timings.

 

I don't understand your question.  What do you mean "...along with the timings."?

 

If you create a file with prealloc it will look something like:

 

# prealloc afile 100000000
# ll afile
-rw-r--r-- 1 root sys 100000000 May 2 09:23 afile

 

If you want to know how long it took to create the file you can do:

 

# timex prealloc afile 100000000

real 3.25
user 0.01
sys 0.69

 

# ll afile
-rw-r--r-- 1 root sys 100000000 May 2 09:25 afile

Bill Hassell
Honored Contributor

Re: How to create dummy IGB file

prealloc has nothing to do with performance measurements. It simply creates a file with all zeros of the size you requested.

 

If you want to measure simple disk read performance, use dd and specify the raw device file.

Here's an example to read a raw disk for 500MBytes and record the length of time that t took:

 

MYDISK=/dev/rdsk/c1t0d0
timex dd if=$MYDISK of=/dev/null bs=1024k count=200
200+0 records in
200+0 records out

real        5.46
user        0.00
sys         0.04

 

Then take the record count (count=200) and divide by the "real" seconds (wall clock time) to arrive at the MB per second:

 

200/5.46=37.03 MBytes/sec

 

Now for all the caveats...

 

This is a serial read, no seeking except track to track. If this is a disk array, then it is more of a measure of the RAID method, read-ahead settings and cache size, rather than sustainable read performance. And unless the disk is quiet (no other I/O from other processes or hosts), then it is a shared performance value and would have to be repeated under different disk loads. Note that count=200 is a low number (200 MBytes)...use it to get started. Then increase it to count=1000 (1 GByte) to get a more average value.

 

I have attached a diskperf script that simplifies this task immensely.

Usage:

 

    diskperf.sh   <MB>   <disk>   [ <disk> ... ]

 

For example,

 

# diskperf.sh 200 c1t0d0
20130503.133202 /dev/rdsk/c1t0d0 (vg00): 200 MB in 5.4 secs (200 recs @ 1024 KB) = 37.0MB/sec

 

Or test several disks with one command:

 

# diskperf.sh 200 c1t0d0 c8t0d0 c17t0d0
20130503.134307 /dev/rdsk/c1t0d0 (vg00): 200 MB in 5.4 secs (200 recs @ 1024 KB) = 37.0MB/sec
20130503.134311 /dev/rdsk/c8t0d0 (vgbig): 200 MB in 3.8 secs (200 recs @ 1024 KB) = 52.6MB/sec
20130503.134313 /dev/rdsk/c17t0d0 (vgstore): 200 MB in 2.3 secs (200 recs @ 1024 KB) = 86.9MB/sec

 

 

 



Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: How to create dummy 1 GB file?

>bs=200

 

I assume you meant count=200.  You can correct them by using Post Options > Edit Reply.

(And also fix the subject. :-)

Bill Hassell
Honored Contributor

Re: How to create dummy 1 GB file

Thanks Dennis. It is indeed count=200 and count=1000



Bill Hassell, sysadmin