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 get Memory infomation
Viewed 11124 times since Fri, Jun 8, 2018
View mksysb content & restore individual files
Viewed 2028 times since Tue, Jul 17, 2018
How to disable SSH cipher/ MAC algorithms for Linux and Unix
Viewed 47165 times since Fri, Aug 21, 2020
AIX 6/7 Script to create a file with commands to remove missing and failed paths
Viewed 3968 times since Tue, Jun 14, 2022
List of 10 Must Know Oracle Database Parameters for Database Administrator
Viewed 130005 times since Thu, Jun 21, 2018
How To Mirror Your Root Disk On AIX (a.k.a. rootvg)
Viewed 5807 times since Mon, May 21, 2018
VIO Server Howto
Viewed 10428 times since Mon, Jun 11, 2018
Part 1, The basics of network troubleshooting
Viewed 5439 times since Tue, May 22, 2018
Using Kerberos security with Server for NFS
Viewed 9848 times since Wed, Jun 27, 2018
AIX Increase paging space logical volume size
Viewed 3092 times since Tue, Jul 17, 2018