Operating System - HP-UX
1752617 Members
4618 Online
108788 Solutions
New Discussion юеВ

Re: How to create a big file

 
Becke
Super Advisor

How to create a big file


Guys

How do I create a big file with the size of 500G

I have one terrabyte space and I want to create a big file for some testing ?

I think I can use dd command but please let me know the correct syntax?

Many Thanks
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: How to create a big file

You can use the 'prealloc' command as well.

prealloc

To create a 1 GB file

prealloc myfile 1000000000
James R. Ferguson
Acclaimed Contributor

Re: How to create a big file

Hi:

You can create files with 'dd' like this, for example:

# dd if=/dev/zero of=/var/tmp/bigfile bs=1024 count=500

Regards!

...JRF...
Laurent Menase
Honored Contributor

Re: How to create a big file

if you want to create a big sparse file ( looks like a big one, but the real space used on disk is very small )
mknod /dev/zero c 3 3
dd if=/dev/zero of=/var/tmp/bigfile bs=1024 skip=499 count=1
or
dd if=/dev/zero of=/var/tmp/bigfile bs=1 count=1 skip=100000000


Becke
Super Advisor

Re: How to create a big file


Thanks guys, appreciate it

Will the below command count 500 block and as a result will create 500G file?

dd if=/dev/zero of=/var/tmp/bigfile bs=1024 count=500
Becke
Super Advisor

Re: How to create a big file


Thanks all, I tested it below command works fine for me and creates 500GB

dd if=/dev/zero of=file_2GB bs=1m count=500k