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: Script to check if all paths are consistent and available
Viewed 4133 times since Tue, Jun 12, 2018
Mirroring the rootvg Volume Group for AIX 4.1/4.2
Viewed 3969 times since Mon, May 21, 2018
Tuning AIX Network Performance
Viewed 5389 times since Tue, May 22, 2018
HOWTO: Implement SEA Failover with Dual VIOS
Viewed 9665 times since Tue, Jun 4, 2019
What is OS Watcher Utility and How to use it for Database Troubleshooting ?
Viewed 32038 times since Thu, Jun 21, 2018
AIX POWERHA/HACMP: Basic commands
Viewed 6683 times since Sat, Jun 2, 2018
AIX alt_disk_copy
Viewed 10952 times since Sun, Jun 30, 2019
AIX WIKIS developerworks
Viewed 3041 times since Sun, Jun 17, 2018
IBM AIX multipath I/O (MPIO) resiliency and problem determination
Viewed 15289 times since Wed, May 30, 2018
AIX, Monitoring, Networking, Red Hat, Security, System Admin↑ Determining type of system remotely
Viewed 3192 times since Fri, Apr 19, 2019