Friday, June 10, 2011

mksysb and savevg backup & restore


A mksysb is a bootable backup of your root volume group.

 The mksysb process will backup all mounted JFS and JFS2 filesystem  data.

 The file-system image is in backup-file format. (bff)



First check whether the filesystems you want to backup is mounted.

#lsvg –l rootvg

Check for state that should be open and also check for mountpoint (last column)

Or use

#mount

Check all the filesystems are there in the output that you want to backup.
If you don,t want to take backup of particular userdefined filesystem in rootvg,
Unmount it .

----- Check for the available tape drives

#lsdev –Cc tape

rmt0 available

Then you can use below command.




Creating a mksysb to a tape drive in AIX V6

. Using SMITTY :

# smitty mksysb

Backup DEVICE or FILE.........................[/dev/rmt0]    @
Create MAP files?.............................no
EXCLUDE files?................................no (-e)
List files as they are backed up?.............no
Verify readability if tape device?............no
Generate new /image.data file?................yes (-i)       @
EXPAND /tmp if needed?........................yes (-X)         @
Disable software packing of backup?...........no (-p)
Backup extended attributes?...................yes
Number of BLOCKS to write in a single output..[]
Location of existing mksysb image.............[]
File system to use for temporary work space...[]
Backup encrypted files?.......................yes
Back up DMAPI filesystem files?...............yes

It will take around 1 hour …

To verify the readability of your backup run the following command :

# listvgbackup -Vf /dev/rmt0

Any errors that occur while reading the headers of any of the files willbe displayed,
otherwise only the initial backup header information will
be displayed. Keep in mind that this check tests the readability of the file only,  not the writeability.

---------------------------------------------

For checking the whether all the files,filesystems are backed up, you can view the table of content 
Use this command

#restore -s4 –Tvqf /dev/rmt0 >/tmp/mksysb.log

It will create one file in /tmp.
Then,

#cd /tmp
#more mksysb.log

Check the table of content.





RESTORING THE BACKUP

To restore a mksysb image you simply need to boot from the tape and  verify your selections in the BOS menus. Next, we’ll cover two  booting scenarios.

When  your system is currently up and operational
1. If your system is currently running and you need to restore your  mksysb, simply change the bootlist to reflect the tape drive and reboot the system.

# bootlist -m normal rmt0
# shutdown -Fr

 If your system is in a down state

 You should boot to the SMS menus from AIX CD. and set your bootlist to reflect the tape drive. The SMS menu options are listed below. Your menu options may be different (depending on your level of firmware), however it should be clear enough by following
this document to figure out what options should be chosen if yours differ.

SMS - SYSTEM MANAGEMENT SERVICES -
1. Select Language
2. Change Password Options
3. View Error Log
4. Setup Remote IPL (RIPL (Remote Initial Program Load))
5. Change SCSI Settings
6. Select Console
--> 7. Select Boot Options

The next menu should come up :
--> 1. Select Install or Boot Device
2. Configure Boot Device Order
3. Multiboot Startup

FOR SETTING BOOTLIST YOU HAVE TO GO TO “CONFIGURE BOOT DEVICE ORDER”

The next menu will have the following :
Select Device Type :
1. Diskette
2. Tape
3. CD/DVD
4. IDE
5. Hard Drive
6. Network
--> 7. List all Devices
The system will scan itself to determine which devices are available to boot from.

it will display all bootable devices. 



The next screen will offer you three choices :
1. Information
--> 2. Normal Mode Boot
3. Service Mode Boot

Restore menus


I. From the Installation and Maintenance Menu, select (2):
1)Start Installation Now with Default Settings
2)Change/Show Installation Settings and Install
3)Start Maintenance Mode for System Recovery



II. From the System Backup Installation and Settings,
you’ll see the default options that are taken from your “bosinst.data” file.

If these are correct select (0) .

* If you need to change any options such as the disks you would like to install to select (1):

Setting:Current Choice(s):
1. Disk(s) where you want to install... hdisk0
Use Maps............................ No
2. Shrink File Systems................. No
0. Install with the settings listed above.

III. Change Disk(s) Where You Want to Install.
Type one or more numbers for the disks to be used for
installation and press Enter. The current choice is indicated by >>>.
At least one bootable disk must be selected. Choose the location by its SCSI ID.
Name Location Code Size (MB) VG StatusBootable
>>>1. hdisk 000-01-00-0,0 600456 rootvg yes
>>>2. hdisk 100-01-00-1,0 600456 rootvg yes

0. Continue with the choices indicated above
After the desired disks have been chosen, select (0) to continue.

IV. System Backup Installation and Settings, select (0 to continue)
             Setting:                                Current Choice(s):
          1. Disk(s) where you want to install......... hdisk0...
          2. Use Maps.................................. No
          3. Shrink File Systems....................... No
          0. Install with the settings listed above.
Backup extended attributes?...................yes
Number of BLOCKS to write in a single output..[]





after giving lsvg command ,it will show all volume group.


#lsvg

rootvg
dev-qa
DBbackup

here we are having three volume group, rootvg ,dav-qa,DBbackup.

for taking rootvg backup we are using mksysb command

for taking backup of customized vg(i.e. dev-qa,DBbackup)we are using savevg command


remember that savevg command doesn,t create bootable image.

Non-rootvg Backup

here I an considering the scenario for taking backup on file and after that pushing it into tape.

create a file in /abhi/asdir named savevg-dev-qa-11-6.22


#cd /abhi/asdir
#touch savevg-dev-qa-11-6.22


check the ulimit 
#ulimit 


set the fsize to unlimited.
#ulimit -f unlimited 




now run savevg command


# smit savevg

Back Up a Volume Group to Tape/File type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
WARNING: Execution of the savevg command will
result in the loss of all material
previously stored on the selected
output medium.


  • Backup DEVICE or FILE [ ] +/ /dev/rmto or any directory(/abhi/asdir/savevg-dev-qa-11-6.22)

* VOLUME GROUP to back up [ ] + (dev-qa) or DBbackup
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




check whether the savevg backup is successfully completed.

For that check the file savevg-dev-qa-11-6.22 in the directory /abhi/asdir is available.


#cd /abh/asdir

#pwd
/abhi/asdir

You can list the content of file
# cat /abhi/asdir/savevg-dev-qa-11-6.22


after that you have to push the file to tape.


For that use

#smit backfile

but before running this command check the below mentioned steps

Kindly check that while running this command you are in /


#pwd
/abhi/asdir

here it is showing that you are in directory /abhi/asdir


then give
#cd /

again check present working directory. It should be /

#pwd
/

then give the command #smit backfile






# smit backfile

Backup a File or Directory
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields] This option will perform a backup by name.


* Backup DEVICE [/dev/rmt0] +/
* FILE or DIRECTORY to backup [/abhi/asdir/savevg-dev-qa-11-6.22 .]
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=D




after that check the content of tape.whether backup was successfull

# restore -Tvf /dev/rmt0

















Restoring a non-rootvg Volume Group


for restoring savevg backup we are using restvg command.

#smit restvg

Remake a Volume Group
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]


* Restore DEVICE or FILE [/dev/rmt0/savevg-dev-qa-11-6.22] /+
SHRINK the filesystems? 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


No comments:

Post a Comment