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
View mksysb content & restore individual files
Viewed 1825 times since Tue, Jul 17, 2018
AIX - How to extend JFS filesystem
Viewed 18749 times since Fri, Jun 8, 2018
AIX, System Admin↑ The chrctcp command
Viewed 3026 times since Fri, Apr 19, 2019
VIO Server Howto
Viewed 10071 times since Mon, Jun 11, 2018
Troubleshooting Starts With Understanding Your Physical Disks’ Attributes
Viewed 3737 times since Sat, May 19, 2018
Using Kerberos security with Server for NFS
Viewed 9493 times since Wed, Jun 27, 2018
Aix: How to assign a specific PVID
Viewed 7261 times since Fri, Feb 1, 2019
AIX - How to unlock and reset user’s account
Viewed 16489 times since Fri, Jun 8, 2018
Part 1, Memory overview and tuning memory parameters AIX7
Viewed 4180 times since Wed, Jun 19, 2019
Convert to Scalable Volume Groups
Viewed 3782 times since Wed, May 30, 2018