Sunteți pe pagina 1din 28

Unit 11

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

• Types of backup:
example TSM

– 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

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


Create MAP files? no +
EXCLUDE files? no +
List files as they are backed up? no +
Verify readability if tape device? no Backup to tape, for +
Generate new /image.data file? yes example /dev/rmt0 is +
EXPAND /tmp if needed? no also popular +
Disable software packing of backup? no +
Backup extended attributes? yes +
(Leave blank to use a system default)
Location of existing mksysb image [] /
File system to use for temporary work space [] /
(If blank, /tmp will be used.)
Back up encrypted files? yes +
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_TYPE= bff
DATE_TIME= Mon 20 Oct 17:54:07 2008
UNAME_INFO= AIX neo 1 6 00CBE2FE4C00
PRODUCT_TAPE= no
USERVG_LIST=
PLATFORM= chrp
OSLEVEL= 6.1.1.0 The SHINK field can be set
OSLEVEL_R= 6100-01 to yes.
CPU_ID= 00CBE2FE4C00
LPAR_ID= 4

logical_volume_policy:
SHRINK= 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:
CONSOLE = Default GRAPHICS_BUNDLE = yes
INSTALL_METHOD = overwrite MOZILLA_BUNDLE = no
PROMPT = no KERBEROS_5_BUNDLE = no
EXISTING_SYSTEM_OVERWRITE = yes SERVER_BUNDLE = yes
INSTALL_X_IF_ADAPTER = no ALT_DISK_INSTALL_BUNDLE = no
RUN_STARTUP = yes
RM_INST_ROOTS = no locale:
ERROR_EXIT = BOSINST_LANG = en_US
CUSTOMIZATION_FILE = SCREEN CULTURAL_CONVENTION = en_GB
TCB = no MESSAGES = en_US
INSTALL_TYPE = KEYBOARD = en_GB
BUNDLES =
SWITCH_TO_PRODUCT_TAPE = target_disk_data:
RECOVER_DEVICES = no PVID =
BOSINST_DEBUG = no PHYSICAL_LOCATION =
ACCEPT_LICENSES = CONNECTION =
DESKTOP = CDE LOCATION =
INSTALL_DEVICES_AND_UPDATES = yes SIZE_MB =
IMPORT_USER_VGS = HDISKNAME = hdisk0
ENABLE_64BIT_KERNEL = Default
CREATE_JFS2_FS = yes
ALL_DEVICES_KERNELS = 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
Installation and Maintenance

1 Start Install Now With Default Settings


2 Change/Show Installation Settings and Install
>> 3 Start Maintenance Mode for System Recovery
4 Configure Network Disks (iSCSI)

1 Access A Root Volume Group


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

Tape Drive Path Name


>> 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


Installation and Maintenance

Type the number of your choice and press Enter. Choice is indicated by >>.
1 Start Install Now With Default Settings
>> 2 Change/Show Installation Settings and Install
3 Start Maintenance Mode for System Recovery
4 Configure Network Disks (iSCSI)
5 Select Storage Adapters

System Backup Installation and Settings

Type the number of your choice and press Enter.

1 Disk(s) where you want to install hdisk0


Use Maps No
2 Shrink Filesystems No
3 Import User Volume Groups No
4 Recover devices No
0 Install with the settings listed above

Installing Base Operating System

Please wait...

Approximate Elapsed time


% tasks complete (in minutes)

3 0 Making logical volumes

© Copyright IBM Corporation 2009


Restoring a mksysb, from a NIM server (1 of 2)
IBM Power Systems

• Restore a mksysb image from a NIM Server, using the SMS


menu.
– Note: NIM server configuration is covered in the AU08G NIM course.
PowerPC Firmware
Version SF240_338
SMS 1.6 (c) Copyright IBM Corp. 2000,2005 All rights reserved.
-------------------------------------------------------------------------------
Main Menu
1. Select Language
2. Setup Remote IPL (Initial Program Load) #then select the adapter & IP Parameters
3. Change SCSI Settings
4. Select Console
5. Select Boot Options

IP Parameters Enter client and NIM


Interpartition Logical LAN: U9113.550.65F2E7F-V9-C3-T1 server IP details.
1. Client IP Address [10.47.1.21]
2. Server IP Address [10.47.1.33]
3. Gateway IP Address [000.000.000.000]
4. Subnet Mask [255.255.0.0]

© Copyright IBM Corporation 2009


Restoring a mksysb, from NIM sever (2 of 2)
IBM Power Systems

• Return to main menu, by selecting option “5 Boot Options”. Then, select:


• 1. Select Install/Boot Device
• 6. Network -- followed by the network adapter to the boot from
• 2. Normal Mode Boot
• 1. Yes -- to exit System Management Services

BOOTP: chosen-network-type = ethernet,auto,none,auto BOOTP R = 1 BOOTP S = 2


BOOTP: server IP = 10.47.1.33 FILE: /tftpboot/alex.lpar.co.uk
BOOTP: requested filename = FINAL Packet Count = 27900
BOOTP: client IP = 10.47.1.21 FINAL File Size = 14284288 bytes.
BOOTP: client HW addr = ea 48 f0 0 90 3 load-base=0x4000
BOOTP: gateway IP = 0.0.0.0 real-base=0x2000000
BOOTP: device /vdevice/l-lan@30000003
BOOTP: loc-code U9113.550.65F2E7F-V9-C3-T1
Client issues a bootp request
to NIM master and downloads
the boot image via tftp
Installing Base Operating System

