Doing Backups on Linux

Every system administrator should know that server backups are necessary and they must be configured so soon as possible. One of the first things you're taught as an IT professional. And yet every day another unlucky soul ends up with corrupted or deleted data, because the server hanged or the hard disk broke and suddenly realized that they forgot to setup a backup. Sounds familiar? I hope not, but almost everyone ends up in that place, eventually. Lett's at least try not to repeat these mistakes.

So, today, let me show you the basics of setting up a backup on your Linux system. Let’s assume that you’ have a website on your server, and you want to have a backup copy on the same server somewhere, and you'll probably will want to send it to another computer, too. We’ll need to create a backup directory, and we'll use the following scripts:

[root@serversuit ~]# mkdir /backups
[root@serversuit ~]# nano /backups/
tar -cvzf /backups/www.tar.gz /var/www

[root@serversuit ~]# nano /backups/
[root@serversuit ~]# chmod +x /backups/
[root@serversuit ~]# /backups/
[root@serversuit ~]# ls /backups/ -g –h
-rwxr-xr-x 1 root   49 May 13 15:16
-rw-r--r-- 1 root 111M May 13 15:18 www.tar.gz

If we add this script to cron to run daily, you’ll always have the current site's HTML files backed up to the server's /backup directory. You can download it to another computer, too. What if your website is not just HTML or PHP files, but MySQL database files too?  There's a slightly altered script to do that as well:

[root@serversuit ~]# nano /backups/
tar -cvzf /backups/www.tar.gz /var/www
mysqldump –u root -pPASSWORD DATABASE > /backups/dump.sql

You’ll need to provide the root password and database name to make script work. Please be aware that your MySQL database backup can take a long time and significantly increase server load. That script can be used for relatively small databases, but it should probably be run overnight to avoid overloading your server. This is the script you'll need to add the backup to cron and run it overnight:

[root@serversuit ~]# crontab -e
0 3 * * *       /backups/

This will run a script ‘’ once a day at 3am, overwriting old backup files. It’s not too hard at all... just time consuming, especially in cases where you have multiple servers or websites.

But hey, that's why we built ServerSuit.

We can help with that too. We have a preconfigured backup tool you can easily setup on your servers with just a few clicks, and no coding requires. Use it to safely backup your domains, MySQL databases, and FTP folders. You can access your server backups through ServerSuit's browser dashboard. Try it out! ServerSuit is free for 30-days when you first sign up! Check us out!

Until next time!

This article was originally published in May 2016.

July 08 2020

Add or review comments

Please leave your comment

Existing comments

Comments 22

The article is really good and has lots of knowledge, I wish to read more new article as I find it much beneficial.
this is really good information...thank you for sharing with us...
[url=]free tranny porn videos[/url]
[url=]free hispanic porn videos[/url]
cialis bulas med <a href="">tadalafil cost walmart</a> cialis nitrostat
consecuencias pastilla cialis <a href="">much does cialis cost without insurance</a> dividere pillola cialis
cialis name meaning <a href="">how much does cialis cost without insurance</a> cialis pompelmo
cialis efficacy for bph <a href="">cialis generika genauso gut</a> cialis pharmacie nice
cialis generika 5g <a href="">prices for cialis in canada</a> lilly cialis fiyat
payday loans online lakewood <a href="">cash advances online dothan</a> no fax payday loans plano
We accept BitCoin - <a href="">retin a shortage in canada</a> nombre generico cialis
We accept BitCoin - <a href="">tretinoin gel buy</a> cialis docmorris
We accept BitCoin - <a href="">isotretinoin online no prescription</a> cialis 5 mg contraindicaciones
payday loans round rock tx <a href="">Payday Loans Stock</a> , <a href="">cash advanced in indio</a> cash advance america columbus
advance cash faxing no <a href="">Payday Loans Wauseon</a> , <a href="">cash advance stores in pickerington ohio</a> merchant cash advance manhattan beach
billig viagra cialis <a href="">brand cialis no prescription</a> generic cialis in bangkok
cialis urinary frequency <a href="">generic cialis pharmacy</a> is generic cialis real
cialis objednavka <a href="">does generic cialis exist</a> liquid cialis results
what makes cialis more effective <a href="">cheap generic cialis online</a> cialis purchases
<a href="">brand cialis for sale</a> does cialis cause rapid heart beat <a href="">brand cialis 100mg</a> / <a href="">erectile dysfunction cialis</a>
<a href="">order cialis without a prescription</a> does cialis have enteric coating <a href="">cialis usa</a> / <a href="">how long does cialis 20mg last</a>
grand ages medieval cheat enginedell xps gen 3microsoft 12 days of deals leakdarksiders 2 deathinitive edition trainerricoh aficio sp 6330nasus wireless lan carddark souls prepare to die edition white screenfishing bot for wowyoga pro 3 windows 10what is nti backup [url=Цели/]samsung se-506cb driver [/url] [url=]adblink device unauthorized fire tv [/url] [url=]qualcomm atheros ar5bwb222 connectivity problems [/url] [url=]gta v ps3 to ps4 transfer [/url] [url=]turbo mailer 2.7 10 [/url] [url=]verizon black friday 2016 deals [/url] [url=]magic lantern canon 60d [/url] [url=интерактивная школа/]fallout 4 preset mods [/url] [url=]integra dtr 30.7 reviews [/url] [url=]rog strix b350-f gaming drivers [/url] songwriter's pad free download mac mini audio out farming simulator 17 save game editor year beast brawl dota 2 logitech hd pro webcam c910 softwareхарактер+холерика/ creative zen touch 2 amd radeon hd 8250 polaroid snap firmware update dap-1320 firmware hp pavillion dv7 drivers dan aykroyd webbed toes ben 10 savage pursuit game anvi smart defender review fallout 4 lonesome rhode dlc release date playstation tv usb storage mahjong garden to go full version usb-bt400 driver windows 10 fallout new vegas card deck dell dimension xps gen 4 marta fifa 16 rating