How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

February 26, 2012

Create a 1g 100MB 10Mb file for testing transfer speed

Filed under: Linux — Tags: , , , — admin @ 11:39 am

Well yesterday I face another problem.
I have to try transfer speed from one client, because of complaining that his site is loading slow. After a short look on his server the load was below 1 on a quad core, the server didn’t swap, and didn’t have any slow mysql query.
Well last thing I wanted to see how is the bandwidth from that server . So how to create a large file fast ?
Well dd is the command from linux that i use.
So to create 1G file go with
dd if=/dev/zero of=testfile bs=1024 count=1024000
to create 100Mb try
dd if=/dev/zero of=testfile bs=1024 count=102400
and for 10Mb use
dd if=/dev/zero of=testfile bs=1024 count=10240

You can find on other forum that they use /dev/urandom or /dev/random however this are load intensive for your server and take longer to make the file.
So use /dev/zero for this purpose.

Powered by WordPress