1748268 Members
3641 Online
108760 Solutions
New Discussion юеВ

Re: how to extend lv

 
SOLVED
Go to solution
Robert-Jan Goossens
Honored Contributor

Re: how to extend lv

Hi,
---
So only left with one option i can migrate /opt /var from root which will indirectly extend my /root partition and I want to do this task remotely, hope this is clear now to all, please anybody else can help me for this.
--

The first question is, do you have enough free extends on you vg00 volumegroup?
# vgdisplay -v vg00

You might be able to execute this task remotely. Download the lsof tool from;
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.81/

Stop as many application on the workstation.
sendmail
syslog
ntp
swagentd
etc, etc

Check what is running on /var and /opt
# lsof / | grep var
kill it if it is using the /var or /opt


Create a new filesystem in your vg00 volume group.

# lvcreate -L size_mb -n lvolX /dev/vg00
# lvcreate -L size_mb -n lvolY /dev/vg00
change the X and Y.

# newfs -F vxfs /dev/vg00/rlovlX
# newfs -F vxfs /dev/vg00/rlovlY

Move the opt and var directories.

# mv /var /var1
# mkdir /var
# mount /dev/vg00/lovlX /var
Check the ownership and permissions of /var
# cd /var1
# find . | cpio -pcmudv /var
add the mountpoint and device to the /etc/fstab.

same for opt.
# shutdown -r -y now
If all is running ok, remove the /var1 and the /opt1 directories.

Hope this helps,
Robert-Jan
avizen9
Esteemed Contributor
Solution

Re: how to extend lv

you can also do something like below.
create new logical volume as mentioned.
guess your new logical volume is mount as

/dev/vg00/lvol8/var1
/dev/vg00/lvol9/opt1

do tar for whole /var and /opt data (tar will support upto 2gb data only if its more then 2gb then you need to use gtar)

cd /var
tar cvf var.tar *

cd /opt
tar cvf opt.tar *

mv var.tar /var1
mv opt.tar /opt1

cd /var1
tar xvf var.tar
cd /opt1
tar xvf opt.tar

once this done you can verify /var1 and /opt1 with your actual data
if everything ok you can remove /var and /opt and rename /var1 and /opt1 to /var /opt

and upudate /etc/fstab.

this will help. let me know how it goes... best of luck, thanks,
vanda982
Occasional Advisor

Re: how to extend lv

thanks
I tried to umount /var and /opt but its giving error divice busy, many process i cant kill by Kill -9, any other sugguestion.
Torsten.
Acclaimed Contributor

Re: how to extend lv

I tried to umount /var and /opt but its giving error divice busy, many process i cant kill by Kill -9, any other sugguestion.

This is exactly the point that stops you from doing this remotely.


You can try to create the new lvols, tar the current /opt and ... untar it to the new lvol, modify fstab to use the new lvols, reboot and hope you did modify the "old" contents of /opt during this time.

Better to do an ignite backup and restore to different new lvols.

On (most) workstations you cannot work in single user mode remotely - that's the problem.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
avizen9
Esteemed Contributor

Re: how to extend lv

I tried to umount /var and /opt but its giving error divice busy, many process i cant kill by Kill -9, any other sugguestion.

do you aware about fuser command?
fuser -u /dev/vg00/lvolx (full path of lv)
you may use k to kill all process for that particular lv, please check #man fuser for more detail.
i am not 100% sure it will work correctly as per your requirement, but can try it.
let us know
vanda982
Occasional Advisor

Re: how to extend lv

good....

i did this for /tmp it working fine, with /var /opt facing some issue and looks i need to do some more work on it.
anyway thanks all for great support here.
Hakki Aydin Ucar
Honored Contributor

Re: how to extend lv

I do not know if your HP UX OS version support Online JFS but ,as far as I know the best way to do that is to use Online JFS to extend mounted JFS file system (vxfs) by remotely:
the steps you have to follow then :

lvextend .options..
fsadm .options..
Hakki Aydin Ucar
Honored Contributor

Re: how to extend lv

more detail of Online JFS usage:

extended to 800 Mbytes, you can use the following :

lvextend -L 800 /dev/vg03/lvol4

and suppose you mounted it to directory "/extra"

The following command will extend the size of the file system to 800 Mbytes, where 819200 represents 800 MBytes converted to kilobytes.

fsadm -F vxfs -b 819200 /extra

so you don t need to unmount FS you want to extend. .