You are on page 1of 21

Unit 7

Backup and restore

© Copyright IBM Corporation 2009


Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.2
Unit objectives
IBM Power Systems

After completing this unit, you should be able to:

• Explain how to back up the Operating System


• Create and restore a mksysb image
• Explain and understand the role of both the image.data and
bosinst.data files
• Back up and restore a custom volume group
• Use standard UNIX and AIX backup, restore, and compression
utilities

© Copyright IBM Corporation 2009


Backup introduction
IBM Power Systems

• Why back up?


– Data is very important, it is expensive to re-create.
– Hardware failure
– Accidental deletion
– Damage due to software installation or hardware repair
– Create a system image for installation cloning
– Long term archive
– Disaster recovery Generally handled by
enterprise backup
mgnt solutions, for
example TSM
• Types of backup:
– Volume group
• mksysb utility which records an image backup of the operating system
• savevg utility which performs a full backup of a user-created VG
– Full
• Backs up all specified data
– Incremental
• Records changes since previous backups
© Copyright IBM Corporation 2009
System image backup
IBM Power Systems

• Backs up rootvg only using the mksysb command


• Unmounted file systems are not backed up
• If device selected is tape, bootable tape is created in backup
format
• Can be completed over a network to a NIM server
• Provides facilities for a non-interactive installation
• Saves system-created paging space definitions
• Saves LV policies and file system attributes
• There should be minimal user and application activity

© Copyright IBM Corporation 2009


Creating a mksysb image
IBM Power Systems

• smit mksysb /usr/bin/mksysb -i /backups/my_mksysb


Back Up the System
Back Up the System

* Backup DEVICE or FILE [/backups/my_mksysb] +/


* Backup DEVICE or FILE [/backups/my_mksysb] +/
Create MAP files? no +
Create MAP files? no +
EXCLUDE files? no +
EXCLUDE files? no +
List files as they are backed up? no +
List files as they are backed up? no +
Verify readability if tape device? no Backup to tape, for +
Verify readability if tape device? no +
Generate new /image.data file? yes example /dev/rmt0 is +
Generate new /image.data file? yes also popular +
EXPAND /tmp if needed? no +
EXPAND /tmp if needed? no +
Disable software packing of backup? no +
Disable software packing of backup? no +
Backup extended attributes? yes +
Backup extended attributes? yes +
(Leave blank to use a system default)
(Leave blank to use a system default)
Location of existing mksysb image [] /
Location of existing mksysb image [] /
File system to use for temporary work space [] /
File system to use for temporary work space [] /
(If blank, /tmp will be used.)
(If blank, /tmp will be used.)
Back up encrypted files? yes +
Back up encrypted files? yes +
Back up DMAPI filesystem files? No +
Back up DMAPI filesystem files? No +

• SMIT also provides facilities to do a system backup to CD and


DVD, see smit sysbackup

© Copyright IBM Corporation 2009


image.data file
IBM Power Systems

• The image.data file contains information describing the image


installed during the BOS installation process. This includes:
– Sizes, names, maps, and mount points of logical volumes and file
systems in the root volume group
• It is a large file arranged in stanza format
– Is not recommended that the user modify the file, apart from the shrink
field
• New image.data can be created during a mksysb operation or
by calling the mkszfile command.
image_data:
image_data:
IMAGE_TYPE= bff
IMAGE_TYPE= bff
DATE_TIME= Mon 20 Oct 17:54:07 2008
DATE_TIME= Mon 20 Oct 17:54:07 2008
UNAME_INFO= AIX neo 1 6 00CBE2FE4C00
UNAME_INFO= AIX neo 1 6 00CBE2FE4C00
PRODUCT_TAPE= no
PRODUCT_TAPE= no
USERVG_LIST=
USERVG_LIST=
PLATFORM= chrp
PLATFORM= chrp
OSLEVEL= 6.1.1.0 The SHINK field can be set
OSLEVEL= 6.1.1.0
OSLEVEL_R= 6100-01
OSLEVEL_R= 6100-01 to yes.
CPU_ID= 00CBE2FE4C00
CPU_ID= 00CBE2FE4C00
LPAR_ID= 4
LPAR_ID= 4
logical_volume_policy:
logical_volume_policy:
SHRINK= no
SHRINK= no
EXACT_FIT= no
EXACT_FIT= no

