AIX Backup commands

root's picture

How to create and system backup (-X expands /tmp if required):

# mksysb -i -X /dev/rmt0

How to create file with map file and system backup:

# mksysb -m /dev/rmt0

How to create system data but excludes the files listed in /etc/exclude.rootvg:

# mksysb -e /dev/rmt0

An example of mksysb creation:

[gznim:root:/:] mksysb -eiX /export/mksysb/gznim.mksysb

Creating information file (/ for rootvg.

Creating list of files to back up 
Backing up 162412 files..............................
49263 of 162412 files backed up (30%)..............................
92157 of 162412 files backed up (56%)..............................
162398 of 162412 files backed up (99%)

162412 of 162412 files backed up (100%)
0512-038 mksysb: Backup Completed Successfully.

How to create / file:

# mkszfile

How to create system boot backup to the CD-R device /dev/cd1:

# mkcd -d /dev/cd1

How to create backup of vg vg00 to CD-R device /dev/cd1:

# mkcd -d /dev/cd1 -v vg00

How to create generic boot backup:

# mkcd -d /dev/cd1 -G

How to create image file and backup vg vg00:

# savevg -i -f /dev/rmt0 vg00

How to create vg00 backup but excludes files listed in the /etc/exclude.vg00:

# savevg -ef /dev/rmt0 vg00

How to backup entire system to rmt0:

# find / -print | backup -ivf /dev/rmt0

How to backup /home directory to rmt0 with backup level 0:

# backup -0vf /dev/rmt0 /home

How to list the archive in rmt0:

# restore -Tvf /dev/rmt0

How to restore /home from archive in device rmt0:

# restore -xvf /dev/rmt0 /home

How to restore particular file from /export/mksysb image:

# restore –xvf /export/mksysb ./etc/sshd.conf

How to archive /home directory with cpio:

# find ./home -print |cpio -ocvumB > /dev/rmt0

How to create an archive of /home directory:

# tar cvf /tmp/home.tar /home

How to restore cpio archive from rmt0:

# cpio -icvdumB < /dev/rmt0

How to list the contents of cpio archive from rmt0:

# cpio -ivt < /dev/rmt0

How to restore /home directory from rmt0:

# cpio -icvd < /dev/rmt0 /home

How to archive /home to rmt0 device:

# tar -cvf /dev/rmt0 /home

How to list the archives in rmt0:

# tar -tvf /dev/rmt0

How to extract /home from rmt0:

# tar -xvf /dev/rmt0 /home

How to convert and copy ascii file si to ebcdic si1:

# dd if=si of=si1 conv=ebcdic

How to copy blocks from rmt0 with 512 blocks to rmt1 with 1024 blocks:

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

How to rewind a tape:

# tctl -f /dev/rmt0 rewind

How to eject a tape:

# tctl -f /dev/rmt0 offline

How to show the status of a tape:

# tctl -f /dev/rmt0 status

How to change the block size of the tape to 512:

# chdev -l rmt0 -a block_size=512

How to restore a file from mksysb:

# listvgbackup -f /path/to/mksysb.image -r ./etc/file

How to list information about mksysb image like AIX level, filesystems, backup date, etc.:

# lsmksysb -lf mksysb_image

[gznim:root:/export/mksysb:] lsmksysb -lf gzbackup.sysb
VOLUME GROUP:           rootvg
BACKUP DATE/TIME:       Mon Jan 12 10:02:06 CET 2015
UNAME INFO:             AIX gzaix 1 7 00C402FE4C00
BACKUP SIZE (MB):       56448
SHRINK SIZE (MB):       25569
VG DATA ONLY:           no

LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       2       2    closed/syncd  N/A
hd6                 paging     128     256     2    open/syncd    N/A
hd8                 jfs2log    1       2       2    open/syncd    N/A
hd4                 jfs2       6       12      2    open/syncd    /
hd2                 jfs2       83      166     2    open/syncd    /usr
hd9var              jfs2       20      40      2    open/syncd    /var
hd3                 jfs2       80      160     2    open/syncd    /tmp
hd1                 jfs2       4       8       2    open/syncd    /home
hd10opt             jfs2       10      20      2    open/syncd    /opt
hd11admin           jfs2       2       4       2    open/syncd    /admin
livedump            jfs2       4       8       2    open/syncd    /var/adm/ras/livedump
lv_pridump          sysdump    8       8       1    open/syncd    N/A
lv_auditlog         jfs2       16      32      2    open/syncd    /var/log/eprise
lvrepcore           jfs2       16      32      2    open/syncd    /rep_core
lvsyslog            jfs2       16      32      2    open/syncd    /var/log/archives
lvtad4d             jfs2       4       8       2    open/syncd    /var/itlm
lvexploit           jfs2       8       16      2    open/syncd    /exploit
lvsecdump           sysdump    8       8       1    open/syncd    N/A

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content