Operating System - HP-UX
1834942 Members
2224 Online
110071 Solutions
New Discussion

Re: lvextend & lvreduce questions.

 
SOLVED
Go to solution
James Pethigal_1
Occasional Contributor

lvextend & lvreduce questions.

Seasonings Greetings!

I'm new to the HP-UX world & would appreciate some help in validating my plan to reduce a lv & extend a lv.

Running: B.11.00

I need to reduce lvol202 (demo side of our production system) & extend lvol201 (production side). Both lv are 8 GB & I plan to reduce lvol202 by 250MB (2.5GB) & extend lvol201 by 250MB

/dev/vg02/lvol202 8888320 4772378 3988202 54% /demo2
/dev/vg02/lvol201 8888320 7882494 974682 89% /z

I plan to run:

unmount /demo
unmount /z
lvreduce -L 250 /dev/vg02/lv202
lvextend -L 250 /dev/vg02/lv201
shutdown -r 0



Question?

Do I need to extend/create file system somewhere in this process?

Would it be easier to use SAM? I don't see an option to reduce, but I can always remove & recreate lvol202?



Yes... I have full backups.



Best Regards,

James


Smile - It confuses people!
5 REPLIES 5
Martin Johnson
Honored Contributor

Re: lvextend & lvreduce questions.

You will need to run extendfs on lv201 to use the new space.

Doing the lvreduce may or may not corrupt your data, depending on whether it is a Journaled File System and how much free space is available.

If I were you, I would just remove and recreate lvol202. (and restore from backup) Either manually or with SAM.

HTH
Marty
Marco Santerre
Honored Contributor
Solution

Re: lvextend & lvreduce questions.

James,

You're close to getting it done. Though it is recommended to recreate a logical volume in it sentirety rather than reduce it, it is still possible to accomplish what you want to do this way.

1) If you can umount your file systems, you won't need to reboot at all.

2) your commands should show :
lvreduce -L 8500 /dev/vg02/lv202
and
lvextend -L 9130 /dev/vg02/lv201

the -L option is always the TOTAL amount of space after the change. So, since you want to reduce by 250 Megs from 8.88 Gigs, you'll get about 8.5 Gigs left. Same goes with the amount you want to add.

3) Rather than reboot, you can then just :
extendfs /dev/vg02/lv201
and then mount your file system again.

Again, it is recommended to recreate the logical volume that you want to decrease rather than lvreduce it. So it would give something like this :
umount /dev/vg02/lv202
umount /dev/vg02/lv201
lvremove /dev/vg02/lv202
lvextend -L 9130 /dev/vg02/lv201
extendfs /dev/vg02/lv201
mount /dev/vg02/lv201 /z
lvcreate -n lv202 -L 8500 vg02
newfs -F vxfs /dev/vg02/lv202
Restore your file system /dev/vg02/lv202


Hope this helps
Cooperation is doing with a smile what you have to do anyhow.
Uday_S_Ankolekar
Honored Contributor

Re: lvextend & lvreduce questions.

If you have online JFS then
you can use fsadm command to extend file system without unmounting file system.

Or else you have to unmount file system.
Before doing anything please take filesystem backup.

-USA..

Good Luck..
Rammig Claus
Frequent Advisor

Re: lvextend & lvreduce questions.

Hi James,

even if you don't have online JFS, you don't have to do a shutdown after reducing or extending Filesystems.

Claus
No risc no fun
Steven E. Protter
Exalted Contributor

Re: lvextend & lvreduce questions.

I'd think it useful to lvremove any volumes you want to totally eliminate.

I'm also assuming you have a fbackup handy in case you hit data on the volume you are reducing.

It would be easier to use SAM but sometimes it makes mistakes.

Here is the Steve guide on how to use SAM.

Use, it then view the commands it used. Save them as a script and look them over. Get rid of the display commands and then you see how to do it on the command line next time.

Why? Because you have no SAM in single user mode or lm mode. Thats when you need the command line knowledge.

Steve
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