Operating System - HP-UX
1752810 Members
5971 Online
108789 Solutions
New Discussion юеВ

How can I reduce a file system size

 
SOLVED
Go to solution
Vipin Singhal
Super Advisor

How can I reduce a file system size

Hi Buddy,
I ahve online JFS on my system and i need to reduce a file system size,
these are the details of file system:
/dev/vg01/vipin 7045120 4649684 2246779 67% /vipin

and I need to make it of 4GB,
Please suggest,
vipin
8 REPLIES 8
Devesh Pant_1
Esteemed Contributor

Re: How can I reduce a file system size

Hello Vipin,
You can take a backup of the filesystem or Create a ignite tape.
Then do the following

#fsadm -b "reduced size in KB" /mountpoint

Once the filesystem has been reduced, use the lvreduce to resize the logical
volume to the appropriate size:

#lvreduce -L "new size in MB" /logical_volume


thanks
DP
Geoff Wild
Honored Contributor

Re: How can I reduce a file system size

First - back it up...

Second - make sure backup worked...

Then:

fsadm -b 4096M /vipin
lvreduce -L 4096 /dev/vg01/vipin

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.
HGN
Honored Contributor

Re: How can I reduce a file system size

Hi

If you want to make it 4GB then you will loose data since it is already showing as 67% full.

Rgds

HGN
James R. Ferguson
Acclaimed Contributor

Re: How can I reduce a file system size

Hi Vipin:

You don't indicate what version of JFS you have. If you don't have version 3.3 or better you will probably not be successful dynamically reducing the filesystem size. If you wish to try, use:

# fsadm -b "KB_size_desired" /mountpoint

The guaranteed way is to backup your filesystem; 'lvreduce' the logical volume container in which the filesystem resides; create a new filesytem ('newfs'); and restore the backed-up data into it.

Regards!

...JRF...
Vipin Singhal
Super Advisor

Re: How can I reduce a file system size

# swlist -l product | grep JFS
JFS B.11.23 The Base VxFS File System
OnlineJFS B.11.23.0505 Online features of the VxFS File System

this is too urgent and I dont have time to backed up.

should i run these command to reduce it and make the new size of 5GB.
#fsadm -F vxfs -b 5124M /vipin
#lvreduce -L 5124 /dev/vg01/vipin

suggest

Geoff Wild
Honored Contributor

Re: How can I reduce a file system size

Too urgent?

Well - that depends - if you had to re-create everything from scratch in /vipin - could you?

Do you at least have a backup of some sort?

You may also have to defrag it first:

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

Myself - I have never lost data shrinking file systems - but we all have to listen to Murphy's law...

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.
Andy Torres
Trusted Contributor
Solution

Re: How can I reduce a file system size

If you want to keep the lvol name "/dev/vg01/vipin" you have two choices - rebuild it or reduce it.

- Back it up. This is a must. You can hose your data doing an lvreduce. Maybe not today, but it only takes one time to force an unexpected resume update.
- Make sure it's a quiet filesystem (fuser clear).
- fsadm -F vxfs -d -D -e -E /vipin (I do this twice because it makes me feel better)
- fsadm -F vxfs -b 4096000 /vipin
- lvreduce -L 4096 /dev/vg01/vipin

If it's urgent, you might like to create a temporary lvol and move some of the least-used files/directories over, then link to them from /vipin. Performance may degrade some, but it'll buy you some time to get the lvol rebuilt in a sane manner.
Vipin Singhal
Super Advisor

Re: How can I reduce a file system size

Thanks