How to crash your VPS in less than an hour

I produced a backup file which i zipped to around 84GB and wanted to download it to my external backup hard drive.
The problem was, when trying to download it via HTTP, the download failed and couldn’t continue, although I was using Google Chrome.

So my next logical step was to split up the file to smaller pieces of around 1 GB.
Trying to download these also failed, so I decided to split them even further and probably try to download them via SSH (using WinSCP).

You’re doing it wrong! When doing it this way:

Therefore I used this method to make 100MB chunks:

split -b 100M

What happend next, I realized the server CPU load got higher (over 10.0 – and 1.0 is about average normal load), so I stopped the process (CTRL+C).

However, after trying to repeat the file splitting process, the load increase followed again and decided not to do it at this hour…

Suddenly, even though the splitting had stopped, the load decrease did not follow (probably due to instability of the paging process and all the website traffic) and the VPS just crashed…

The load average in the final minutes (after 120 days of ideal operation) reached 120.0 ( hope I didn’t break any known world record at it ).

After 5 painfull hours of calling the hosting company for every 10 minutes and receiving calls from my raging clients once every 2 minutes the server was finally restored.

So, as we say, a picture can paint a thousand words:


Aaaaand it’s gone!


You’re doing it right! By doing it this way:

Afterwards, I decided to split the file using a different method, in which I had more control over the CPU load.

Which means I wanted to copy a chunk of the original file into a new file and then give the system some time to “heal”. As no such command existed, I’ve decided to make it on my own.

So I wrote this bash script called “splitter”, which copies a chunk every 5 seconds:

FILESIZE=$(stat -c%s "$FILENAME")

echo "$1 size is $FILESIZE";
if [ "$chunksize" == "" ]; then chunksize=1024; fi;
chunksize=$(./ $chunksize);


echo "Chunk size is $2";

for (( i=$startbyte; i<$FILESIZE; i+=$chunksize )); do
	if [ $end -gt $FILESIZE ]; 
		then len=$((FILESIZE-i))  

	partname=$(printf '%012d' $i);

	echo "partfilename: $partfilename | chunkstart: $chunkstart | chunklength = $chunklength"; 	
	rm -f $partfilename;		
	dd skip=$part count=1 bs=$chunksize if=$FILENAME of=$partfilename > /dev/null 2>&1


	sleep 5


And used this helpful script “” for parsing the human readable filesize to number of bytes:

echo $1 | awk '{
    ex = index("KMG", substr($1, length($1)))
    val = substr($1, 0, length($1))
    prod = val * 1024^ex
    sum += prod
END {print sum}'

Lastly, initiated the script:

chmod +x splitter
./splitter 100M

The output was similar to: size is 90037753223
Chunk size is 100M
partfilename: 000000000000.bin | chunkstart: 0 | chunklength = 104857600
partfilename: 000104857600.bin | chunkstart: 104857600 | chunklength = 104857600
partfilename: 000209715200.bin | chunkstart: 209715200 | chunklength = 104857600

Files (chunks) produced looked like this:

ls *.bin
100M -rw-rw-r-- 1 invision invision 100M Jun 29 20:53 000000000000.bin
100M -rw-rw-r-- 1 invision invision 100M Jun 29 20:53 000104857600.bin
100M -rw-rw-r-- 1 invision invision 100M Jun 29 20:53 000209715200.bin

Finally after about three hours, the whole 84GB file was chunked to 100MB files and the download via SSH was under way :-)

You're doing it wrong | Posted on June 29, 2013 by .

About Kristijan Burnik

Kristijan Burnik is a Programmer and Web Developer specializing in Server-side and Client-side Technologies and Application Development on Linux Servers and Windows Desktop . Also has experience in Networking, Desktop application development as well as Android mobile application development . Experienced in Programming Languages like Java, C, C++, C#, PHP, Javascript, MySQL and somewhat in other languages like Bash, Perl & Python. Sometimes he works as a Graphical Designer for digital production as well as for printing and advertising. He dedicates his spare time writing Tech Articles on his blog in order to share his work with others, as well as to document his projects for his own use. He's also an Educator & Mentor in field of Algorithms and Programming to young programmers in Zagreb, Croatia.

Leave a Reply