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
Processes and Devices—It’s All About the Children
Viewed 2416 times since Wed, May 30, 2018
Manually Editing /etc/filesystems Can Cause Issues
Viewed 5839 times since Tue, May 22, 2018
AIX smtctl The smtctl command controls the enabling and disabling of processor simultaneous multithreading mode.
Viewed 15425 times since Fri, Jan 18, 2019
How to Maintain a Virtual I/O Server With FBO Part II
Viewed 10760 times since Wed, Jun 5, 2019
Installation of the Virtual I/O Server directly from the HMC
Viewed 21551 times since Tue, Jun 4, 2019
Troubleshooting Starts With Understanding Your Physical Disks’ Attributes
Viewed 4241 times since Sat, May 19, 2018
Check connection (rsh or nimsh) between NIM server and LPAR
Viewed 10978 times since Thu, Feb 21, 2019
AIX Full memory dump configure
Viewed 3553 times since Mon, Jul 16, 2018
Online Backups and Recovery in a Snap AIX
Viewed 5377 times since Wed, May 30, 2018
Using expect to automate mundane tasks
Viewed 2072 times since Mon, Jun 3, 2019