Operating System - HP-UX
1832894 Members
2437 Online
110048 Solutions
New Discussion

Best way to move a Filesystem!

 
SOLVED
Go to solution
MAD_2
Super Advisor

Best way to move a Filesystem!

I am looking for recommendations on what I should consider and the steps I should take to move the filesystem /oracle displayed below. It is currently set up as a logical volume in VG00 and I want to move it to VG05, but I still want to use the same name (/dev/vg05/oracle). It contains the Oracle Application and some data files. I need to do this so I can free up space for VG00 to do an upgrade intallation. Another thing that I have to consider is that /oracle is mirrored while /data2 is not. Any tips on how I can create a mirror of the /oracle filesystem once I move it?

Unfortunately the forums search engine still not working, so I can't find links that may give me answers on how to do all this.

........Filesystem......kbytes......used.......avail...%used..Mounted on
.../dev/vg00/lvol3......86016......20470........61495....25%.../
.../dev/vg00/lvol1......47829......22170........20876....52%.../stand
.../dev/vg00/lvol8.....512000.....454139........55649....89%.../var
.../dev/vg00/lvol7.....528384.....394272.......127020....76%.../usr
.../dev/vg00/lvol4......98304.......7223........85892.....8%.../tmp
/dev/vg03/oradata2....8192000....3334945......4555272....42%.../oradata2
./dev/vg02/ordata1....4096000....1024661......2879860....26%.../oradata1
./dev/vg01/oradata....8380416....4546446......3596666....56%.../oradata
../dev/vg00/oracle....1024000.....774098.......234334....77%.../oracle
.../dev/vg00/lvol6.....696320.....604890........85755....88%.../opt
.../dev/vg00/lvol5......20480......15284.........5196....75%.../home
.../dev/vg05/lvol1...17408000....4067237.....12508657....25%.../data2
.../dev/vg04/lvol2....6348800....4090728......2119265....66%.../data

Thanks in advance for any input!
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
15 REPLIES 15
Jean-Luc Oudart
Honored Contributor

Re: Best way to move a Filesystem!

There was a thread I participated too a while ago with extra link on how to move the oracle sw from vg00.

For mirrorin, I think you can do it as a second step and synchronise your logical volume.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1b13237a4bc6d611abdb0090277a778c,00.html

Jean-Luc
fiat lux
Sandip Ghosh
Honored Contributor

Re: Best way to move a Filesystem!

Create another filesystem of the same or bigger in size. Mount it on a temporary directory. Shutdown Oracle. Go to oracle directory and then do a cpio -pdlmv to the new directory. Unmount Oracle and mount thenew filesystem on /oracle. Start oracle server and see whether everything is all right or not . Then delete the existing lvol of oracle. Then create a mirror copy of oracle by lvextend -m 1.

Sandip
Good Luck!!!
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Best way to move a Filesystem!

1) lvcreate -L 1024 -m 1 -n oracle /dev/vg05

will create the new LVOL and mirror it.

2) newfs -F vxfs /dev/vg05/roracle
will create the new filesystem.

3) mkdir /tmporacle
mount -F vxfs /dev/vg05/oracle /tmporacle

4) Shutdown database

5) cd /oracle
find . | cpio -pudvm /tmporacle

6) cd /
umount /oracle
umount /tmporacle
modify /etc/fstab changing the /oracle mount to be /dev/vg05/oracle

7) mount /oracle
rmdir /tmporacle

8) Start database.
If it ain't broke, I can fix that.
Bernhard Mueller
Honored Contributor

Re: Best way to move a Filesystem!

Hello,

use: vgdisplay vg05
to verify that you have enough space there,

use: lvcreate -L 1024 -n oracle vg05
to create a 1GB lvol named oracle

use: newfs -F vxfs /dev/vg05/roracle
to create a Filesystem

use: mkdir /new_oracle
to create a mount point

use: mount /dev/vg05/oracle /new_oracle
to mount the filesystem

stop Oracle

cd /oracle
use: find . -xdev | cpio -pduvmx /new_oracle
to copy the whole filesystem

umount /new_oracle
umount /oracle
to umount both filesystems

edit /etc/fstab and replace
/dev/vg00/oracle with /dev/vg05/oracle

use: mount /oracle
to mount and bdf to check it is mounted

use: lvextend -m 1 /dev/vg05/oracle to setup an LVM mirror

start Oracle

HTH
Regards,
Bernhard
MAD_2
Super Advisor

Re: Best way to move a Filesystem!

A. Clay, how about if I want to create the mirror of /oracle in a different location, let's say within /dev/vg03/

I've never done this, so this may sound like a dumb question (something I should already know), but don't I have to resize /dev/vg05/lvol1 from 17000 MB to 16000 MB and /dev/vg03/oradata2 from 8000 to 7000 first before I try to create the new LV there?

I hope this does not display too weird:


??Logical Volumes ??------------------------------------------------------------------------------??
?? Total Mirror Mount ??
?? Logical Volume Volume Group Use Mbytes Copies Directory ??
??+---------------------------------------------------------------------------+ ??
???? lvol1 vg00 HFS 48 1 /stand ^ ??
???? lvol1 vg04 Swap 2480 0 ??
???? lvol1 vg05 VxFS 17000 0 /data2 ??
???? lvol2 vg00 Swap/Dump 1120 1 ??
???? lvol2 vg03 Swap 1360 0 ??
???? lvol2 vg04 VxFS 6200 0 /data ??
???? lvol3 vg00 VxFS 84 1 / ??
???? lvol4 vg00 VxFS 96 1 /tmp ??
???? lvol5 vg00 VxFS 20 1 /home ??
???? lvol6 vg00 VxFS 680 1 /opt v ??
???? lvol7 vg00 VxFS 516 1 /usr
???? lvol8 vg00 VxFS 500 1 /var
???? oracle vg00 VxFS 1000 1 /oracle
???? oradata2 vg03 VxFS 8000 1 /oradata2
???? oradata vg01 VxFS 8184 1 /oradata
???? ordata1 vg02 VxFS 4000 1 /oradata1 v
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Bernhard Mueller
Honored Contributor

