Operating System - HP-UX
1834178 Members
2349 Online
110064 Solutions
New Discussion

Re: Script to Create 600MB file

 
SOLVED
Go to solution
Nikee Reddy
Regular Advisor

Script to Create 600MB file

Hello,

We are planning to transfer some of the dump data (600MB each file approx. 80GB data) from US to Europe using the FTP protocol.

Before we do this task, we have decided to perform some test data transfer.

Can you give me some script to create some test data in a file of size 600MB?

Example:
Touch data1.ftp
if the file size < 600MB
then
Add "this is line 1" >> data1.ftp
else
echo "File created of size 600MB"
endif.


Thanks,
Nikee
8 REPLIES 8
Jeff_Traigle
Honored Contributor

Re: Script to Create 600MB file

Use the prealloc command to create files of a given size. No need for scripts on this one unless you're going to make a lot of said files all at once. :)
--
Jeff Traigle
Patrick Wallek
Honored Contributor

Re: Script to Create 600MB file

Use prealloc to create a 600MB file.

# prealloc 600MBFile 629145600

Note that prealloc uses the number of BYTES for the file size.
Hein van den Heuvel
Honored Contributor

Re: Script to Create 600MB file



dd bs=1024K count=600 if=/dev/null of=your-big-file

Or if=/dev/random if you have that?

Or if=/dev/rdsk123

Or if=/oracle/data/somebigfile.dbf

Hein.
Alzhy
Honored Contributor
Solution

Re: Script to Create 600MB file

If you are going to do some benchmarking (and will be using some compression on both ends) - then "prealloc" created file will not do justice.

Use either:

dd if=/dev/random of=data1.ftp bs=8k count=76800

or dd if=/oramount/dbinstance.dmp of=data1.ftp bs=8k count=76800


HTH.
Hakuna Matata.
Jeff Schussele
Honored Contributor

Re: Script to Create 600MB file

Hi Nikee,

I'm not sure a prealloc file will do the trick for you. It's what's termed a sparse file & ftp *may* not send all the null space between the start & ending block. And if it does, sending all zeroes won't be a real world test.
A better idea maybe to use dd to read any old disk with more than 600MB of data on it & write it to a file - like:

dd if=/dev/dsk/cXtYdZ of=/path/to/600mb_file bs=512k count=1200

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: Script to Create 600MB file

The read() system will definitely fill in the NUL's for a sparse file and will send it all 600MB's of NUL's. ANY application will treat the read of a sparse file like that including backup programs like fbackup, OmniBack (DataProtector), and Netbackup. Note that all of these can restore a sparse file (though possibly not precisely as it was) but that do that on the restoring side. The restores do it by noting that a whole herd of NUL's has been seen so that lseeks() are done within the file to "re-sparse" the file.

If it ain't broke, I can fix that.
Nikee Reddy
Regular Advisor

Re: Script to Create 600MB file

Hello All,

Thanks for the quick response.

Well, if I use the dd command, how can I verify the file after the FTP transfer?
I mean, data is good inside the file and the
checksum is good and the integrity?

Thanks,
Nikee

Alzhy
Honored Contributor

Re: Script to Create 600MB file

You can use cksum, md5.. whatever suits you..
Hakuna Matata.