Backup & Recovery
1)mksysb
mksysb command creates a bootable image of all mounted file systems on the rootvg volume group. You can use this backup command to restore a system to its original state.
User defined paging spaces,unmounted file systems, raw devices are not backed up.
+Data layout of a mksysb tape
BOSBOOT IMAGE mkinsttape image dummy.toc rootvg-data
-BOSBOOT image=kernel,device drivers needed to boot from mksysb tape. created by bosboot.
-mkinsttape image=
./tapeblksz=block size the tape drive was set to when mksysb command was run.
./image.data=image installed during the BOS installation process ,includes sizes,name,maps,mount points of logical volumes and filesystems in rootvg, u can customize it before running mksysb or run
-->mksysb -i
to generate a new ./image.data file on tape
during backup
-->mkszfile
generates the ./image.data file.
+dummy toc is used so that the mksysb tape contains the same number of images as as BOS install tape.
>Excluding file systems from a backup
-->cat /etc/exclude.rootvg
^./tmp/
Then run
-->mksysb -e /dev/rmt0
-e exclude the contents of exclude.rootvg
>How to create a bootable system backup
-->smitty mksysb
you cannot run the mksysb command against a uservg,use savevg, tar,cpio, backup commands to backup uservg.
>List content of a mksysb image
To verify the content of an mksysb image
-->smitty lsmksysb
>Restore a mksysb image
mksysb image enables you to restore the system image onto target systems that might not contain the same hardware devices or adapters, require the same kernel (uniprocessor of microprocessor)
or be the same hardware platform as the source sytem.
You have several possibilities to restore the mksysb image.
1)If restoring on exactly the same machine , you can boot directly from the mksysb media and restore from there
2)If restoring on a different type of machine, use cloning function -->smit alt_clone
3)If you do not want to interfere with the production environment,use alternate disk install using mksysb
4)If you want to restore only several files from the mksysb image
-->smitty restmksysb
use the (.)dot before the filename ,ex ./etc/hosts
>tctl command
-->tctl -f /dev/rmt0 rewind
C)Backup Strategies
3 types of backup methods
1-Full backup
2-Differential backup
3-Incremental backup
1.Full backup
2.Differential backup
Only modified files are backed up, but only if they changed after the latest full backup.These are cumulative ,once a file has been modified it will be included in every differential backup untill next full bakcup.
Advantages-To restore ,the latest full backup and only the latest differential backup media sets are needed.
-Backup window is smaller than a full backup.
Disadvantage
If data changes a lot between full backups then number of differential backups increased very much.
3.Incremental backup
Also back up modified files only, however incremental backup checks the difference between the modification time of a file and the last backup time (either being full or incremental backup). IF the modification date is more recent than the last backup date,the file is backed up.
Advantages
-Backup window is smaller than a full backup
-Only the difference from a previous backup will be written on media.
Disadvantages
-To restore , the latest full backup and all the subsequent incremental backup media sets following that full backup are needed.
-To restore a single file, tape handling operations are intensive
-A damaged or lost media in the incremental set can mean disaster. The modification of those files on that media may be lost forever.
D)Related backup and restore commands
1)savevg -->smit savevg
To backup uservg
The savevg command uses a data file created by the mkvgdata.
-->/tmp/vgdata/vgname/vgname.data
This vgname.data file contains information about a userr vg. The savevg command uses this file to create a backup image that can be used by the restvg when it restores the vg.
-->savevg -e /dev/rmt0 datavg
-e exclude files specified in /etc/exclude.vgname file
-u updates the /etc/dumpdates file with raw device name of filesystem , & the time date and level of the backup. You must specify -u flag if you are making incremental backups
2)restvg: --> smit restvg
Restores the uservg and all its containers and files
-->restvg -f /dev/rmt0 hdiskn
3)Backup
backup files and filesystems.
-To backup all the files and subdirectories in the /home directory using full path names
-->find /home -print | backup -i -f /dev/rmt0
Because the files are archived using full path names, they will be written to the same paths when restored.
-To backup the /(root) filesystem
-->backup -0 -u -f /dev/rmt0 /
-0 zerolevel specifies that all files in /(root) filesystem be backed up.
-u update the /etc/dumpdates file
-To backup all the files in the /(root)
filesystem that have been modified since the last level 0 backup
-->backup -1 -u -f /dev/rmt0 /
4)restore
Extracts files from archives created with the backup command
To exclude data that you do not want to restore from a specific path, use find and pring and send result to the restore.
To restore an entire filesystem archive
-->restore -rvqf /dev/rmt0
-f device
-a medium is ready
-v verbose
Restores the entire filesystem archived on the tape device /dev/rmt0, into the current directory.
To restore a specific directory and the contents of that directory from a archive
-->restore -xdvqf /dev/rmt0 /home/mike/tools
-x extract files by their name
-d extract all files & subdirectories in the /home/mike/tools/ directory.
-->restore -d /vg-backup/latest-backup(file) hdisk2
5)tar
-->tar -cvf /dev/rmt0 /home
-->tar -tvf /dev/rmt0
list contents of file
-->tar -xvf /dev/rmt0
extract in current directory
6)cpio
To copy files in the current directory onto diskette
-->cpio -ov > /dev/fd0
This copies all the files in the current directory whose names end with .c
To copy the current directory and all subdirectories onto diskette
-->find .-print | cpio -ov > /dev/fd0
Saves the directory tree that starts with the current directory(.) and includes all of its subdirectories and files
-o Read from standard input & copies to standard output
-v List filenames
7)pax
-->pax -wf /dev/rmt0
copy the contents of current directory to the tape drive --> pax -rw file1 /tmp
copy file1 to /tmp
8)gzip -c file
compress file
9)gzip -d file.gz
decompress
10)tcopy
-->tcopy /dev/rmt0 /dev/rmt1
-->tcopy /dev/rmt0
Layout of the mksysb image
E)Verify the content of a backup media
It is a good practice to verify the readability to eliminate trouble at recovery time, to avoid tape incomatibilities ,damaged media or missing files.
If backup media has difficulties while reading the tape, check below steps
1.Media is not damaged , try another media.
2.Verify that you have latest drivers installed for your backup device
3.Check that the backup device is turned on
4.Try the media on another server
5.Change the block_size parameter or the tape streamer to 0(auto detect)
1)mksysb
mksysb command creates a bootable image of all mounted file systems on the rootvg volume group. You can use this backup command to restore a system to its original state.
User defined paging spaces,unmounted file systems, raw devices are not backed up.
+Data layout of a mksysb tape
BOSBOOT IMAGE mkinsttape image dummy.toc rootvg-data
-BOSBOOT image=kernel,device drivers needed to boot from mksysb tape. created by bosboot.
-mkinsttape image=
./tapeblksz=block size the tape drive was set to when mksysb command was run.
./image.data=image installed during the BOS installation process ,includes sizes,name,maps,mount points of logical volumes and filesystems in rootvg, u can customize it before running mksysb or run
-->mksysb -i
to generate a new ./image.data file on tape
during backup
-->mkszfile
generates the ./image.data file.
+dummy toc is used so that the mksysb tape contains the same number of images as as BOS install tape.
>Excluding file systems from a backup
-->cat /etc/exclude.rootvg
^./tmp/
Then run
-->mksysb -e /dev/rmt0
-e exclude the contents of exclude.rootvg
>How to create a bootable system backup
-->smitty mksysb
you cannot run the mksysb command against a uservg,use savevg, tar,cpio, backup commands to backup uservg.
>List content of a mksysb image
To verify the content of an mksysb image
-->smitty lsmksysb
>Restore a mksysb image
mksysb image enables you to restore the system image onto target systems that might not contain the same hardware devices or adapters, require the same kernel (uniprocessor of microprocessor)
or be the same hardware platform as the source sytem.
You have several possibilities to restore the mksysb image.
1)If restoring on exactly the same machine , you can boot directly from the mksysb media and restore from there
2)If restoring on a different type of machine, use cloning function -->smit alt_clone
3)If you do not want to interfere with the production environment,use alternate disk install using mksysb
4)If you want to restore only several files from the mksysb image
-->smitty restmksysb
use the (.)dot before the filename ,ex ./etc/hosts
>tctl command
-->tctl -f /dev/rmt0 rewind
C)Backup Strategies
3 types of backup methods
1-Full backup
2-Differential backup
3-Incremental backup
1.Full backup
2.Differential backup
Only modified files are backed up, but only if they changed after the latest full backup.These are cumulative ,once a file has been modified it will be included in every differential backup untill next full bakcup.
Advantages-To restore ,the latest full backup and only the latest differential backup media sets are needed.
-Backup window is smaller than a full backup.
Disadvantage
If data changes a lot between full backups then number of differential backups increased very much.
3.Incremental backup
Also back up modified files only, however incremental backup checks the difference between the modification time of a file and the last backup time (either being full or incremental backup). IF the modification date is more recent than the last backup date,the file is backed up.
Advantages
-Backup window is smaller than a full backup
-Only the difference from a previous backup will be written on media.
Disadvantages
-To restore , the latest full backup and all the subsequent incremental backup media sets following that full backup are needed.
-To restore a single file, tape handling operations are intensive
-A damaged or lost media in the incremental set can mean disaster. The modification of those files on that media may be lost forever.
D)Related backup and restore commands
1)savevg -->smit savevg
To backup uservg
The savevg command uses a data file created by the mkvgdata.
-->/tmp/vgdata/vgname/vgname.data
This vgname.data file contains information about a userr vg. The savevg command uses this file to create a backup image that can be used by the restvg when it restores the vg.
-->savevg -e /dev/rmt0 datavg
-e exclude files specified in /etc/exclude.vgname file
-u updates the /etc/dumpdates file with raw device name of filesystem , & the time date and level of the backup. You must specify -u flag if you are making incremental backups
2)restvg: --> smit restvg
Restores the uservg and all its containers and files
-->restvg -f /dev/rmt0 hdiskn
3)Backup
backup files and filesystems.
-To backup all the files and subdirectories in the /home directory using full path names
-->find /home -print | backup -i -f /dev/rmt0
Because the files are archived using full path names, they will be written to the same paths when restored.
-To backup the /(root) filesystem
-->backup -0 -u -f /dev/rmt0 /
-0 zerolevel specifies that all files in /(root) filesystem be backed up.
-u update the /etc/dumpdates file
-To backup all the files in the /(root)
filesystem that have been modified since the last level 0 backup
-->backup -1 -u -f /dev/rmt0 /
4)restore
Extracts files from archives created with the backup command
To exclude data that you do not want to restore from a specific path, use find and pring and send result to the restore.
To restore an entire filesystem archive
-->restore -rvqf /dev/rmt0
-f device
-a medium is ready
-v verbose
Restores the entire filesystem archived on the tape device /dev/rmt0, into the current directory.
To restore a specific directory and the contents of that directory from a archive
-->restore -xdvqf /dev/rmt0 /home/mike/tools
-x extract files by their name
-d extract all files & subdirectories in the /home/mike/tools/ directory.
-->restore -d /vg-backup/latest-backup(file) hdisk2
5)tar
-->tar -cvf /dev/rmt0 /home
-->tar -tvf /dev/rmt0
list contents of file
-->tar -xvf /dev/rmt0
extract in current directory
6)cpio
To copy files in the current directory onto diskette
-->cpio -ov > /dev/fd0
This copies all the files in the current directory whose names end with .c
To copy the current directory and all subdirectories onto diskette
-->find .-print | cpio -ov > /dev/fd0
Saves the directory tree that starts with the current directory(.) and includes all of its subdirectories and files
-o Read from standard input & copies to standard output
-v List filenames
7)pax
-->pax -wf /dev/rmt0
copy the contents of current directory to the tape drive --> pax -rw file1 /tmp
copy file1 to /tmp
8)gzip -c file
compress file
9)gzip -d file.gz
decompress
10)tcopy
-->tcopy /dev/rmt0 /dev/rmt1
-->tcopy /dev/rmt0
Layout of the mksysb image
E)Verify the content of a backup media
It is a good practice to verify the readability to eliminate trouble at recovery time, to avoid tape incomatibilities ,damaged media or missing files.
If backup media has difficulties while reading the tape, check below steps
1.Media is not damaged , try another media.
2.Verify that you have latest drivers installed for your backup device
3.Check that the backup device is turned on
4.Try the media on another server
5.Change the block_size parameter or the tape streamer to 0(auto detect)
No comments:
Post a Comment