Objectives
After completing this unit, students should be able to:
Identify issues which have to be considered when
deciding which backup f r ompolicies to implement:
Media to be ria l
a t eused
IX M of the backup
Frequency
A
Type TofSbackup
B
List the different backup methods supported through
SMIT and on the command line
Create a customized installable system image backup
Execute other useful commands to manipulate the
backed up data on the media
Why Backup?
Data is very important:
Expensive to recreate
Can it be recreated?
f r o m
Disaster recovery: ria l
Hardware a t e
I X Mfailure
A due to installation/repair
Damage
BTS deletion
Accidental
Transfer of data between systems
Reorganizing file systems
Defragmentation to improve performance
System image for installation
Checkpoint (before/after upgrade)
Long term archive
Why Restore?
Recover files
"I've just deleted file abc by mistake"
Compare versions fof r ofiles
m
l
eria fixed in 6.0.22"
"I'm sure itatwas
M
AIXsystem after disaster
Recover
S that the plumber has been in ..."
BTnow
"well
Restore archived data
"you remember that project we did in 1997 ..."
Shrink a file system
Types of Backup
Three types of backup:
System
fromof the operating system
Records image backup
l
Full a t eria
M
AIX all user data and configuration files
Preserves
rootvg
BTS
Incremental
Records changes since previous backups
Must be used carefully
Very quick
Backup Strategy
Backup all data that changes!
System backup
f ro m
ri a l
at e
M
AIX Full backup
BTS
Incremental backup
Incremental backup
Backup Devices - Diskette
/dev/fd0 Built in 3 1/2" diskette drive
/dev/fd1 Second diskette drive
f ro m
ri a l
at e
M Drive
AIX
BTS 3 1/2"(1.44) 3 1/2"(2.88)
/dev/fdxl 720 KB 720 KB
/dev/fdxh 1.44 MB 2.88 MB
/dev/fdx.9 720 KB 720 KB
/dev/fdx.18 1.44 MB 1.44 MB
/dev/fdx.36 - 2.88 MB
Backup Devices - Tape
4 mm DAT 1/2 - inch
8 mm DLT
l f r
Low om Retension on Rewind on
e ria
IX Mat Capacity Open Close
A
/dev/rmtx S no no yes
BT
/dev/rmtx.1 no no no
/dev/rmtx.2 no yes yes
/dev/rmtx.3 no yes no
/dev/rmtx.4 yes no yes
/dev/rmtx.5 yes no no
/dev/rmtx.6 yes yes yes
/dev/rmtx.7 yes yes no
Backup Device - Read/Write Optical Drive
Use with CD-ROM file system for
m
ia l fro read only operations
a t er
M Use with journal file systems for
AIX read/write operation
BTS
Backup Menus
System Storage Management (Physical and
Logical) Logical Volume Manager
File Systems
Files and Directories
f ro m
System Backup Manager
ri a l
M ate
AIX
File Systems Files and Directories
Back up a File System Back up a File or Directory
B aSFile System
T
Restore
List Contents of a Backup
Restore a File or Directory
List Contents of a Backup
Logical Volume Manager
Volume Groups
Logical Volumes
Physical Volumes
Paging Space
System Backup Manager Volume Groups
Back up the System Back up a Volume Group
List Files in a System Image Remake a Volume Group
Restore Files in a System Image List Files in a Volume Group Backup
Restore Files in a Volume Group Backup
rootvg Backup Process - mksysb
Backs up rootvg only
Unmounted file systems are not backed up
m
l fro in backup format
Bootable tape isiacreated
a t er
Provides M
IX facilities for a non-interactive installation
A
TS
SavesBsystem-created paging space definitions
Saves logical volume policies
There should be minimal user and application activity
/image.data File for rootvg
image data:
IMAGE_TYPE=bff
DATE_TIME=Wed May 9 15:07:28 PDT 2001
UNAME_INFO=AIX sys2 1 5 000930134C00
PRODUCT_TAPE=no
USERVG_LIST=
OSLEVEL=4.3.1.0 f ro m
ri
logical_volume_policy:a l
at e
SHRINK=no
M
AIX
ils_data:
EXACT_FIT=no
BTS LANG=C
#Command used for vg_data, /usr/sbin/lsvg
lsvg_data:
VGNAME=rootvg
PPSIZE=4
VARYON=yes
VG_SOURCE_DISK_LIST=hdisk0 hdisk1
#Command used for source_disk_data: /usr/sbin/bootinfo
source_disk_data: (stanza is repeated for each disk in rootvg)
LOCATION=(disk location)
SIZE_MB=(size of disk in megabytes)
HDISKNAME=(disk name)
#Command used for lv_data; /usr/sbin/lslv
lv_data: (stanza for each logical volume in rootvg)
.
.
fs_data: (stanza for each MOUNTED filesystem in rootvg)
/bosinst.data File for rootvg
control_flow:
CONSOLE =
INSTALL_METHOD = overwrite
PROMPT = yes
EXISTING_SYSTEM_OVERWRITE = no
INSTALL_X_IF_ADAPTER = yes
RUN_STARTUP = yes
RM_INST_ROOTS = no f ro m
ERROR_EXIT =ri a l
at e
CUSTOMIZATION_FILE =
M
AIX
TCB = no
INSTALL_TYPE =
BTS
BUNDLES =
RECOVER_DEVICES = yes
BOSINST_DEBUG = no
ACCEPT_LICENSES =
INSTALL_64BIT_KERNEL = no
INSTALL_CONFIGURATION = Default
DESKTOP = CDE
target_disk_data:
LOCATION =
SIZE_MB =
HDISKNAME =
locale:
BOSINST_LANG =
CULTURAL_CONVENTION =
MESSAGES =
KEYBOARD =
rootvg Image Backup
# smit mksysb
Back Up the System
Type or select values in entry fields.
f ro m
Press Enter AFTER making all desired changes.
ri a l [Entry Fields]
e
Mat
WARNING: Execution of the mksysb command will
AIX
result in the loss of all material
previously stored on the selected
BTS output medium. This command backs
up only rootvg volume group.
* Backup DEVICE or FILE [] +/
Create MAP files? no +
EXCLUDE files? no +
List files as they are backed up? no +
Generate new /image.data file? yes +
EXPAND /tmp if needed? no +
Disable software packing of backup? no +
Number of BLOCKS to write in a single output [] #
(Leave blank to use a system default)
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
mksysb Image
Blocksize = Blocksize = Blocksize = Tape Drive
512 512 512 Blocksize
f ro m
ri a l
BOS Boot amkinsttape
te dummy rootvg
M
AIX
image image .toc data
BTS
Kernel ./image.data Dummy TOC backup
Device Drivers ./bosinst.data by name
Non-rootvg Backup
# smit savevg
Back Up a Volume Group to Tape/File
Type or select values in entry fields.
f ro m
Press Enter AFTER making all desired changes.
ri a l [Entry Fields]
e
Mat
WARNING: Execution of the savevg command will
result in the loss of all material
AIX previously stored on the selected
BTS output medium.
* Backup DEVICE or FILE [] +/
* VOLUME GROUP to back up [] +
List files as they are backed up? no +
Generate new vg.data file? yes +
Create MAP files? no +
EXCLUDE files? no +
EXPAND /tmp if needed? no +
Disable software packing of backup? no +
Number of BLOCKS to write in a single output [] #
(Leave blank to use a system default)
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
Restoring a mksysb (1 of 2)
Boot the system in install/maintenance mode:
Welcome to Base Operating System
Installation and Maintenance
f ro m
1 l
Start Install Now With Default Settings
ri a
2 at e
Change/Show Installation Settings and Install
>> 3 M Start Maintenance Mode for System Recovery
AIX
BTS
Maintenance
1 Access A Root Volume Group
2 Copy a System Dump to Removable Media
3 Access Advanced Maintenance Functions
>> 4 Install from a System Backup
Choose Tape Drive
Tape Drive Path Name
>> 1 tape/scsi/4mm/2GB /dev/rmt0
Restoring a mksysb (2 of 2)
Welcome to Base Operating System
Installation and Maintenance
ro m
Type the number of your choice and press Enter. Choice is indicated by >>.
f
1 ri a l
Start Install Now With Default Settings
>> 2 at e
Change/Show Installation Settings and Install
M
AIX
3 Start Maintenance Mode for System Recovery
BTS
System Backup Installation and Settings
Type the number of your choice and press Enter.
1 Disk(s) where you want to install hdisk0
2 Use Maps No
3 Shrink Filesystems No
0 Install with the settings listed above
Restoring a non-rootvg Volume Group
# smit restvg
Remake a Volume Group
f ro m
ri a l
Type or select values in entry fields.
ate
Press Enter AFTER making all desired changes.
M
A IX [Entry Fields]
BTtheSfilesystems?
* Restore DEVICE or FILE [/dev/rmt0] /+
SHRINK no +
PHYSICAL VOLUME names [] +
(Leave blank to use the PHYSICAL VOLUMES listed
in the vgname.data file in the backup image)
Use existing MAP files? yes +
Physical partition SIZE in megabytes [] +#
(Leave blank to have the SIZE determined
based on disk size)
Number of BLOCKS to read in a single input [] #
(Leave blank to use a system default)
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
Activity: savevg
Activity:
eria
l f r om
a t
AIX savevg
M
BTS
backup by File Name
backup -i [-q] [-p] [-v] [-f device]
-q media is ready
-p from
compressiafiles
l which are less than 2 GB
-v t
verbosee r
Ma - display filenames during backup
AIX
BTS
Filenames are read from standard input
backup by File Name Examples
Read input from a file
#cat listfile
/home/roy/file1
l f r om
/home/roy/file2ateria
M
AIX
/home/roy/file3
# backupT-iqvfS /dev/rmt0 < listfile
B
Use find to generate list
# find /home/roy | backup -iqvf /dev/rmt0
# cd /home/roy
# find . | backup -iqvf /dev/rmt0
Relative vs Full Filenames will impact
Location of Files on Recovery !
backup a File or a Directory
# smit backfile
Backup a File or Directory
ro m
Type or select values in entry fields.
f
ri a l
Press Enter AFTER making all desired changes.
at e
M [Entry Fields]
AIX
This option will perform a backup by name.
BTS
* Backup DEVICE [/dev/fd0] +/
* FILE or DIRECTORY to backup [.]
Current working DIRECTORY [] /
Backup LOCAL files only? yes +
VERBOSE output? no +
PACK files? no +
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
backup a File System by Inode
Syntax:
backup [-u] [-level] [-f device] filesystem
f ro m
ri a l
Levels provideM ateincremental backups:
IX system back up
-0 FullAFile
S
-1,-2, ...BTbackup changes since level -1
/etc/dumpdates contains a backup history
-u updates /etc/dumpdates
# backup -u -1 -f /dev/rmt0 /home
Incremental backup Example
Sun Mon Tue Wed Thur Fri Sat
1 2
l from level 0
3 M a4 teria 5 6 7 8 9
X
I 6
Alevel level 6 level 6 level 6 level 3
B TS
10 11 12 13 14 15 16
level 6 level 6 level 6 level 6 level 0
17 18 19 20 21 22 23
level 6 level 6 level 6 level 6 level 3
24 25 26 27 28 29 30
level 6 level 6 level 6 level 6 level 0
31
Backup a File System by Inode
# smit backfilesys
Backup a Filesystem
Type or select values in entry fields.
m
l f ro
Press Enter AFTER making all desired changes.
a
ate ri
M
IX will perform a backup by inode. [Entry Fields]
Aoption
This
BTS to backup
* FILESYSTEM
* Backup DEVICE
[]
[/dev/fd0]
+/
+/
Backup LEVEL (0 for a full backup) [0] #
RECORD backup in /etc/dumpdates? no +
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
restore Command
List files on media (Verify the backup)
restore -T [-q] [-v] [-f device]
ro
# restore -Tvf /dev/rmt0
f m
i a l
a t er
IX M
A
RestoreTindividual files.
B S
restore -x [-q] [-v] [-f device] [file1 file2 ..]
# restore -xvf /dev/rmt0 /home/mike/manual/chap1
Restore complete file system
restore -r [-q] [-v] [-f device]
Restore backups in order, that is, -0 then -1 and so forth
# restore -rqvf /dev/rmt0
Restore a File or a Directory
# smit restfile
Restore a File or Directory
f ro m
Type or select values in entry fields.
ri a l
Press Enter AFTER making all desired changes.
M ate
A IX [Entry Fields]
* Restore DEVICE [/dev/fd0] +/
* TargetB TS
DIRECTORY [.] /
FILE or DIRECTORY to restore []
(Leave blank to restore entire archive.)
VERBOSE output? no +
Number of BLOCKS to read in a single input [] #
operation
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
Exercise: Using backup and restore
l f r om
Exercise:
at ria
e Using backup
M
AIX and restore
BTS
Other UNIX backup Commands
tar (tape archive)
Widely available
Good for transfer of data between platforms
Has no support for
f r m
oextended inode (ACLs)
ia l
a t er
IX M
A
cpio (copy
B TS input to output)
Widely available
Difficulties can occur with many symbolic links
Has no support for extended inode (ACLs)
dd (device to device)
Makes backup copies that are an exact image
Can also be used for conversions
For example: can convert ASCII to EBCDIC
tar Command
Generate a tar backup
# tar -cvf /dev/rmt0.3 /home
f ro m
ri a l
M ate
RestoreIX
A a file from a tar image
BTS
# tar -xvf /dev/rmt0 /home/team01/mydir
List (verify) content of a tar file
# tar -tvf /dev/rmt0
cpio Command
Generate a cpio backup
# find /home | cpio -ov> /dev/rmt0
f ro m
ri a l
e
Maat cpio image
Restore from
AIX
S </dev/rmt0
BT-idv
# cpio
List (verify) contents of a cpio image
# cpio -itv < /dev/rmt0
dd Command
Converts and copies files
To copy a file to diskette
rom
# dd if=/etc/inittabl fof=/dev/rfd0
t er ia
M a
X
AI a file from ASCII to EBCDIC
To convert
BT S
# dd if=text.ascii of=text.ebcdic conv=ebcdic
To convert data to uppercase characters
# cat lcase.data | dd conv=ucase
Controlling the Tape
rewind - rewinds a tape
fsf - fast forwards a tape
tctl
offline -iaejects
l froma tape
a
rewoffl t er- rewinds and ejects a tape
M
AIX
B TS
# tctl -f /dev/rmt0 rewind
# tctl -f /dev/rmt0.1 fsf 3
# tctl -f /dev/rmt0 rewoffl
restore -s
# restore -s 4 -xvf /dev/rmt0.1 ./etc/inittab
Good Practices
Verify your backups
from
Check the tape device
l
a t eria
M
IXbackups
KeepAold
BTS
Offsite secure storage
Label tape
Test recovery procedures before you have to!
Optional Exercise: Using tar and cpio
Optional
m
ia l froExercise:
Using tar
a t er
M and cpio
AIX
BTS
Checkpoint
1. What is the difference between A and B?
a. find /home/fred | backup -ivf /dev/rmt0
b. cd /home/fred; find . | backup -ivf /dev/rmt0
___________________________________________________
o m
l f r
___________________________________________________
a t e ria
___________________________________________________
M
A IX
2. On a mksysb
S tape if you entered tctl rewind and then tctl
B T
-f/dev/rmt0.1 fsf 3 which element on the tape could you look at?
___________________________________________________
___________________________________________________
Which command could you use to restore these files?
___________________________________________________
___________________________________________________
3. True or false? SMIT mksysb will backup all file systems,
provided they are mounted.
Unit Summary
In order to perform successful backups, consideration
must be given to the frequency of the backup, the media
to be used and the type of backup
l f r om
eriainitiated on a single file, a file system or
Backups canatbe
an entire M
IX volume group, all of which are supported
A
throughTSMIT
B S
By modifying the bosinst.data and the image.data
files, a customized system image backup can be created
There are many other UNIX backup commands which
can be used, however their limitations must be fully
understood. The commands include: tar, cpio and dd
Other useful commands also exist to manipulate the data
on the backup media such as tctl