How to save time when backing up data? Minutes instead of hours!
A fast and easy way backing-up your server’s data!
Almost everyone knows – that this task should be done regularly, but way to few people do it!
What do I mean?
Simply … BACKUPS
You can do backups for all kind of things, your family photos, your important documents etc.
I hope that most people do those backups, because data loss is not nice.
However as a backup of your files in the private environment is a “Nice To Do”… it is a “Must To Do” when talking about business.
It is important that your files online (scripts, webpages, etc.) and databases are backed up regularly.
It may happen quickly that something you did to your CMS, like an upgrade or something like that breaks your website totally.
Reversing this upgrade or fixing it often takes a huge amount of time (in case even possible).
To bad if your page that just broke is ‘your money page’.
However it does not have to be like that. If you do regular backups and backups before each minor and major upgrade of your scripts that you use at your website then you will be fine. If something breaks apart just load the backed-up version of the files and database and your back online again.
While this all makes sense, I have recognized that way to few people make backups of their pages?
How come people tent to forget to make backups?
Hmm … maybe … it might be that they are just to busy, doing their daily works, or anything else.
I think one of the reason that to few people do backup is, that they think it is to complicated
That is not true though, making backups is not complicated at all.
If you own a webpage that is running on a shared host, it might be or it is very likely that you have access to some kind of backend-system like cpanel.
Use your cpanel feature called „backups“ to download backups of your files and databases.
Another reason why just few people do backups is because it takes to long to download and upload files
from and to their servers.
This is especially true when you try to down or upload a large number of files. Content Management Systems like Joomla, Drupal and WordPress as well as eCommerce Applications like Magento for instance have the characteristic to have a ton files (we are talking about several thousands here).
Many files take ages to load! – Example
When I first tried to make a backup of a magento store it took me about 2 hours downloading all the files via FTP.
The problem at this point was not the size of the files itself but the number of files.
Uploading them to use the backup took even longer!
Saving up to 90% percent of the download time!
Wasting that much time was and is definitely not an option so I decided to do all my backups different in future.
I added another small step
– before FTP-ing the data.
The results just blew me away. Instead of downloading 2 hours it just took a couple minutes. And even uploading the files only took a couple minutes more?
So what did I do to get this kind of Speed BOOST?
The idea and trick is simple. I zipped my files on the server to bundle them in one single file! Of course a slight smaller file size is another advantage of zip files but the true speed boost came because of the number of files being transmitted. Now I had one instead of thousand files!
Ok … zipping files sounds nice – but how is it done?
How to ZIP and UNZIP the files remotely?
Actually it is pretty simple to zip and unzip files on your webserver. All you need is a SSH access
which most server packages provide.
Another requirement is a SSH client
like the free tool Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) that you can use to create a ssh connection to your server.
Use putty to connect to your server by entering your domain address or your server’s IP and the port 22.
What is left is entering your username and password (most of the times your cpanel login data) and you are set.
You are now able to run the 2 short and easy but very powerful linux commands to zip and unzip your folders and files directly at the server, using the command line tool putty.
To zip a folder just enter the following commands:
zip -9 -r %zipfile name% %folder name%
…. or to zip a single file:
zip -9 %zipfile name% %file name%
9 is the compression being used (compression level 9 is best/slower and 1 is worst/fastest). I always use 9. Thats is it. Once you have created the zip file, feel free to download it to your PC or Mac.
Of course this also works the other way around. To unzip a file just use this command:
unzip %zipfile name%
And again that‘s it! Easy isn’t it? The best thing though is that this small little step saves you a ton of time!
To the guys that never have worked with a linux command-line-tool before here is another small tip that you might find useful.
To navigate on your command-line-tool one level down (deeper) just use:
To navigate one level up (back), use:
To see what files and folders are at the level where you are at that moment use:
(this is written in small LS -L)
Of course there are a ton more linux commands and parameters that you can add to your commands but you do not have to do that. Just remember those couple things I mentioned in this post and backing up your files in future will only take a very small fraction of the time it took you before.
If you have any questions, just let me know by posting a comment.
If you like this post, feel free to subscribe to my free RSS Feed to get notified about cool posts and time savers in future.
P.S. The sign % at the command line example is just a token! Do not use it. Instead write out the full filename like:
zip -9 -r myzipfile.zip myscript
P.P.S. The inspiration for that post came from reading Keller’s post: Moving WordPress to another host
(She has done an awesome job btw.!). Up and downloading many files from and to a server is a pain in the a**, I know that. I hope I make you guys life easier in future as you now simply can move most things in one file! And of course another advantage is – since the files are bundled – they surely do not break during the transfer.