1835690 Members
2558 Online
110082 Solutions
New Discussion

lvreduce

 
khilari
Regular Advisor

lvreduce

Hi Guys, i had a filesystem which was 2 gb and i extended it to 6 gb,, but it had to be extended 4 gb.... I used online jfs to do it.. Now, the filesystem is mounted and i have to reduce it to 4 gb.... If i use lvreduce do i have to unmount the filesystem first... But, the fs cannot be unmounted... I have online jfs.. So, what would be the steps...
Thanks
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: lvreduce

From man fsadm_vxfs:

" File System Resizing
If the -b option is specified, fsadm resizes the file system whose mount point is mount_point. If newsize is larger than the current size of the file system, the file system is expanded to newsize sectors.
Similarly, if newsize is smaller than the current size of the file system, fsadm shrinks the file system to newsize sectors.

Increasing the size of a file system requires that the file system contain enough free space, prior to the expansion, for the growth of the structural files. In the case where a file system has no free blocks available, the attempt to increase the size of the file system will fail (see extendfs(1M) for an alternate method to increase file system size).

In a Version 3 or above disk layout, if there are file system resources in use in the sectors being removed, fsadm relocates those
resources to sectors staying within the resized file system. The time
needed for relocation depends on the number of blocks being moved.

In Version 2 disk layouts, file system structural components are fixed, so reducing the size of a file system fails if there are file system resources in use in the sectors being removed. In that case, a reorganization (using fsadm -e) can free busy resources and allow shrinking the file system. If there are still file system structural components within the area to be removed, you must upgrade the file system to a Version 3 or above disk layout to do a resize (see vxupgrade(1M))."


Pete

Pete
Anka
Trusted Contributor

Re: lvreduce

first reduce the FS then the lvol, there is no need to umount in order to reduce the lvol
Michael Steele_2
Honored Contributor

Re: lvreduce

Follow Petes -b example

fsadm -F vxfs -b ######M /filesystem

This is online JFS. No unmounting.

Question: What do you mean by "..But, the fs cannot be unmounted..."? Are you trying to umount and gettig a device busy error or something.

No filesystem can be unmounted while a process is attached. Use this command to find out.

fuser -cu /filesystem
Support Fatherhood - Stop Family Law
Prashanth Waugh
Esteemed Contributor

Re: lvreduce

Hi Khilari,

Pls check the below steps
1)First take a backup safety point of view
2)bdf
Check FS is in use or not
3)fuser -cu
4)Reorganize the files/directories in the file system.
fsadm -F vxfs -d -D -e -E
5)Reduce the file system size
fsadm -F vxfs -b
6)Reduce the logical volume.
lvreduce â L


check the man pages for each command so it will give clear idea what ur doing.

Regards
Atul
For success, attitude is equally as important as ability
SKR_1
Trusted Contributor

Re: lvreduce

First you need to take the backup of that LVOL.

1. Reduce the FS first with fsadm command.
2. Reduce LVOL with lvreduce command.

Thanks

SKR
Deepak Kr
Respected Contributor

Re: lvreduce

Also:

If it is a production machine then try doing it when load is least and file system mentioned here is not being accessed much.

Have you only run lvextend or fsadm also when adding 4 GB?

In our env we never use lvreduce in PRD servers
"There is always some scope for improvement"