HOWTO: Copy a filesystem on AIX

#!/usr/bin/ksh
cmd=$0
old=$1
new=$2

if [ $# != 2 ]
then
   echo Syntax: ${cmd} "<src_directory>" "<new_directory>"
   exit 1
fi

# since the directory names might be entered as relative to current directory
# change to each of the directories and set a full path name for each

#verify source directory exists
cd $old
if [ $? != 0 ]
then
   echo ${cmd}: cannot change directory to ${old}
   exit 1
fi
src=`pwd`
cd -

#verify target/destination directory exists
cd $new
if [ $? != 0 ]
then
   echo ${cmd}: cannot change directory to ${new}
   exit 1
fi
target=`pwd`
cd -

# perform copy
cd ${src}
find . | backup -if - | (cd ${target}; restore -xqf -)

# return the exit value of the command above
exit $?

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
IBM AIX multipath I/O (MPIO) resiliency and problem determination
Viewed 15900 times since Wed, May 30, 2018
AIX Changing ’defined’ or ’missing’ hard disk states to ’Available’ in IBM Smart Analytics System for AIX environment
Viewed 11920 times since Wed, May 22, 2019
Getting list users and groups in AIX
Viewed 5593 times since Mon, May 28, 2018
Firmware Assisted Dump sysdump
Viewed 3283 times since Mon, Jul 16, 2018
How to mirror the rootvg in AIX?
Viewed 6367 times since Mon, May 21, 2018
AIX, Networking↑ Adding and deleting a static network route using the command line
Viewed 4179 times since Fri, Apr 19, 2019
Finding password rules in AIX
Viewed 3572 times since Mon, May 28, 2018
Rootvg Mirroring in AIX
Viewed 4047 times since Mon, May 21, 2018
AIX 6.1: Extend VG 0516-1714 extendvg 0516-1254 extendvg
Viewed 5738 times since Fri, Jul 6, 2018
This document discusses a new feature implemented for JFS2 filesystems to prevent simultaneous mounting.
Viewed 5700 times since Sat, Jun 1, 2019