LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to resize /usr in lvm2? (https://www.linuxquestions.org/questions/debian-26/how-to-resize-usr-in-lvm2-906173/)

martin11 10-03-2011 06:54 AM

How to resize /usr in lvm2?
 
Hi all,

I want to enlagarge my /usr partition, since I don't get by with the 4.6G I have right now.

I have an lvm2 system.

First problem (maybe easier):
I looked at this tutorial from skolelinux: http://www.skolelinux.no/~klaus/newnotater/x1738.html

But got stuck soon, because debian uses different paths in /dev for the volume groups, and I need to be 100% sure of what I'm doing.

second problem:
I'd need to reduce one other lv in the lvm, all man-pages tell me that I have to shrink the lv first to avoid data loss - how do I do this?

muchos thanks!

kbp 10-03-2011 05:01 PM

First you need to determine whether there are any free extents in the volume group:

Code:

vgdisplay
Look for "Free PE / Size", if there are none free then you either need to reduce an existing logical volume or add more space.

I always get emails about enlarging my partition too but but I'm happy with what I have ;)

tommylovell 10-03-2011 08:11 PM

Quote:

Originally Posted by martin11 (Post 4488756)
second problem:
I'd need to reduce one other lv in the lvm, all man-pages tell me that I have to shrink the lv first to avoid data loss - how do I do this?

This would be a problem. You need to reduce the size of the filesystem first, then shrink the logical volume. Think of it as "the filesystem is within the LV". If you shrink the outer "container" before you shrink the contents you may have data that is outside the LV and can no longer be addressed. Conversely, when you are expanding you 'lvresize' or 'lvextend' first, then 'resize2fs' the filesystem.

You didn't say so I'll assume that your filesystem is ext2/3/4. If that's the case, the filesystem needs to be umounted before it is resized downwards, too, so you may need to do this from a rescue environment.

Quote:

...debian uses different paths in /dev for the volume groups, and I need to be 100% sure of what I'm doing.
To see the relationship between logical volumes, aliases for LV's, and DM block devices, look at
  1. the "Block device" address in the output of an 'lvdisplay' command,
  2. the major, minor device number from 'dmsetup ls', and
  3. the major minor numbers from 'ls -l /dev/dm-*', 'ls -l /dev/<vgname>/*', and 'ls -l /dev/mapper/*' commands.
(The major number for LVM devices should be 253.)

So, if you show us the output from the above commands in addition to kbp's request for a 'vgdisplay', it'll help those trying to walk you though this.

I'm LVM literate, but not debian literate, so I hope others will pitch in with debian-specific advice.


All times are GMT -5. The time now is 09:01 PM.