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
How to set Kernel Parameters in AIX ?
Viewed 17187 times since Tue, Jul 2, 2019
What is OS Watcher Utility and How to use it for Database Troubleshooting ?
Viewed 32333 times since Thu, Jun 21, 2018
List STALE partitions across Volume Groups for each Logical Volume in AIX
Viewed 4067 times since Tue, Jul 17, 2018
LVM: Unmirror/Mirror "rootvg" Volume Group
Viewed 4686 times since Mon, May 21, 2018
AIX POWERHA/HACMP: Basic commands
Viewed 6908 times since Sat, Jun 2, 2018
Using expect to automate mundane tasks
Viewed 2805 times since Mon, Jun 3, 2019
Recovery from LED 552, 554, or 556 in AIX
Viewed 3750 times since Tue, Apr 16, 2019
How to clear/clean/erase/delete/reset network adapter configuration on AIX?
Viewed 13852 times since Thu, Nov 29, 2018
Ethernet tunning for VIOS and AIX for 10 Gib/sec environtement.
Viewed 12427 times since Thu, Feb 21, 2019
How to check dual path in AIX
Viewed 15937 times since Fri, Jun 8, 2018