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
Replacing a failed disk (rootvg)
Viewed 3067 times since Mon, May 21, 2018
AIX: How to manage network tuning parameters
Viewed 4038 times since Mon, Jun 11, 2018
AIX Power replacing (hot-swap) failed disk in rootvg
Viewed 3817 times since Tue, Apr 16, 2019
Ethernet tunning for VIOS and AIX for 10 Gib/sec environtement.
Viewed 10734 times since Thu, Feb 21, 2019
How to disable SSH cipher/ MAC algorithms for Linux and Unix
Viewed 47150 times since Fri, Aug 21, 2020
Using Kerberos security with Server for NFS
Viewed 9847 times since Wed, Jun 27, 2018
Setup private yum repository for AIX clients
Viewed 11397 times since Thu, Feb 21, 2019
Create memory resident filesystems (RAM disk) on AIX
Viewed 2854 times since Thu, Feb 21, 2019
IVM and VLAN Tagging
Viewed 10472 times since Mon, May 28, 2018
Configuring an AIX client with multiple Kerberos realms
Viewed 9239 times since Mon, Jun 25, 2018