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 upgrade TL and SP in AIX using alternate disk(alt_disk_copy)
Viewed 10486 times since Sun, Jun 30, 2019
How to determine why your AIX oslevel is downlevel (and a script to help!)
Viewed 3608 times since Fri, Jul 13, 2018
Part 3, Monitoring your network packets and tuning the network
Viewed 5764 times since Mon, Jun 4, 2018
AIX Resolving "missing" or "removed" disks in AIX LVM
Viewed 4099 times since Tue, Aug 6, 2019
LVM: Display basic information about Physical Volumes, Volume Groups and Logical Volumes
Viewed 2688 times since Sun, Jun 3, 2018
AIX Errpt - Diag - Alog
Viewed 3312 times since Wed, Mar 20, 2019
AIX, user gets “pwd: The file access permissions do not allow the specified action.”
Viewed 10324 times since Tue, Mar 16, 2021
Control Your Logs AIX
Viewed 18609 times since Wed, May 30, 2018
Oslevel shows wrong AIX’s level. Why
Viewed 4476 times since Thu, Feb 21, 2019
Install and configure GNU’s screen on AIX
Viewed 8484 times since Thu, Feb 21, 2019