cancel
Showing results for 
Search instead for 
Did you mean: 

/opt

Mohd Rasidi Che Mat
Frequent Advisor

/opt

hi,
is it possible to reduce /opt in linux ? server is Red Hat Enterprise Linux AS release 4 (Nahant Update 4).

tried to find "reduce /opt" from this forum but got too many unrelevant results.
4 REPLIES
Steven E. Protter
Exalted Contributor

Re: /opt

Shalom,

df -kh /opt

See if its a separate mount point.

The answer is probably yes. If it is its own mount point and it is not to full, you can reduce it.

resize2fs

That is the command you need to use.

Under rhel5 you can use this command to increase or reduce while the files system is in use.

You will need to umount /opt to do this under rhel 4.

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
Mohd Rasidi Che Mat
Frequent Advisor

Re: /opt

so no need to lvreduce first?
for example, when we incr /opt first we do lvextend first then run ext2online.
Matti_Kurkela
Honored Contributor

Re: /opt

The LV must *never* be smaller than the filesystem inside it.

When expanding, first lvextend, then resize2fs/ext2online.

When shrinking, first resize2fs, then lvreduce - and be very careful of not reducing too much!

MK
MK
loco_vikide
Frequent Advisor

Re: /opt

The resize2fs and lvreduce command are required for shrinking your logical volume.

Shrinking logical volume is a risky move for losing data. It has never been recommended thing to do by experts. You must exercise cautions.

Anyway, to be on the safe side, if possible, you should consider to create a new logical volume, copy all your data to it then shrink your /opt file system and its logical volume or umount your current /opt file system then mount /opt on your new logical volume on which you have copied data.

Cheers