Please wait...

Approximate Elapsed time


% tasks complete (in minutes)

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

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


* VOLUME GROUP to back up [datavg] +
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 +
Backup extended attributes? yes +
Number of BLOCKS to write in a single output [] #
(Leave blank to use a system default)
Verify readability if tape device? no +
Back up Volume Group information files only? no +
Back up encrypted files? yes +
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

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


SHRINK the filesystems? no +
Recreate logical volumes and filesystems only? 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)
Alternate vg.data file [] /
(Leave blank to use vg.data stored in
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 listfile
/home/aix/file1
/home/aix/file2
/home/aix/file3 Absolute Paths

# backup -iqvf /dev/rmt0 < listfile

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

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

# restore -Tvf /backup/aix.backup


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

# restore -xvf /tmp/aix.backup ./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 -u -0 -f /tmp/databkup_21Oct_level0 /data

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

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

Backup history

# restore -rqvf /tmp/databkup_21Nov_level0

# restore -rqvf /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 –cvf /dev/rmt0 /home
# tar -cvf /backup/home.tar /home

– List files in a tar backup (-t)


# tar –tvf /dev/rmt0

– Extract files from a tar backup (-x)


# tar –xvf /dev/rmt0

– Copying directories and files using tar


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

© Copyright IBM Corporation 2009


cpio command
IBM Power Systems

• cpio is derived from copy in and out


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

– List files in a cpio backup (-t)


# cpio -itv < /backup/home.bk

– Extract files from a cpio backup (-i)


# cpio –idv < /backup/home.bk

– Copy the contents of the current location to /mydir

# find . -depth | cpio -pd /mydir

© Copyright IBM Corporation 2009


pax command
IBM Power Systems

• tar and cpio syntax differ slightly between UNIX platforms.


– IEEE addressed this problem with ‘pax’, meaning peace in Latin.

– Create a pax backup of /home (-w)


# pax -wf /backup/home_pax.ar /home

– List files in a pax backup (-v)


# pax -v –f /backup/home_pax.ar

– Extract files in a pax backup (-r)

# pax -rvf /backup/home_pax.ar

© Copyright IBM Corporation 2009


dd command
IBM Power Systems

• The primary purpose of dd is the low-level copying and


conversion of raw data.
– Copy tape to tape. Tape1 block size=1KB. Tape2 block size=2KB

# dd if=/dev/rmt0 ibs=1024 obs=2048 of=/dev/rmt1

– Perform a raw data backup of /home to tape, then restore

# tar -cvf - /home | dd obs=1024k of=/dev/rmt0


# tar -cvf - /home | rsh <system> dd obs=1024k of=/dev/rmt0

# dd if=/dev/rmt0 ibs=1024k | tar xvf -


Writing to a tape
drive on a remote
machine

– Convert /etc/passwd from ascii to ebcdic


# dd if=/etc/passwd of=/etc/passwd.ebcdic conv=ebcdic

© 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 -v /tmp/data.tar
/tmp/data.tar: Compression: 95.50% This file is replaced
with /tmp/data.tar.Z.

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

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

© Copyright IBM Corporation 2009


Compression commands (2 of 2)
IBM Power Systems

• Examples (gzip and gunzip)


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

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


Checkpoint
IBM Power Systems

1. What is the difference between the following two commands?


• find /home/fred | backup -ivf /dev/rmt0
• cd /home/fred; find . | backup -ivf /dev/rmt0
___________________________________________________
___________________________________________________
___________________________________________________

2. On a mksysb tape, if you entered tctl rewind and then tctl -


f/dev/rmt0.1 fsf 3, which element on the tape could you look at?
_________________________________________________________
_________________________________________________________

3. Which command could you use to restore these files?


_________________________________________________________

4. True or False: smit mksysb backs up all file systems, provided they
are mounted.
________________________________________________
_________________________________________________________

© Copyright IBM Corporation 2009


Checkpoint solutions
IBM Power Systems

1. What is the difference between the following two commands?


• find /home/fred | backup -ivf /dev/rmt0
• cd /home/fred; find . | backup -ivf /dev/rmt0
Option a) backs up the files using the full path names, whereas
option b) backs up the file names using the relative path names.
Therefore, b)’s files can be restored into any directory.

2. On a mksysb tape, if you entered tctl rewind and then tctl -


f/dev/rmt0.1 fsf 3, which element on the tape could you look at?
You would be at the start of the backed up images of the files, having
skipped over the first three sections of the tape (boot image, mkinsttape,
and dummy toc).

3. Which command could you use to restore these files? The files were
backed up using the backup command so you would have to use the
restore command.

4. True or False: smit mksysb backs up all file systems, provided they
are mounted. mksysb only backs up rootvg file systems. To back up
other volume groups, you must use the savevg command.
© Copyright IBM Corporation 2009
Exercise 11
IBM Power Systems

Backup and restore

© 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

S-ar putea să vă placă și