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 know witch process is running in a particular port on AIX using KDB
Viewed 13748 times since Thu, Nov 29, 2018
To do a quick check on the number of path present (does not mean all are Enabled] using for loop
Viewed 5028 times since Fri, Jun 8, 2018
AIX, Security, System Admin Difference between sticky bit and SUID/GUID
Viewed 9971 times since Fri, Apr 19, 2019
AIX: Script to check if all paths are consistent and available
Viewed 4133 times since Tue, Jun 12, 2018
AIX 0516-404 allocp: This system cannot fulfill the allocation
Viewed 4271 times since Thu, Sep 20, 2018
Script to download TL and SP for AIX using NIM and SUMA
Viewed 10201 times since Thu, Feb 21, 2019
Tips I Picked up at the Power Systems Technical University
Viewed 4252 times since Mon, Jun 11, 2018
Useful AIX general commands
Viewed 13361 times since Wed, Apr 17, 2019
Mirroring the rootvg Volume Group for AIX 4.1/4.2
Viewed 3969 times since Mon, May 21, 2018
SSH Essentials: Working with SSH Servers, Clients, and Keys
Viewed 5670 times since Wed, Jun 27, 2018