© Copyright IBM Corporation 2009


bosinst.data file
IBM Power Systems

• Defines defaults for variables controlling an installation


• Can be used to created non-prompted installations
• Key options below, for a full description see:
– /usr/lpp/bosinst/bosinst.template.README
control_flow:
control_flow: GRAPHICS_BUNDLE = yes
CONSOLE = Default
CONSOLE = Default MOZILLA_BUNDLE = no
INSTALL_METHOD = overwrite
INSTALL_METHOD = overwrite KERBEROS_5_BUNDLE = no
PROMPT = no
PROMPT = no SERVER_BUNDLE = yes
EXISTING_SYSTEM_OVERWRITE = yes
EXISTING_SYSTEM_OVERWRITE = yes ALT_DISK_INSTALL_BUNDLE = no
INSTALL_X_IF_ADAPTER = no
INSTALL_X_IF_ADAPTER = no
RUN_STARTUP = yes
RUN_STARTUP = yes locale:
RM_INST_ROOTS = no
RM_INST_ROOTS = no BOSINST_LANG = en_US
ERROR_EXIT =
ERROR_EXIT = CULTURAL_CONVENTION = en_GB
CUSTOMIZATION_FILE = SCREEN
CUSTOMIZATION_FILE = SCREEN MESSAGES = en_US
TCB = no
TCB = no KEYBOARD = en_GB
INSTALL_TYPE =
INSTALL_TYPE =
BUNDLES =
BUNDLES = target_disk_data:
SWITCH_TO_PRODUCT_TAPE =
SWITCH_TO_PRODUCT_TAPE = PVID =
RECOVER_DEVICES = no
RECOVER_DEVICES = no PHYSICAL_LOCATION =
BOSINST_DEBUG = no
BOSINST_DEBUG = no CONNECTION =
ACCEPT_LICENSES =
ACCEPT_LICENSES = LOCATION =
DESKTOP = CDE
DESKTOP = CDE SIZE_MB =
INSTALL_DEVICES_AND_UPDATES = yes
INSTALL_DEVICES_AND_UPDATES = yes HDISKNAME = hdisk0
IMPORT_USER_VGS =
IMPORT_USER_VGS =
ENABLE_64BIT_KERNEL = Default
ENABLE_64BIT_KERNEL = Default
CREATE_JFS2_FS = yes
CREATE_JFS2_FS = yes
ALL_DEVICES_KERNELS = no
ALL_DEVICES_KERNELS = no
ALT_DISK_INSTALL_BUNDLE = no
ALT_DISK_INSTALL_BUNDLE = no

© Copyright IBM Corporation 2009


mksysb tape image format
IBM Power Systems

Blocksize = Blocksize = Blocksize = Tape Drive


512 512 512 Blocksize

BOS Boot mkinsttape dummy rootvg


image image backup image
.toc
1st Section 2nd Section 3rd Section 4th Section
0 1 2 3

Kernel ./image.data Dummy TOC Backup


Device Drivers ./bosinst.data by name
./tapeblksz

• To list files in the backup image on a mksysb


– tctl -f /dev/rmt0 rewind
– tctl -f /dev/rmt0.1 fsf 3
– restore -Tvf /dev/rmt0
• OR
– restore -Tv –s4 -f /dev/rmt0
© Copyright IBM Corporation 2009
Restoring a mksysb, from tape device (1 of 2)
IBM Power Systems

• From the SMS Menu, boot the system from the tape device.
• Restore mksysb image from the device, that is, tape
(/dev/rmt0), as follows:
Welcome to Base Operating System
Welcome to Base Operating System
Installation and Maintenance
Installation and Maintenance
1 Start Install Now With Default Settings
1 Start Install Now With Default Settings
2 Change/Show Installation Settings and Install
2 Change/Show Installation Settings and Install
>> 3 Start Maintenance Mode for System Recovery
>> 3 Start Maintenance Mode for System Recovery
4 Configure Network Disks (iSCSI)
4 Configure Network Disks (iSCSI)

