Operating System - HP-UX
1835593 Members
2720 Online
110079 Solutions
New Discussion

command to create a large file

 
SOLVED
Go to solution
John Meissner
Esteemed Contributor

command to create a large file

I'm trying to test someting and need to create a large file - about 5Gb. I can't think of the command to do this. Thanks for the help.
All paths lead to destiny
3 REPLIES 3
Patrick Wallek
Honored Contributor
Solution

Re: command to create a large file

prealloc is what you want.

# prealloc test 5000000000

The above shoud be 5,000,000,000 bytes or approximately 5GB. It will take a while for prealloc to create the file, but it will get done eventually.
A. Clay Stephenson
Acclaimed Contributor

Re: command to create a large file

dd if=/dev/zero bs=256k count=20000 of=mybigfile

If this is 10.20, you will need to create /dev/zero
mknod /dev/zero c 3 0x03
chmod 444 /dev/zero

If early 11.0,
mknod /dev/zero c 3 0x04

but you will probably already have /dev/zero on 11.x.
If it ain't broke, I can fix that.
John Meissner
Esteemed Contributor

Re: command to create a large file

thanks for the incredibly fast answers guys!!!

This forum is SUCH an incredibly useful tool... from critical issues to something stupid like this. Thanks for the answers and for the help
All paths lead to destiny