Operating System - HP-UX
1848532 Members
3591 Online
104033 Solutions
New Discussion

Reducing the fielsystem size online using Online JFS

 
SOLVED
Go to solution
Phani_4
Frequent Advisor

Reducing the fielsystem size online using Online JFS

Hi,

If anybody knows how to reduce the filesystem size without unmounting it using Online JFS, please give me the detailed procedure.

Thanks,
Phani
11 REPLIES 11
Chris Watkins_1
Respected Contributor

Re: Reducing the fielsystem size online using Online JFS

OK, say we're going from 2 gigs to one gig:


# fsadm -b 1024M /mount/point/here
# lvreduce -L 1024 /dev/vgXX/lvolXX
Not without 2 backups and an Ignite image!
Geoff Wild
Honored Contributor

Re: Reducing the fielsystem size online using Online JFS

fsadm -b /mountpoint

lvreduce -L /dev/vgXX/lvolXX

Of course, a backup beforehand would be prudent...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sridhar Bhaskarla
Honored Contributor

Re: Reducing the fielsystem size online using Online JFS

Hi Phani,

Make sure you have a good backup of your filesystem just to be on safer side.


1. Use fsadm to shrink the size.

fsadm -b 500m /mount_point

500m is the new size. If the mount_point has 1500MB and if you want to reduce 1000MB, then you would use 500m as it is the new size.

2. Then use lvreduce to reduce the logical volume

lvreduce -L 500 /dev/vg01/rlvol1

bdf /mount_point

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

Re: Reducing the fielsystem size online using Online JFS

fsadm -F vxfs -b 131072 /user
would reduce /user to 128MB (131072 1024-byte sectors).

Note: you should follow this with an lvreduce if you need to resize space for another LVOL.

Man fsadm_vxfs before doing this so that you are aware of the warnings.
If it ain't broke, I can fix that.
Chris Watkins_1
Respected Contributor

Re: Reducing the fielsystem size online using Online JFS

Just in case /etc/default/fs doesn't specify LOCAL=vxfs, use:

# fsadm -F vxfs -b 1024M /mount/point
# lvreduce -L 1024 /dev/vgXX/lvolXX

instead. Just wanted to clarify that before someone else did :-)

(I know it's set on all our machines, so I rarely use it, but I
probably should... for that rare occasion when it might not be.)


Not without 2 backups and an Ignite image!
Jeff Schussele
Honored Contributor
Solution

Re: Reducing the fielsystem size online using Online JFS

Hi Phani,

1) Check free space - don't even attempt if there's not at least 33% free
2) Backup the Filesystem to tape - TWICE. This is THE most important step.
3) Run
fsadm -F vxfs -D -d -E -e /mnt_point # At least twice to reorg & defrag the FS as best as possible
4) Run
fsadm -F vxfs -b XXXXM /mnt_point # Where XXXX equals the new size in Megabytes - The "M" denotes such. This resizes the filesystem & this is where the rubber meets the road. It'll either work or fail here. If it fails you'll be glad that you did step #2
5) Run
lvreduce -L XXXX /dev/vg_name/lv_name #Again where XXXX equals the new smaller size & must match the value in the fsadm command.

I again must state that even IF there is what appears adequate free space, this command can fail - IT'S NOT BULLETPROOF - that's whay step #2 is the most important. And if you can get the downtime - it's always safer & better to do this unmounted.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Pete Randall
Outstanding Contributor

Re: Reducing the fielsystem size online using Online JFS

Phani,

To have the best chance of success, you'll first want to defragment and reorganize the file system:

fsadm -F vxfs -d -D -e -E /mountpoint

Then reduce as explained above.


Pete

Pete
Phani_4
Frequent Advisor

Re: Reducing the fielsystem size online using Online JFS

Hi All,

Thank you very much for your quick response. I have tested it on a newly created filesystem for testing. The above said commands are successfully working.

But when i use them on a filesytem which is about 120 GB in size..i am getting the following message.

suboz040:/ > bdf /dbback/PRDDW
Filesystem kbytes used avail %used Mounted on
/dev/vg02/lvol1 119898112 39638744 79632960 33% /dbback/PRDDW

suboz040:/ > fsadm -F vxfs -b 81920m /dbback/PRDDW
fsadm: cannot shrink /dev/vg02/rlvol1 - upgraded fs - inodes are currently in use.

I perfomed online defragmentation twice..but same above problem.

Regards,
Phani
Chris Watkins_1
Respected Contributor

Re: Reducing the fielsystem size online using Online JFS

You may want to make sure you have the aforementioned backups.
Get two good backups of the data, if you haven't already.

You may end up doing this one "offline" instead.

You have the choice of creating a new filesystem,
copying over the data, unmounting both filesystems,
and remounting the new "correctly sized" filesystem at old mountpoint,
or, if you don't have space for that... unmount the old
filesystem, blow it away, recreate with desired params, and
restore the data from the backup tapes.

It could be that, once you can shutdown everything using
the filesystem, you may be able to resize it at that point.
But I'd be prepared to do it the "long way" if needed.
Not without 2 backups and an Ignite image!
Sridhar Bhaskarla
Honored Contributor

Re: Reducing the fielsystem size online using Online JFS

Hi Phani,

If you have JFS3.3 installed, then try upgrading the filesystem to version 4 and see. 'vxupgrade' is the command.

It is easy if it is 11i. On version 4, the used blocks will be automatically adjusted to free up the space.

I say again, better keep a backup of your filesystem.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Chris Watkins_1
Respected Contributor

Re: Reducing the fielsystem size online using Online JFS

Good catch by Sri.
I didn't consider that you may have an older version.

# fstyp -v /dev/vgXX/lvolXX |grep version

Will give you the version.
Not without 2 backups and an Ignite image!