Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
cancel
Showing results for 
Search instead for 
Did you mean: 

reduce the lv size

SOLVED
Go to solution
S.S.
Super Advisor

reduce the lv size

Hi,

I suppose to increase the lvcreate to 15gb but i have increased it to 25gb.

Now can i reduce it to 15gb by calculating the extents by using the following command:
#lvreduce -l

Thanks!
13 REPLIES
S.S.
Super Advisor

Re: reduce the lv size

The data inside this lv is the production data.
If i reduce the size, will there is an impact on the data?
Sagar Sirdesai
Trusted Contributor

Re: reduce the lv size

Lvreduce is a risky command.
Suggest o have a backup of the FS mounted on this LV. Then run the below command


1)fsadm -F vxfs -b

2) lvreduce -L


Sagar
VK2COT
Honored Contributor

Re: reduce the lv size

Hello,

Reducing a logical volume works well.

However, there are documented cases when it
caused problems.

It is strongly recommended to run a defragmentation of a logical volume before
running lvreduce(1M).

Regrads,

VK2COT
VK2COT - Dusan Baljevic
Kapil Jha
Honored Contributor

Re: reduce the lv size


i suppose we should run the command in reverse order.Not sure...
you can use lvreduce or lvextend with -L and final size.

If you have just run then i suppose it would not hurt the data but its always better to take the backup and reduce and see if if any files are lost.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
S.S.
Super Advisor

Re: reduce the lv size

Hi Sagar,

I have just increased the LV not yet increased the filesystem. In that case can we use lvreduce command?

Thanks!
Johnson Punniyalingam
Honored Contributor

Re: reduce the lv size

Backup mount point which corresponding to logical volume which need to lvreduce

Check below thread steps given.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1011016
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: reduce the lv size

>>I have just increased the LV not yet increased the filesystem. In that case can we use lvreduce command?<<<

again misunderstanding "lvextend" command will increase size of the logical volume, with help of online JFS , you refect changes without umounting file system

You meant to say ? you just issue "lvextend" didn't do "fsadm" right ?
Problems are common to all, but attitude makes the difference
OldSchool
Honored Contributor

Re: reduce the lv size

"...Reducing a logical volume works well...."

With Online JFS, yes. OP didn't mention OS version nor if online JFS was installed.

If not, you need a good backup of all the data on that logical volume. You'd have to reduce it "off-line" and restore the data.
Bill Hassell
Honored Contributor
Solution

Re: reduce the lv size

> I have just increased the LV not yet increased the filesystem. In that case can we use lvreduce command?

If you did not use fsadm or extendfs to change the filesystem then you can use lvreduce without any problems. lvextend makes the lvol bigger but has no effect on the filesystem. The filesystem code does not look at the lvol size. Only the commands newfs, mkfs, fsadm and extendfs will modify what the filesystem sees.

> Now can i reduce it to 15gb by calculating the extents...

LV extents are a real pain to use and easy to calculate incorrectly. Use -L #### in MBytes. If the original size in 15 GB, then lvreduce -L 15000 is all you need.


Bill Hassell, sysadmin
Viktor Balogh
Honored Contributor

Re: reduce the lv size

>LV extents are a real pain to use and easy to >calculate incorrectly. Use -L #### in MBytes. >If the original size in 15 GB, then lvreduce >-L 15000 is all you need.

Bill, I must neglect it. I prefer to use "-l extent number", because it is a much exact method. To me 15GB is 15*1024 MB which is 15360 MB. 15000MB would be 15GiB, but I dislike these notations anyway. If you stick to the sizes in MB or GB by extending an FS, you can easily get lost between the conversions.

****
Unix operates with beer.
S.S.
Super Advisor

Re: reduce the lv size

Thank you Bill Hassell for making me clear.

One more thing:
Actually i have increased to 25gb instead of 15gb right then in that case how can i revert to 15gb?
Following command will revert me to 15gb?

#lvreduce -L 15360

Thank you.
Johnson Punniyalingam
Honored Contributor

Re: reduce the lv size

You follow below example :- (In this example iam reducing "50MB

step1 :- Backup important ****

step 2 :-# fsadm -F vxfs -D -d -E -e -s /test/testlv -> File system name

step 3 :-# fsadm -F vxfs -b /test/testlv -> File system name

step 4:- # umount /test/testlv -> File system name
(this depends, hence i am not comfortable so i'm unmounting before redcuing)

step 5 :- # lvreduce -L /dev/vg01/lvol4

Warning: rounding up logical volume size to extent boundary at size "52" MB.

When a logical volume is reduced useful data might get lost;

do you really want the command to proceed (y/n) : y

Logical volume "/dev/vg01/lvol4" has been successfully reduced.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf

More refernce.

# fsadm ???F vxfs ???d ???D ???e ???E
-d perform directory defragmentation
-e perform extent defragmentation
# fsadm ???F vxfs ???b
-b set new file system size to n KB
# lvreduce ???L /dev/vgXX/lvolX
-L set new size of lvol to n MB
Problems are common to all, but attitude makes the difference
S.S.
Super Advisor

Re: reduce the lv size

Thank you.