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
AIX Reviewing AIX Error and Boot Logs
Viewed 2364 times since Wed, Mar 20, 2019
AIX Oracle tuning
Viewed 201490 times since Tue, Jul 2, 2019
AIX: Remove existing disk
Viewed 2274 times since Sun, Jun 3, 2018
n a perfect world....rootvg would always reside on hdisk0
Viewed 1930 times since Thu, Jun 6, 2019
AIX, System Admin↑ The chrctcp command
Viewed 2626 times since Fri, Apr 19, 2019
Trick to Purge/Clean Swap Usage on AIX
Viewed 6533 times since Thu, Nov 29, 2018
IP configuration in AIX
Viewed 2244 times since Tue, Jul 17, 2018
Tuning AIX Network Performance
Viewed 3217 times since Tue, May 22, 2018
List of 10 Must Know Oracle Database Parameters for Database Administrator
Viewed 112423 times since Thu, Jun 21, 2018
AIX - How to monitor CPU usage
Viewed 23982 times since Fri, Jun 8, 2018