BACKUP AND
RESTORE
In this chapter we can do following things using backup and restore
commands
- backup
- restore
- rootvg backup
- restore rootvg backup
- non rootvg backup(other than rootvg)
- restore non rootvg backup(other than
rootvg)
- rewind, eject and erase the tape
1. Backup
Using backup and tar command to we can take full backup and incremental
backup
Using tar command we
can normal backup, in this tar we cannot take day wise incremental backup
#tar –cvf destination
source
#tar –cvf /dev/rmt0
/usr/sbin
#backup –if /dev/rmt0
/usr/sbin (For AIX full backup)
/usr/sbin directory
files is backup to tape
Using backup command
we can take incremental backup, this backup command is particularly for AIX.
In this backup command we can specify the day (0(sun) – 6(sat)).
Suppose you want to take Sunday backup then your command will be
#backup -0 –vf
destination source
#backup -0 –vf
/dev/rmt0 /var
#backup -6 –vf
/dev/rmt0 /var (Saturday backup)
/var file system log
is backup to tape
Like this we can take normal and incremental backup in AIX
2. Restore
Using tar and restore command we can restore the data in server
Using tar command we can restore data to server, this is normal restore
#tar –xvf /dev/rmt0
The tape backup is restored to /data directory.
Using restore command we can restore the data
#restore –xdf
/dev/rmt0
The tape data is restored in current directory.
Like this we can restore the data in AIX
3. rootvg backup
Using mksysb command we can take the rootvg (AIX OS) backup
#mksysb –i /dev/rmt0
#mksysb –ie /dev/rmt0
(exclude backup – please read NOTE message)
i option is used for
crate the image.data file created in tape
This image.data file
contains all the file system information’s in rootvg while restore the rootvg
backup, before start the restore it will read the information’s from the image.data
file
After the command
execution rootvg backup created in tap, suppose OS got corrupted, that time we
can restore the os from rootvg backup.
NOTE: While taking
rootvg backup we can exclude unwanted file systems in backup process. Suppose
you not required following file systems in mksysb backup,
/var – log files
That time you should put entry in /etc/exclude.rootvg,
While creating the rootvg backup, first tape is spitted in to 4 blocks
(block size is 512)
First block has boot image.
The BOS boot image contains a copy of the
system’s kernel and device drivers
needed to boot from the mksysb tape. It is
created by the bosboot command.
Second block has following things, 1.
/tapeblksize, 2. /image.data, 3. bosinst.data.
1. /tapeblksize
The /tapeblksize file contains the block
size the tape drive was set to when the mksysb
command was run.
2. /image.data
The /image.data file
store the information about rootvg, like vg, pp, pp size, lv, lv size, FS
The image.data file
resides in /var/adm/ras/image.data
3. /bosinst.data
The ./bosinst.data file allows you to
specify the requirements at the target system
and how the user interacts with the target
system. This file contains the
customized BOS install procedures and
dictates how the BOS install program will
behave. You can customize this file before
issuing the mksysb command or
use a
procedure to customize this file after the
image backup is done.
Third block has dummy toc file,
The dummy table of contents (TOC) is used
so that the mksysb tape contains
the
same number of images as a BOS install
tape.
Fourth block has data, that is rootvg
original data
4. Restore rootvg
backup
Using restore command we can restore the rootvg backup
Boot server with bos
(base operating system) Cd, then go to maintenance mode and access the rootvg,
then run the following command
#restore –T –d –v –q
–f /dev/rmt0
Or
Boot server with bos
CD, then go to maintenance mode and initiate the rootvg backup (one option
available in maintenance mode).
Like this we can restore the rootvg backup
5. Backup the non
rootvg backup
Using savevg command we can backup the non rootvg backup
Suppose your server has 3 volume groups
#lsvg
Rootvg
Datavg
Oraclevg
#
Now you want to take datavg backup, then your command will be
#savevg –if /dev/rmt0
/datavg
#savevg –ief
/dev/rmt0 /datavg
Datavg volume group is backup to tape
NOTE: While taking
restvg backup we can exclude unwanted file systems in backup process. Suppose
you not required following file systems in mksysb backup,
/var – log files
That time you should put entry in /etc/exclude.datavg,
6. Restore the non
rootvg backup
Using restvg command we can restore the non rootvg backup
#restvg –xdf
/dev/rmt0
After command
execution datavg backup restored to server with same name while importing vg we
can change the vg name.
7. Rewind, Eject,
Erase the tape
Using tctl command we can rewind, eject and erase the tape drive.
#tctl –f /dev/rmt0
rewind (To rewind the tape)
#tctl –f /dev/rmt0
eject (To eject the tape)
#tctl –f /dev/rmt0
erase (To erase the tape content)