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
Calculate hdisk READ / WRITE throughput (sequential IO) from AIX systems
Viewed 2886 times since Thu, Feb 21, 2019
Top 4 Reasons for Node Reboot or Node Eviction in Real Application Cluster (RAC) Environment
Viewed 101342 times since Thu, Jun 21, 2018
AIX, Monitoring, System Admin↑ NMON recordings
Viewed 3231 times since Fri, Apr 19, 2019
Script HW/SW AIX
Viewed 9422 times since Mon, Jun 4, 2018
Setup private yum repository for AIX clients
Viewed 11549 times since Thu, Feb 21, 2019
Migrating from SDDPCM to AIXPCM (the easy way)
Viewed 2832 times since Mon, Jun 3, 2019
Working with Virtual media library on VIO servers
Viewed 16192 times since Thu, Feb 21, 2019
Technology level update on AIX using smit_update and alt_disk_install method
Viewed 6158 times since Sun, Jun 30, 2019
LVM: Extend an existing Volume Group by adding a new disk
Viewed 5884 times since Sat, Jun 2, 2018
0516-787 extendlv: Maximum allocation for logical volume error
Viewed 9464 times since Tue, Mar 12, 2019