LVM and VxVM

How to reduce the /usr filesystem

 
SOLVED
Go to solution
arkie
Super Advisor

How to reduce the /usr filesystem

Hi All,

We have HP-UX B.11.11 running in one of our rp4440's. A new requirement has come up for which the application team has revised a few of the existing LV sizes and also added new ones. For e.g., the existing /usr filesystem is 10485760 Kb (10 Gb), and the new requirement is no more than 5 Gb.

Can we reduce the /usr filesystem. If so, can you share the steps to do so. We have already tarred the contents of /usr and backed up the same.

Thanks

7 REPLIES 7
S.N.S
Valued Contributor
Solution

Re: How to reduce the /usr filesystem

Hi,

Check if you have
1. Online JFS & 2. and it has a valid license

ie .
1. swlist -l product | grep -i online
Output will be like:
OnlineJFS B.11.11.04 Online features of the VxFS File System
2. vxlicense -p

With OnlineJFS you can try to reduce the FS using fsadm specifying the new size in KB. Due
to some design limitations this often fails with JFS 3.1 and older. After fsadm successfully
reduced the FS you can use lvreduce to reduce the underlying LV:
# lvreduce -L /dev/vg01/lvdata



Reducing a LV without OnlineJFS is not possible. You have to backup the data, remove and recreate
the LV, create a new FS and restore the data from the backup into that FS

http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1271402939775+28353475&threadId=109782


HTH
SNS
"Genius is 1% inspiration, 99% Perspiration" - Edison
Suraj K Sankari
Honored Contributor

Re: How to reduce the /usr filesystem

Hi,
You can reduce the size of a logical volume by using the lvreduce(1M) command.
Reducing the size of a logical volume is appropriate when you want to use the logical volume for another purpose that requires less space.
Caution
- When you reduce the size of a logical volume, you might lose data as LVM deallocates disk space.
- Reduce the size of a logical volume only if you have safely backed up the contents to tape or another logical volume, or if you no longer need its current contents.
- You cannot â reduceâ the size of a file system; use newfs.

Suppose you have a logical volume of 80MB. You no longer need the current data in the logical volume, but you would like to use it for another purpose that requires only 40MB.
# lvreduce -L 40 /dev/vg03/lvol4
When you issue the command, LVM asks for confirmation. If you answer y to proceed, you get a confirmation message:
Logical volume "/dev/vg03/lvol4" has been successfully reduced.

Suraj
S.N.S
Valued Contributor

Re: How to reduce the /usr filesystem

Hi,

Missing out on the fsadm command in the previous post

# fsadm -b

In this case ,specify the size to which you need to reduce the /usr...

And Suraj, the query was for the filesystem, not exactly for LV reduce.

HTH
SNS
(pls no points for this extra post)
"Genius is 1% inspiration, 99% Perspiration" - Edison
Pete Randall
Outstanding Contributor

Re: How to reduce the /usr filesystem

Yes, you can run lvreduce, but there is no corresponding fsreduce command to shrink the file system. You have to run newfs, destroying all the data in the file system.

The easier way to go about this is to create a new logical volume of the appropriate size (lvcreate), create a new file system in it (newfs), then copy the contents of /usr into the new space, switch the /etc/fstab entries so that the new file system gets mounted to /usr, and reboot.


Pete

Pete
Pete Randall
Outstanding Contributor

Re: How to reduce the /usr filesystem

Sorry, I should add that the technique described obviously only works if you have spare space in vg00.

The other alternative is to boot from an Ignite tape and re-size your root file systems before reloading them.


Pete

Pete
Benoy Daniel
Trusted Contributor

Re: How to reduce the /usr filesystem

1. Make sure you have online jfs is installed.
2. Take the backup of the file system
3. Defragment the file system using
fsadm -d -D -e -E /mount_point

4. reduce the file system.

fsadm -b /

5. lvreduce -L

It works fine..

S.N.S
Valued Contributor

Re: How to reduce the /usr filesystem

Hi..

Pete
>>Sorry, I should add that the technique described obviously only works if you have spare space in vg00.

Will space be a concern, since it is on
Reducing the FS, not increasing the /usr?

Also, Benoy
Online JFS comes at a cost (you would know for sure)...If the admin doesn't have Online JFS doesn't me an that he/she can't reduce the FS size - he can follow the alternate process mentioned
:-)

Arkie, reply to Us - and assign All of Us with points points points ;-)
Cheers!
SNS
"Genius is 1% inspiration, 99% Perspiration" - Edison