1 Access A Root Volume Group


1 Access A Root Volume Group
2 Copy a System Dump to Removable Media
2 Copy a System Dump to Removable Media
3 Access Advanced Maintenance Functions
3 Access Advanced Maintenance Functions
4 Erase Disks
4 Erase Disks
>> 6 Install from a System Backup
>> 6 Install from a System Backup

Tape Drive Path Name


Tape Drive Path Name
>> 1 tape/scsi/4mm/2GB /dev/rmt0
>> 1 tape/scsi/4mm/2GB /dev/rmt0

© Copyright IBM Corporation 2009


Restoring a mksysb, from tape device (2 of 2)
IBM Power Systems

Welcome to Base Operating System


Welcome to Base Operating System
Installation and Maintenance
Installation and Maintenance
Type the number of your choice and press Enter. Choice is indicated by >>.
Type the number of your choice and press Enter. Choice is indicated by >>.
1 Start Install Now With Default Settings
1 Start Install Now With Default Settings
>> 2 Change/Show Installation Settings and Install
>> 2 Change/Show Installation Settings and Install
3 Start Maintenance Mode for System Recovery
3 Start Maintenance Mode for System Recovery
4 Configure Network Disks (iSCSI)
4 Configure Network Disks (iSCSI)
5 Select Storage Adapters
5 Select Storage Adapters
System Backup Installation and Settings
System Backup Installation and Settings
Type the number of your choice and press Enter.
Type the number of your choice and press Enter.
1 Disk(s) where you want to install hdisk0
1 Disk(s) where you want to install hdisk0
Use Maps No
Use Maps No
2 Shrink Filesystems No
2 Shrink Filesystems No
3 Import User Volume Groups No
3 Import User Volume Groups No
4 Recover devices No
4 Recover devices No
0 Install with the settings listed above
0 Install with the settings listed above

Installing Base Operating System


Installing Base Operating System
Please wait...
Please wait...
Approximate Elapsed time
Approximate Elapsed time
% tasks complete (in minutes)
% tasks complete (in minutes)
3 0 Making logical volumes
3 0 Making logical volumes

© Copyright IBM Corporation 2009


Creating a backup of a data volume group
IBM Power Systems

• smit savevg /usr/bin/savevg –f /tmp/datavg_bk_svg -i datavg


Back Up a Volume Group to Tape/File
Back Up a Volume Group to Tape/File

* Backup DEVICE or FILE [/tmp/datavg_bk_svg] +/


* Backup DEVICE or FILE [/tmp/datavg_bk_svg] +/
* VOLUME GROUP to back up [datavg] +
* VOLUME GROUP to back up [datavg] +
List files as they are backed up? no +
List files as they are backed up? no +
Generate new vg.data file? yes +
Generate new vg.data file? yes +
Create MAP files? no +
Create MAP files? no +
EXCLUDE files? no +
EXCLUDE files? no +
EXPAND /tmp if needed? no +
EXPAND /tmp if needed? no +
Disable software packing of backup? no +
Disable software packing of backup? no +
Backup extended attributes? yes +
Backup extended attributes? yes +
Number of BLOCKS to write in a single output [] #
Number of BLOCKS to write in a single output [] #
(Leave blank to use a system default)
(Leave blank to use a system default)
Verify readability if tape device? no +
Verify readability if tape device? no +
Back up Volume Group information files only? no +
Back up Volume Group information files only? no +
Back up encrypted files? yes +
Back up encrypted files? yes +
Back up DMAPI filesystem files? no +
Back up DMAPI filesystem files? no +

• SMIT also provides facilities to do a VG backup to CD and


DVD (smit vgbackup).

© Copyright IBM Corporation 2009


Restoring a backup of a data volume group
IBM Power Systems

• smit restvg /usr/bin/restvg -q –f /tmp/datavg_bk_svg


