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
Technology level update on AIX using smit_update and alt_disk_install method
Viewed 6778 times since Sun, Jun 30, 2019
Awesome Command to show top 15 processes using memory on AIX
Viewed 24743 times since Thu, Nov 29, 2018
AIX 6/7 Script to create a file with commands to remove missing and failed paths
Viewed 5180 times since Tue, Jun 14, 2022
Aix: How to assign a specific PVID
Viewed 8660 times since Fri, Feb 1, 2019
Using Kerberos security with Server for NFS
Viewed 10786 times since Wed, Jun 27, 2018
n a perfect world....rootvg would always reside on hdisk0
Viewed 2911 times since Thu, Jun 6, 2019
AIX TCP connection status
Viewed 18384 times since Mon, Jul 29, 2019
AIX lsdevinfo
Viewed 11030 times since Mon, Jun 3, 2019
AIX - How to extend JFS filesystem
Viewed 20841 times since Fri, Jun 8, 2018
AIX FC Performance improvements for IBM AIX FC and FCoE device driver stacks
Viewed 6913 times since Fri, Jan 31, 2020