Operating System - HP-UX
1826313 Members
3914 Online
109692 Solutions
New Discussion

Re: Command to reduce the filesystem size?

 
Jagadesh
Frequent Advisor

Command to reduce the filesystem size?

Dear All;

To reduce the LV size we user lvreduce.
Is there any similar command to reduce the file system size.

command similar to lvreduce.
Thanks
6 REPLIES 6
Mohanasundaram_1
Honored Contributor

Re: Command to reduce the filesystem size?

Hi Jagadesh,

There is no command to reduce filesystem.

If you are trying to reduce the LV, be prepared to do a newfs on the reduced LV and restore the data from a backup.

When you perform lvreduce, the command does not check if there is data in the extent it is removing, Therefore it may result in data loss.

Supported method is,

1) Backup filesystem
2) Lvreduce the LV
3) Newfs LV
4) Restore the backup

Hope this helps.

With regards,
Mohan.
Attitude, Not aptitude, determines your altitude
Steven E. Protter
Exalted Contributor

Re: Command to reduce the filesystem size?

Don't try and reduce too much. If you try and lvreduce down to the last extent the commmand could fail, leaving you with no filesystem at all.

A backup is always a good idea. I wasn't aware that newfs was necessary. If you're careful you might not need to do that.

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
Lee Tae-kyung
Regular Advisor

Re: Command to reduce the filesystem size?

Hi^^..

File system is a attribute. so, File system don't have the command of reduce or extend.

Good day~~
I think I am a specialist in IT Korea^^. I am a programmer and SE and DBA
Geoff Wild
Honored Contributor

Re: Command to reduce the filesystem size?

With Online JFS, you can reduce on the fly with fsadm.

fsadm -b M /mountpoint
lvreduce -L

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

Re: Command to reduce the filesystem size?

Hi Jagadesh,

(And Steve),This is what you can find in the man pages of lvreduce "warnings" section,

LVM does not store any information about which physical extents within
a logical volume contain useful data; therefore, reducing the space
allocated to a logical volume without doing a prior backup of the data
could lead to the loss of useful data. The lvreduce command on a
logical volume containing a file system of greater length than the
size being reduced to will cause data corruption.

To reduce a logical volume being used for swap, that swap area must
not be currently in use.
Attitude, Not aptitude, determines your altitude
Sunil Sharma_1
Honored Contributor

Re: Command to reduce the filesystem size?

Hi,

If you are using Veritas Volume manager you can use vxassist to do this.

In lvm if you have Online Jfs you can use fsadm.

No other way to reduce FS without lossing data.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***