[thelist] Backing up linux machine

mark mckee lists at soddengecko.com
Wed Aug 27 12:54:03 CDT 2008

Hi Mark

I had the same issue on my ubuntu servers, and I flat out refuse to pay 
money for any piece of software to do something a command line will do. 
I would assume the following command will work on centos but please 
check it out before you use it. this method uses tar to backup your 
files, so ensure you have tar installed. you will also need untar 
installed for recovery.

*tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found 
--exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/var/www 
--exclude=/media /*

basically this command will make a file called backup.tgz in your root 
folder (location can be changed) of everything on the system except 
those listed as excludes. to change the files it tars, then you need to 
change the ending */* to the folder path

I use this to simply take a snapshot of the entire server and then 
another cron will move it via ssh to another storage machine. It is 
simple for me this way, but you may want to incorporate it into one 

For incremental backups you will need to look into date modifiers in the 
filename, something like this:

*backup-$(date +%d-%m-%Y).tgz*

which will output: *backup-27-08-2008.tgz*

If we apply the date modifier to the original command we end up with 
something like this:

*tar cvpzf backup-$(date +%d-%m-%Y).tgz --exclude=/proc 
--exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt 
--exclude=/sys --exclude=/var/www --exclude=/media /*

You can modify this script for your WWW folders etc, and create a cron 
to run it whenever you please. You will then need to create a script 
that the cron can execute.

If you want more info just mail me off list and i will see what i can do.

Mark Mckee

Mark MacInnes wrote:
> Hey all,
> We've recently got a Linux machine for our internal web server - previously
> we had Apache installed on someone's Windows machine. We want to automate
> incremental backing up of the server. We have a huge external HDD, but its
> currently NTFS and I've read that we'd need to create a linux partition so
> the linux server can backup to it. Is this right? Can anyone recommend the
> best way of doing this?
> The server is running Centos 4. I can't find anything on there to
> incrementally backup the machine - we're planning on using cronjob to
> automate this so we have the automation bit planned out. Can anyone
> recommend a program to do this, or commands or maybe a tutorial? Searching
> google provides limited results - I assume I'm not searching the right
> terms.
> Thanks in advance!
> Mark MacInnes

More information about the thelist mailing list