1833832 Members
2110 Online
110063 Solutions
New Discussion

reducing fs size.

 
Remy_1
Occasional Advisor

reducing fs size.

Hi,

Is it possible to reduce the size of a filesystem without having to recreate it?
I know that it's possible to increase it on the fly with online JFS, but never reduce it.
If possible, please include instructions.

Thanks again,
Remy
6 REPLIES 6
Jeff Schussele
Honored Contributor

Re: reducing fs size.

Hi Remy,

Yes - with OnLine JFS & the proper vxfs version you can reduce FS size. But make sure you back it up first - just in case.

1) Defrag/Reorg the FS - twice
fsadm -F vxfs -D -d -E -e /mnt_point

2) Resize the FS
fsadm -F vxfs -b XXXXM /mnt_point
where XXXX = the new smaller size in MB - the M is to denote MB

3) Reduce the LV
lvreduce -L XXXX /dev/vg_name/lv_name
where XXXX = the *same* MB size as the fsadm command.

HTH,
Jeff


PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: reducing fs size.

you need to run the lvreduce command

You can reduce the logical volume the filesystem is sitting on.

Be careful if you squeeze it too much data will be damaged.

Instructions:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=235198

My search:
http://us-support.external.hp.com/emse/bin/doc.pl/sid=d4445c3d10f1a66dcb?todo=search&searchtext=lvreduce+&x=2&y=11&searchcriteria=allwords&searchtype=SEARCH_FORUMS&searchcategory=ALL&rn=25&presort=rank

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: reducing fs size.

Hi Remy,

Have a good backup (verified) of your data before you attempt to reduce.

It is possible to reduce the filesystem with OnlineJFS. Following are the instructions. Say /mount and /dev/vg01/lvol1 are the filesystem and the logical volumes respectively. You want to reduce /mount from 1000 MB to 900MB.

#fsadm -b 900m /mount
(make sure it is successful)
#bdf /mount
#lvreduce -L 900 /dev/vg01/lvol1


You can try defragment the filesystem if it doesn't work, but there isn't much guarantee though.

If this is to work best, you will need to have latest patches. It will work almost 100% on all Version 4 filesystems.

Without OnlineJFS, you cannot reduce the filesystem. You will need to backup the data, recreate the logical volume and then restore.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Remy_1
Occasional Advisor

Re: reducing fs size.

Thank you all for all your information. I'm noticing that the commands are reversed from if you want to increase it. Does it matter which order I do the commands?

Thanks again,
Remy
Jeff Schussele
Honored Contributor

Re: reducing fs size.

Hi Remy,

Absolutely.
The FS can *never* be larger than the LV or corruption is certain.
That's why you grow the LV first, but shrink the FS first.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sridhar Bhaskarla
Honored Contributor

Re: reducing fs size.

Hi Remy,

Filesystem is always on 'top' of the logical volume. So to extend, we extend the logical volume first and then the filesystem. To reduce, we reduce the filesystem and then the logical volume.

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