Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create dummy 2G file 2

Status
Not open for further replies.

lindefl

MIS
Oct 6, 2000
3
0
0
US
I would like to create a dummy file on a file system to verify that the file system can handle this size of a file. I thought I could do this with the dd command using if=/dev/null of=/targetdirectory.
But I don't know how to tell it to put 2G of lovalues in the file. I know there is a way - but maybe it is not using the dd command. Anyone with an idea ? I have already tried adding the dd options of count= and iblks=
Thanks. [sig][/sig]
 
ok....

you could write a Perl script to create a large file, something like this would do it.

#!/usr/bin/perl -w

my $buf = ' ' x (1024 * 1024);
my $i;

open(F,'>mybigfile') || die "can't open file\n$!\n";

for($i=0;$i<2048;$i++){
print F $buf;
}

close(F);
[sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Don't need PERL to do that, simply use
[tt]
dd if=/dev/[red]zero[/red] of=/your/new/filename bs=1m count=4
[tt]

First... when you read from [tt]/dev/null[/tt] nothing goes out, but [tt]/dev/zero[/tt] generates a continuous stream of zeroes. Give it a input and output block size of 1MB with [tt]bs=1m[/tt] (you can use k to specify KiloBytes, and b to specify blocks).

I hope it works... [sig][/sig]
 
Thanks - the dd=/dev/zero .... worked fine. [sig][/sig]
 
Hi guys
there is a command in aix that creates a file with null characters its is lmktemp. the syntax is lmktemp filename size-of-file in bytes eg to create a 100 byte file called test. You type lmktemp test 100.

Let us know of the outcome.

regards

odey
[sig][/sig]
 
The lmktemp worked fine - actually faster than the dd command. Thanks. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top