HostedDB - Dedicated UNIX Servers

Securing-Optimizing-RH-Linux-1_2_454
Comments and suggestions concerning this book should be mailed to gmourani@videotron.ca © Copyright 1999-2000 Gerhard Mourani and Open Network Architecture ® 454 fi Here is an abbreviated look of the backup directory after one week: [root@deep /]# ls -l /backups/ total 22217 -rw-r--r--    1 root     root       10731288   Feb  7 11:24 deep-01Feb.tar -rw-r--r--    1 root     root                 6879   Feb  7 11:24 deep-Fri.tar -rw-r--r--    1 root     root           2831   Feb  7 11:24 deep-Mon.tar -rw-r--r--    1 root     root                 7924   Feb  7 11:25 deep-Sat.tar -rw-r--r--    1 root     root       11923013   Feb  7 11:24 deep-Sun.tar -rw-r--r--    1 root     root                 5643   Feb  7 11:25 deep-Thu.tar -rw-r--r--    1 root     root                 3152   Feb  7 11:25 deep-Tue.tar -rw-r--r--    1 root     root                 4567   Feb  7 11:25 deep-Wed.tar drwxr-xr-x   2 root     root           1024   Feb  7 11:20 last-full NOTE: The directory where to store the backups (BACKUPDIR), and the directory where to store time of full backup (TIMEDIR) must exist or be create before the use of the backup-scrip or you will receive an errors message. Step 2 If you are not running this backup script from the beginning of the month (01-month-year), the incremental backups will need the time of the Sunday backup to be able to work. If you start in the middle of the week, you will need to create the time file in the TIMEDIR. · To create the time file in the TIMEDIR directory, use the following command: [root@deep /]# date +%d%b > /backups/last-full/myserver-full-date Where </backups/last-full> is our variable TIMEDIR where we want to store time of full backup, and <myserver-full-date> is is the name of your server (e.i. deep) and our time file consisting of a single line with the present date (e.i. 15-Feb). Step 3 Make this script executable and change it default permission to be writable only by the super-user “root” (755). [root@deep /]# chmod 755 /etc/cron.daily/backup.cron NOTE: Because this script is on the “/etc/cron.daily” directory it will be automatically run as a cron job at one o'clock in the morning every day. Restoring files with tar More important than performing regular backups is having them available when we need to recover important files! In this section, we will discuss methods for restoring files, which have been backed up with “tar” command. The following command will restore all files from the “full-backup-Day-Month-Year.tar” archive, which is an example backup of our “home” directory created from the example tar commands shown above. · To restore a full backup of the “home” directory, use the following command: [root@deep /]# cd / [root@deep /]# tar xpf /dev/st0/full-backup-Day-Month-Year.tar