Remake a Volume Group
Remake a Volume Group
* Restore DEVICE or FILE [/tmp/datavg_bk_svg] +/
* Restore DEVICE or FILE [/tmp/datavg_bk_svg] +/
SHRINK the filesystems? no +
SHRINK the filesystems? no +
Recreate logical volumes and filesystems only? no +
Recreate logical volumes and filesystems only? no +
PHYSICAL VOLUME names [] +
PHYSICAL VOLUME names [] +
(Leave blank to use the PHYSICAL VOLUMES listed
(Leave blank to use the PHYSICAL VOLUMES listed
in the vgname.data file in the backup image)
in the vgname.data file in the backup image)
Use existing MAP files? yes +
Use existing MAP files? yes +
Physical partition SIZE in megabytes [] +#
Physical partition SIZE in megabytes [] +#
(Leave blank to have the SIZE determined
(Leave blank to have the SIZE determined
based on disk size)
based on disk size)
Number of BLOCKS to read in a single input [] #
Number of BLOCKS to read in a single input [] #
(Leave blank to use a system default)
(Leave blank to use a system default)
Alternate vg.data file [] /
Alternate vg.data file [] /
(Leave blank to use vg.data stored in
(Leave blank to use vg.data stored in
backup image)
backup image)

• Prior to restoring the VG


– Unmount all file systems which are part of that VG.
– Varyoff and export the volume group.
© Copyright IBM Corporation 2009
Traditional UNIX and AIX backup commands
IBM Power Systems

• AIX
– Backup and restore

• Other popular backup, restore commands across UNIX


platforms:
– tar
– cpio
– pax
– dd

• Compression Utilities
– Compress, restore using uncompress or zcat
– gzip, restore using gunzip

© Copyright IBM Corporation 2009


Backup by filename and restore
IBM Power Systems

• File names are read from standard input


## cat
cat listfile
listfile
/home/aix/file1
/home/aix/file1
/home/aix/file2
/home/aix/file2 Absolute Paths
/home/aix/file3
/home/aix/file3
## backup
backup -iqvf
-iqvf /dev/rmt0
/dev/rmt0 << listfile
listfile

## find
find /home/aix
/home/aix || backup
backup -iqvf
-iqvf /dev/rmt0
/dev/rmt0 Relative Paths

## cd
cd /home/aix
/home/aix
## find
find .. || backup
backup -iqvf
-iqvf /backup/aix.backup
/backup/aix.backup
List files

## restore
restore -Tvf
-Tvf /backup/aix.backup
/backup/aix.backup
Extract (restore)
files
## restore
restore -xvf
-xvf /backup/aix.backup
/backup/aix.backup

## restore
restore -xvf
-xvf /tmp/aix.backup
/tmp/aix.backup ./file1
./file1 Extract individual
file

© Copyright IBM Corporation 2009


Backup and restore by inode
IBM Power Systems

• Only supported if filesystems are unmounted! Full backup

## backup
backup -u
-u -0
-0 -f
-f /tmp/databkup_21Oct_level0
/tmp/databkup_21Oct_level0 /data
/data

## backup
backup -u
-u -1
-1 -f
-f /tmp/databkup_21Oct_level1
/tmp/databkup_21Oct_level1 /data
/data

## cat
cat /etc/dumpdates
/etc/dumpdates
/dev/rfslv00
/dev/rfslv00 11 Tue
Tue Oct
Oct 21
21 15:45:21
15:45:21 2008
2008
/dev/rfslv00
/dev/rfslv00 0 Tue Oct 21 15:40:54 2008
0 Tue Oct 21 15:40:54 2008 Incremental backup

Backup history

## restore
restore -rqvf
-rqvf /tmp/databkup_21Nov_level0
/tmp/databkup_21Nov_level0

## restore
restore -rqvf
-rqvf /tmp/databkup_21Nov_level1
/tmp/databkup_21Nov_level1

Must restore first to the last level 0 then


followed by each incremental…

© Copyright IBM Corporation 2009


tar command
IBM Power Systems

• tar is derived from tape archive