Re: Best way to move a Filesystem!

Hello,

A) you cannot mirror "across" volume groups.

B) you do not want to extend an existing logical volume but create a new one.

That's why you need to check available space with vgdisplay.

Regards,
Bernhard
Bernhard Mueller
Honored Contributor

Re: Best way to move a Filesystem!

Hello,

DO NOT REDUCE THE SIZE OF AN LVOL, THIS WILL CORRUPT YOUR FILESYSTEM (MOST LIKELY)

(you would first have to reduce the size of the filesystem in the lvol)

Regards,
Bernhard
MAD_2
Super Advisor

Re: Best way to move a Filesystem!

Bernhard, this is what I get:

# vgdisplay vg05
--- Volume groups ---
VG Name /dev/vg05
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 5342
VGDA 2
PE Size (Mbytes) 8
Total PE 2170
Alloc PE 2125
Free PE 45
Total PVG 0

# lvcreate -L 1024 -n oracle vg05
Logical volume "/dev/vg05/oracle" has been successfully created with
character device "/dev/vg05/roracle".
lvcreate: Not enough free physical extents available.
Logical volume "/dev/vg05/oracle" could not be extended.
Run the "lvextend" command to create space on the Logical Volume.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Ted Ellis_2
Honored Contributor

Re: Best way to move a Filesystem!

vg05 only has 45 free PEs... times 8 MB each only gives you about 350 MB free.... you are simply exceeding the capacity of this volume group. You will need to either find something on that volume group that is unneeded and use lvremove or find another volume group with the space you need.

Ted
Ted Ellis_2
Honored Contributor

Re: Best way to move a Filesystem!

we use mirroring quite a bit here... if you like, go ahead and post a summary of your volume groups... space available and used... may also want to include hardware info (JBOD or RAID). I assume all of you disks are JBOD as you want to mirror with MirrorDisk?

Ted
S.K. Chan
Honored Contributor

Re: Best way to move a Filesystem!

# vgdisplay vg05
--- Volume groups ---
VG Name /dev/vg05
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 5342
VGDA 2
PE Size (Mbytes) 8
Total PE 2170
Alloc PE 2125
Free PE 45
Total PVG 0

It looks like you're out of luck in vg05. You have only 1 LV in vg05 (ie lvol1) and its size is (2125*8=17GB), what's left is (45*8=360MB). While reducing lvol1 in vg05 is not recomendded, you have 2 choices ..
1) Migrate /oracle (needs about 1GB or more)
to other than vg05. It depends on the space available.
2) Recreate /data2 FS to a smaller size (maybe 12GB) but that involves backing up /data2 to another location, recreate a new FS then restore it back.
For now if time is crucial, option 1 is your choice.
Tibi Baraboi_1
Advisor

Re: Best way to move a Filesystem!

1) create a new VG05 the same structure as the original Vg00 (ideal to have the same disks )


2)vgexport -p -m /temp/your_map /dev/vg00

3)vgimport -m /temp/your_map /dev/vg05

4)for each disk present in VG00 do

dd if=/dev/rdsk/original_disk of=/dev/rdsk/new_disk

this is supposed to replicate the disks.

It is right?

Regards,
Tibi Baraboi
MAD_2
Super Advisor

Re: Best way to move a Filesystem!

S.K. Chan, time is not crucial, so option #2 looks like the best. I think it was not such a great idea to create only one lv for VG05 on a 17GB HD, but that's how it was configured. Now I need to break it into two different lv's, and one of the them would be for the /oracle filesystem.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
S.K. Chan
Honored Contributor

Re: Best way to move a Filesystem!

OK then .. first of all make sure no users are accessing the server. We do not want /data2 or any other FS to be accessed when you make a copy of /data2 elsewhere.
Briefly ..
1) Make a temporary cpio copy of /data2 to /oradata2 since /oradata2 has 4.5GB left.
==> Better still backup /data2 to tape also just in case.
2) Recreate a smaller lvol1 /data2 FS.
3) Cpio the data back from /oradata2.
4) Now you can create lvol2 to house /oracle.
The steps ..
# cd /oradata2
# mkdir data2
# cd /data2
# find . | cpio -pudvm /oradata2/data2
==> At this point after the cpio is done you might want to backup /data2 to tape also.
# cd /
# umount /data2
# lvremove /dev/vg05/lvol1
# lvcreate -L 12000 -n lvol1 /dev/vg05
# newfs -F vxfs /dev/vg05/rlovl1
# mount -a
# cd /oradata2/data2
# find . | cpio -pudvm /data2
Now you can follow Clay's step to move /oracle to vg05.



MAD_2
Super Advisor

Re: Best way to move a Filesystem!

Excellent A. Clay and S. K. Chan. Using your combined efforts I was able to transfer this filesystem which will free up some space in my volume group 0 and will allow me to do an OS upgrade (I hope, if I don't encounter some other problems).
Thanks! Post another comment so that I may give each of you 10 pts.
NOTE: I do have to say that I appreciate everyone's efforts to help me solve this problem.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with