Operating System - HP-UX
1849974 Members
1974 Online
104049 Solutions
New Discussion

Re: Reduce /usr file system (vxfs)

 
SOLVED
Go to solution

Reduce /usr file system (vxfs)

Given that /usr is large enough to be reduced what is the best way to accomplish the task. Aren't command that are necessary to accomplish the reduce in /usr/bin - /usr/sbin ?
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor

Re: Reduce /usr file system (vxfs)

Hi Elliott:

If you have Online JFS licensed, then you may be able to do this while the filesytem is mounted. Generally you are advised to degragment the filesystem first. It is more likely that the subsequent attempt to shrink the filesystem will succeed if you do this. If files reside and are inuse in the region destined for reduction, the reduction will fail. The latest (3.3) version of JFS does much better at this than earlier version, I understand.

Assuming online JFS:

# fsadm -d -D -e -E /
# fsadm -b /
# lvreduce -L /dev/vgXX/lvolX

If you do not have the online JFS component, then you must backup the filesystem's data; unmount the filesystem; lvreduce;, recreate; and reload the contents.

...JRF...
Steffi Jones_1
Esteemed Contributor

Re: Reduce /usr file system (vxfs)

Hi Elliott,

first the most important thing.... make a backup!!!

You will find all the commands needed in /sbin.
These commands are not linked to any libraries and work in single user mode and without /usr mounted.

So it depends if you have advanced JFS installed or not. But if so check the manpage for fsadm_vxfs.

If not you need to get to single user mode and do a lvreduce on that lvol.

But really make sure that you have the data on a tape to fall back. Reducing always bears some risk.

Good luck,

Steffi Jones
Peggy Fong
Respected Contributor

Re: Reduce /usr file system (vxfs)

If you have online jfs can do the following
1. defrag your file system
fsadm -F vxfs -d -e -s /var
2. Reduce the file system
Example: you want to go from 1G to 500Mb
Calculate size in bytes 500*1024=510000 ( I didn't use a calculater but you get the idea :) 0

fsadm -F vxfs -b 510000 /var

If this works then you can go to the next step
3. Reduce the lvol
bdf - get new size of fs and divide by 1024 to get Mb of filesystem
Use the newsize + 4m so if the new sise is 512M use 516M so you don't destroy any data in your file system.

lvreduce -L /dev/vgXX/lvol#
example
lvreduce -L 516 /dev/vgXX/lvol#

Hope this helps.
Peggy

Re: Reduce /usr file system (vxfs)

James & Steffi,

I do not have JFS.

In addition, to clarify my question, if I will be using the mount, cpio, etc... commands to do the restore, once I do the lvreduce on /usr, will I still be able to use those commands ?
Vincenzo Restuccia
Honored Contributor

Re: Reduce /usr file system (vxfs)

#rcp -p /usr/bin/lvreduce /tmp
#rcp -p /usr/bin/newfs /tmp
#tar cvf /usr/*
Boot in single user mode
#mount /tmp
#cd /tmp
#lvreduce -L xxx /dev/vg00/lvolx
#newfs -F vxfs /dev/vg00/rlvolx
#mount /dev/vg00/lvolx /usr
#cd /usr
#tar xv
#reboot
James R. Ferguson
Acclaimed Contributor

Re: Reduce /usr file system (vxfs)

HI Elliott:

OK. 'vxfs' is also know as "JFS", but JFS has a base and an online component. If you don't have the online component (no "online" noted in: 'swlist -l bundle|grep -i jfs' output) then you will need to drop to single-user mode and use the commands in /sbin.

I suggest that booting to single-user mode is easist; then doing your LVM maintenance is the easiest, cleanest way to start. You could also do your backups there (with /usr mounted) to be sure of a quiet system.

As always, make very, very sure you have a good backup.

...JRF...

Re: Reduce /usr file system (vxfs)

The point I do not understand is once I do the lvreduce and the newfs to reduce the /usr file system, the file /usr/bin/cpio I need to restore the backup will no longer exist. Even if I were to copy /usr/bin/cpio to another file system and try to execute the cpio command from there I receive an error message.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Reduce /usr file system (vxfs)

Hi Elliott:

'tar' resides in /sbin as does 'frecover'. You could use either 'tar' or 'fbackup' while /usr is mounted, and then use '/sbin/tar' or '/sbin/frecover' to restore. Yes, 'cpio' only exists in /usr.

...JRF...