Operating System - HP-UX
1753545 Members
6073 Online
108795 Solutions
New Discussion юеВ

Re: Moving /opt filesytem

 
Gus Mestousis
Frequent Advisor

Moving /opt filesytem

A while back ... don't ask me why, /opt was moved out of vg00 and into vg01. I would like to move it back into vg00.

I moved oracle and some other software onto their own filesystems mounted under /opt.

Can you let me know if this will work ...

1.Boot into single user mode
2.Mount up current /opt (vg01)
3.Mount up /newopt (will be the new opt in vg00)
4.Make sure that none of the filesystem normally mounted under /opt are mounted up. (oracle)
5.fuser -c /opt
6.kill any processes using /opt (should be none, maybe rpcd)
7.copy all the data from /opt into /newopt
8. umount both
9. modify /etc/fstab to reflect the changes
10. boot the system

I'm pretty sure this will work ... any specific command that I should use to copy the data across? will cp or cpio do the job?

Thanks,
Gus
Sure, let me just drop everything and work on your problem.
8 REPLIES 8
Vijaya Kumar_3
Respected Contributor

Re: Moving /opt filesytem

I think It should be exactly what you said. I dont see any issues with this. Basically, you need /stand, / and /usr for running into single user mode. You dont require /opt to be mounted in single user mode. So it should work..

Also, make sure you made a Ignite-UX recovery tape before doing this. Also make sure, you have any scripts in /sbin/init.d using /opt in single user mode.

Hope this helps
Vijay
Known is a drop, unknown is ocean - visit me at http://vijay.theunixplace.com
curt larson_1
Honored Contributor

Re: Moving /opt filesytem

that should work just fine for you.

a few comments:

2.Mount up current /opt (vg01)
this would include vgchange, possible fsck, etc.

being your in single user mode and have just mount /opt none of these should be necessary. But, what does it hurt to take a few seconds to double check.

4.Make sure that none of the filesystem normally mounted under /opt are mounted up. (oracle)
5.fuser -c /opt
6.kill any processes using /opt (should be none, maybe rpcd)

7.copy all the data from /opt into /newopt
I'd use cpio because it will be faster, but cpio doesn't copy empty directories (the mount points for your other file systems).

and a quick bdf to see that the size of the file systems are close to the same. They won't be exact, but shouldn't be largely different.

9. modify /etc/fstab to reflect the changes

I'd add a step to mount all the file systems here and do a quick check that all the file systems mount (everything under opt is where it should be) and are as you desire before rebooting.

10. boot the system



Steven E. Protter
Exalted Contributor

Re: Moving /opt filesytem

your methodoloy will work

fuser -cuk /opt

will kill any processes left open after shutting down all application software.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mark Grant
Honored Contributor

Re: Moving /opt filesytem

You might get away with doing this by just restoring your latest backup of /opt to /newopt, then changing /etc/fstab and re-booting. On the other hand, your way is probably safer.
Never preceed any demonstration with anything more predictive than "watch this"
Fabio Ettore
Honored Contributor

Re: Moving /opt filesytem

Hi,

all suggestions are right, then you should execute all steps in single user mode.
I just post a good command in order to copy contents from a filesystem to another one:

# mkdir /pippo.new
# mount /dev/vg00/new /pippo.new
# cd /pippo.old
# find . -xdev -print | cpio -pdmvux /pippo.new

In the past it worked fine for me.
Then check contents between 2 filesystems by diff command (of course, after boot the system):

# diff /pippo.old /pippo.new

Best regards,
Ettore
WISH? IMPROVEMENT!
Doug Burton
Respected Contributor

Re: Moving /opt filesytem

I've used this in the past to move /usr. I would think it would work for you.

cd /opt
find . -print | cpio -dlmpuvx /opt2
d = Do directories
l = Do links
m = Keep time
p = Pass along
u = Copy unconditionaly
v = verbose
x = Save device special files
Gus Mestousis
Frequent Advisor

Re: Moving /opt filesytem

Thanks all ... Some nice suggestions in there.

Gus
Sure, let me just drop everything and work on your problem.
DIPAK KUMAR ROY
Frequent Advisor

Re: Moving /opt filesytem

Test reply.... please ignore..