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
Trick to Purge/Clean Swap Usage on AIX
Viewed 7959 times since Thu, Nov 29, 2018
0516-404 allocpThis system cannot fulfill the allocation
Viewed 10069 times since Thu, Sep 20, 2018
IBM AIX MPIO: Best practices and considerations
Viewed 11386 times since Wed, May 30, 2018
Create memory resident filesystems (RAM disk) on AIX
Viewed 2702 times since Thu, Feb 21, 2019
AIX PDF ALL
Viewed 6581 times since Mon, Jul 16, 2018
vfcpmap on VIO Server
Viewed 9492 times since Tue, Jun 4, 2019
How to install filesets/software in aix?
Viewed 5899 times since Mon, Jul 8, 2019
AIX: Error code 0516-1339, 0516-1397 0516-792: cannot extendvg with a previous Oracle ASM disk
Viewed 3716 times since Wed, Feb 6, 2019
View mksysb content & restore individual files
Viewed 1866 times since Tue, Jul 17, 2018
AIX Resolving "missing" or "removed" disks in AIX LVM
Viewed 4549 times since Tue, Aug 6, 2019