Operating System - HP-UX
1753888 Members
7463 Online
108809 Solutions
New Discussion юеВ

Reducing a logical volume .

 
SOLVED
Go to solution
Russ Hancock_1
Frequent Advisor

Reducing a logical volume .

Is it possible to reduce a logical volume.
For some reason, (vg00-lvol8-/var) is allocated 5Gb and I need to shift some of the extra capacity over to (vg00-lvol7-/usr) currently at 500Mb.

Is this possible?

Cheers
Russ.
Russ
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Reducing a logical volume .

Russ,

It is not advisable to reduce a logical volume unless you have Online JFS. The best way is to re-arrange the file systems a bit. Since /var is only 500MB, create a standby file system of size 600, copy the contents, destroy /var and create it with probably 1.5 GB and then copy back the contents. You don't have to do this if you have around 1.5 GB free space where you can simply make it as /var. You need to do this in single user mode.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor

Re: Reducing a logical volume .

Hi Russ:

Yes it is possible but sometimes dangerous. You can use fsadm to reduce the filesystem and then use lvreduce to shrink the logical volume.
Man fsadm_vxfs and lvreduce for details.

Your safer option is to:
1) Backup the filesystem
2) umount the filesystem
3) remove the logical volume
4) recreate the logical volume
5) build a new filesystem
6) mount the filesystem
7) restore the filesystem from backup

In any event, backup before doing any of this.
If it ain't broke, I can fix that.
fg_1
Trusted Contributor

Re: Reducing a logical volume .

Russ

Everyone has given you great suggestions, one thing that you might want to also think about doing since you have a very large /var and want to reduce it, try doing the following:
1) make_recovery -A -C -v - Creating system tape.
2) Reboot into the path of the tape drive booting into the hpux Ignite-UX utility.
3) Rebuild all of the filesystems that you want to resize.

This may take a little longer but it will probably serve you better in the long run.

Hope this helps.
Bill McNAMARA_1
Honored Contributor

Re: Reducing a logical volume .

I just did this yesterday,

create a new lvol the size you want.

cp -rp /orig /new

vi /etc/fstab
change the lvol mount info

reboot
remove the orig_lvol

Best way to do it is with fsadm
(Online JFS)
you must first defrag the filesystem, reduce the filesystem (fsadm again) then lvreduce the lvol.. all online.

If it really is a concern to do this online, you need to get OnlineJFS.

Later,
Bill
It works for me (tm)
Magdi KAMAL
Respected Contributor

Re: Reducing a logical volume .

Attention Russ,

If you reduce logical volume you may ( 99 %) corrupt data on that logical volume.

In fact, hp-ux didn't mark blocks containing data and those not containing data within the logical volume.

See the manuel page in the Warning section, it's written :

The lvreduce command on a logical volume containing a file systemof greater length than the size being reduced to will cause data CORRUPTION.

Action :

You must plan for an Ignite first to save you data.

Magdi
Gene Matusovsky
Advisor

Re: Reducing a logical volume .

Wouldn't a fsadm -b 8388608 /dev/vg00/lvol8 work? Reduce the file system to 4gig. Leaving 1 gig to add on unto /usr.

-Gene
Russell_20
New Member

Re: Reducing a logical volume .

I have found a combination of steps to successfully reducing logical volumes. The only requirements are as follows:

1. Advanced Online JFS Insatlled & working properly.
2. The file system be mounted, but inactive.
3. Do not reduce smaller than data size (or data WILL be corrupted!)

Keep in mind this is not an "Online" feature, just added functionality that the Advanced Online JFS package offers.

Assumptions in this example:
-"/m" represents the mountpoint
-The new file system size is 300mb
-The file system is /dev/vg00/lvol6

1.Unmount and mount /m. (Best way to ensure it is not active)
2.Defragment and cluster the data:
#/usr/sbin/fsadm -F vxfs -d -D -e -E /m
3.Shrink the file system (Example 300mb):
#/usr/sbin/fsadm -F vxfs -b 300000 /m (the -b is the new size in KB)
4.Shrink the Logical Volume:
#/sbin/lvreduce -L 300 /dev/vg00/lvol6 (-L is new size in MB)

(Keep in mind that this is just one suggestion, and there are likely inefficiencies. Please feel free to comment or include suggestions.)