Backup Command Examples in AIX

mksysb

1. Create image.data and system backup (-X expands /tmp if required):

# mksysb -i -X /dev/rmt0

2. Create image.data file with map file and system backup:

# mksysb -m /dev/rmt0

3. Create system data but excludes the files listed in /etc/exclude.rootvg:

# mksysb -e /dev/rmt0

mkszfile

1. Create /image.data file:

# mkszfile

mkcd

1. Create system boot backup to the CD-R device /dev/cd1 (mksysb):

# mkcd -d /dev/cd1

2. Create backup of VG datavg to CD-R device /dev/cd1 (savevg):

# mkcd -d /dev/cd1 -v datavg

savevg

1. Create datavg.data image file and backup vg datavg (path = /tmp/vgdata/datavg/datavg.data):

savevg -i -f /dev/rmt0 datavg

2. Create datavg backup but exclude files listed in the /etc/exclude.datavg:

# savevg -ef  /dev/rmt0 datavg

backup

1. Backup entire system to rmt0:

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

2. Backup /home directory to rmt0 with backup level 0:

# backup -0vf /dev/rmt0 /home

restore

1. List the archive in rmt0:

# restore -Tvf /dev/rmt0

2. Restore /home from archive in device rmt0:

# restore -xvf /dev/rmt0 /home

3. Restore particular file from /export/mksysb image:

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

4. Restor only a file attribute from tape:

# restore -Pa -vf /dev/rmt0 ./etc/passwd

5. Archive /home directory:

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

6. Restore cpio archive from rmt0:

# cpio -icvdumB 

cpio

1. List the contents of cpio archive from rmt0:

# cpio -ivt 

2. Restore /home directory from rmt0:

# cpio -icvd 

tar

1. Archive /home to rmt0 device:

# tar -cvf /dev/rmt0 /home

2. List the archives in rmt0:

# tar -tvf /dev/rmt0

3. Extract /home from rmt0:

# tar -xvf /dev/rmt0 /home

dd

1. Convert and copy ascii file to ebcdic file2:

# dd if=file1 of=file2 conv=ebcdic

2. Copy 31st block and paste to 1st block in the hd4 ( ie.to fix currupted superblock by restoring it's backup copy to original location):

# dd count=1 bs=4k skip 31 seek=1 if=/dev/hd4 of=/dev/hd4

3. To copy blocks from rmt0 with 512 blocks to rmt1 with 1024 blocks:

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

tctl

1. To rewind the tape:

# tctl -f /dev/rmt0 rewind

2. To eject the tape:

# tctl -f /dev/rmt0 offline

3. To show the status of tape:

# tctl -f /dev/rmt0 status

tcopy

1. To copy contents of 1st tape(tape0) to 2nd tape(tape1). It is useful when the size of the tapes are different:

# tcopy /dev/rmt0.0 /dev/rmt1.0

2. To show no. of files and block size in the tape:

# tcopy /dev/rmt0

chdev

1. To change the block size of the tape to 51201:

# chdev -l rmt0 -a block_size=512

`

Related Post