– Create a tar backup (-c)
## tar
tar –cvf
–cvf /dev/rmt0
/dev/rmt0 /home
/home
## tar
tar -cvf /backup/home.tar /home
-cvf /backup/home.tar /home

– List files in a tar backup (-t)


## tar
tar –tvf
–tvf /dev/rmt0
/dev/rmt0

– Extract files from a tar backup (-x)


## tar
tar –xvf
–xvf /dev/rmt0
/dev/rmt0

– Copying directories and files using tar


## cd
cd /data
/data
## tar
tar –cf
–cf || (cd
(cd /data_backup
/data_backup &&
&& tar
tar xBpf
xBpf -)
-)

© Copyright IBM Corporation 2009


cpio command
IBM Power Systems

• cpio is derived from copy in and out


– Create a cpio backup (-o)
## find
find /home
/home || cpio
cpio –ov
–ov >> /backup/home.bk
/backup/home.bk

– List files in a cpio backup (-t)


## cpio
cpio -itv
-itv << /backup/home.bk
/backup/home.bk

– Extract files from a cpio backup (-i)


## cpio
cpio –idv
–idv << /backup/home.bk
/backup/home.bk

– Copy the contents of the current location to /mydir

## find
find .. -depth
-depth || cpio
cpio -pd
-pd /mydir
/mydir

© Copyright IBM Corporation 2009


Compression commands (1 of 2)
IBM Power Systems

• Archives created with backup utilities are usually compressed.


– Reduce the size of the backup.
– This can be done using a number of utilities, such as compress.

• Examples (using compress, uncompress, and zcat):

## compress
compress -v
-v /tmp/data.tar
/tmp/data.tar
/tmp/data.tar:
/tmp/data.tar: Compression:
Compression: 95.50%
95.50% This
This file
file is
is replaced
replaced
with /tmp/data.tar.Z.
with /tmp/data.tar.Z.

## uncompress
uncompress /tmp/data.tar.Z
/tmp/data.tar.Z
/tmp/data.tar.Z:
/tmp/data.tar.Z: This
This file
file is
is replaced
replaced with
with /tmp/data.tar.
/tmp/data.tar.

zcat, expands a
## zcat
zcat /tmp/data.tar.Z
/tmp/data.tar.Z || tar
tar -xvf
-xvf -- compressed file to
standard out.

© Copyright IBM Corporation 2009


Compression commands (2 of 2)
IBM Power Systems

• Examples (gzip and gunzip)


## gzip
gzip -v
-v /tmp/data.tar
/tmp/data.tar
/tmp/data.tar:
/tmp/data.tar: 97.7%
97.7% --
-- replaced
replaced with
with
/tmp/data.tar.gz
/tmp/data.tar.gz

## gunzip
gunzip -v
-v /tmp/data.tar.gz
/tmp/data.tar.gz
/tmp/data.tar.gz:
/tmp/data.tar.gz: 97.7%
97.7% --
-- replaced
replaced with
with
/tmp/data.tar
/tmp/data.tar
Creates a
compressed
## tar
tar -cvf
-cvf -- /data
/data || gzip
gzip -c
-c >> data_tar.gz
data_tar.gz tarball (.tar.gz) of
the /data
## gunzip
gunzip -c
-c data_tar.gz
data_tar.gz || tar
tar xvf
xvf -- directory.

Decompresses and
extracts the
compressed tarball
(.tar.gz).

© Copyright IBM Corporation 2009


Good practices
IBM Power Systems

• Take regular backups.

• Verify your backups.


– Check the tape device(s).
– Label tapes.

• Keep old backups.

• Keep a copy of the backups securely offsite.

• Test recovery procedures before you have to use them!

• Consider deploying an enterprise storage management


solution like Tivoli Storage Manager (TSM).

© Copyright IBM Corporation 2009


Unit summary
IBM Power Systems

Having completed this unit, you should be able to:

• Explain how to back up the operating system


• Create and restore a mksysb image
• Explain and understand the role of both the image.data
and bosinst.data files
• Back up and restore a custom volume group
• Use standard AIX/UNIX backup, restore, and
compression utilities

© Copyright IBM Corporation 2009

You might also like