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
AIX boot proccess
Viewed 3230 times since Tue, Apr 16, 2019
Undocumented AIX command lquerypv
Viewed 3806 times since Mon, Jul 16, 2018
Convert to Scalable Volume Groups
Viewed 4133 times since Wed, May 30, 2018
AIX Increase paging space logical volume size
Viewed 3076 times since Tue, Jul 17, 2018
AIX - How to get CPU infomation
Viewed 5946 times since Fri, Jun 8, 2018
Online Backups and Recovery in a Snap AIX
Viewed 5292 times since Wed, May 30, 2018
This document discusses a new feature implemented for JFS2 filesystems to prevent simultaneous mounting.
Viewed 2956 times since Sat, Jun 1, 2019
List STALE partitions across Volume Groups for each Logical Volume in AIX
Viewed 2695 times since Tue, Jul 17, 2018
Backup and Restore With AIX
Viewed 4734 times since Sat, May 19, 2018
What is OS Watcher Utility and How to use it for Database Troubleshooting ?
Viewed 30293 times since Thu, Jun 21, 2018