Every system should have backups. In case of emergency, backup are very useful. Your backup can save you hours of down time with a minimum impact.
There's is some tools you can use to backup your entire system or your most important files.
rsync are some tools you can use to backup files and folders.
automysqlbackup is a tool to backup your MySQL databases.
Here's an example of a folder backup including all the sub-folders and files within.
tar -cvf archive-name.tar dir1 dir2 dir3....
Now, let's compress it:
gzip -9 archive-name.tar
You can use
bzip2 instead. bzip2 has a better compression rate but is a little slower.
To combine both command, you can use the
dumpis written specifically for backups. It backs up the entire file system and allows multiple levels of backups. The corresponding
restorecommand allows for restore from a dump backup.
For example, to backup /boot file system:
dump 0zf backup.boot /boot
There's an easy command to backup MySQL databases.
automysqlbackup can automatically make daily, weekly, and monthly backups of your MySQL database.
sudo aptitude install automysqlbackup
sudo vi /etc/default/automysqlbackup
All the backup are stored in the
by default. It is recommended to change this folder. To change the default backup folder, edit the file and modify the
BACKUPDIR= to the new location.
You can also receive an email if there's an error while running the backup. To do this, you need to change the
MAILADDR= and add your email address.
You can backup your entire home folder using the
zip command. If you want to exclude some folder, you need to use the
zip -r myzipbackup.zip * --exclude=access_log --exclude=public_ftp --exclude=tmp