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 disk queue depth tuning for performance
Viewed 17043 times since Thu, Jan 16, 2020
How To Mirror Your Root Disk On AIX (a.k.a. rootvg)
Viewed 6979 times since Mon, May 21, 2018
Finding password rules in AIX
Viewed 3261 times since Mon, May 28, 2018
Kerberos authentication configuration for AIX servers
Viewed 11800 times since Mon, Jun 25, 2018
Topics: AIX, System Admin↑ Export and import PuTTY sessions
Viewed 3753 times since Fri, Apr 19, 2019
IBM AIX commands you should not leave home without
Viewed 7838 times since Mon, Jun 11, 2018
AIX -- extending Logical Volumes online
Viewed 3453 times since Tue, Mar 12, 2019
AIX Undocumented AIX command lquerypv
Viewed 4309 times since Tue, Jul 17, 2018
AIX snap - Prevent dump collection
Viewed 12849 times since Mon, Sep 17, 2018
Part 2, Monitoring memory usage (ps, sar, svmon, vmstat) and analyzing the results AIX7
Viewed 13807 times since Wed, Jun 19, 2019