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: How to assign a specific PVID
Viewed 7920 times since Fri, Feb 1, 2019
10 AIX Commands to Add to Your Toolbox
Viewed 4576 times since Sat, May 19, 2018
AIX www web Links
Viewed 3528 times since Fri, Apr 19, 2019
Script to download TL and SP for AIX using NIM and SUMA
Viewed 9429 times since Thu, Feb 21, 2019
SSH-COPY-ID on AIX. SSH remote AIX’s box without password
Viewed 17633 times since Thu, Feb 21, 2019
How to deal with performance monitoring in AIX ?
Viewed 8030 times since Fri, May 25, 2018
AIX, Networking↑ Adding and deleting a static network route using the command line
Viewed 2914 times since Fri, Apr 19, 2019
AIX - How to get IP and MAC address of ethernet adapter in AIX
Viewed 26425 times since Fri, Jun 8, 2018
Installing a Interim Fix (APAR IV16587)
Viewed 3185 times since Tue, Jul 17, 2018
AIX HA / HACMP, System Admin↑ Mountguard
Viewed 7287 times since Mon, Jun 3, 2019