linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Moving space between logical volumes?
@ 2005-08-31 19:56 Meadows, Howard T
  2005-08-31 21:28 ` Chris Osicki
  0 siblings, 1 reply; 7+ messages in thread
From: Meadows, Howard T @ 2005-08-31 19:56 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]


I have a volume group with 4 logical volumes. One of the logical volumes has
a huge amount of space allocated to it, and another is running out of its
space.

I am assuming there is a way to re-allocate space from the one with lots of
space to the one that is running out. I am nervous about using losing data
with a reduce-extend combination of commands. Can someone who has done this
explain exactly how this is done (safely)?

Thanks,

-Howard


=======================================================
Howard Meadows                 howard-meadows@uiowa.edu
ITS - SPA, Unix Systems Group              319-335-5519
The University of Iowa                    Iowa City, IA
 


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3038 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Moving space between logical volumes?
  2005-08-31 19:56 Meadows, Howard T
@ 2005-08-31 21:28 ` Chris Osicki
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Osicki @ 2005-08-31 21:28 UTC (permalink / raw)
  To: LVM general discussion and development


Hi Howard

Your start point is "man lvreduce". Depending of the filesystem type
you're using you would have to find out how to resize the FS _before_
using lvreduce/lvextend. Depending on the FS type it may or may not be
possible to do it on a mounted FS. In worst case a boot from Rescue-CD
would be necessary == down-time.

You will have to do this:

	 resize (decrease size of) the file system on the huge_lvol
	 lvreduce huge_lvol
	 lvextend tight_lvol
	 resize (increase size of) the file system on the tight_lvol

LVols resizing was I think the first and most important motivation to
write LVM.
Good luck.

Regards,
Chris

On Wed, Aug 31, 2005 at 02:56:40PM -0500, Meadows, Howard T wrote:
> 
> I have a volume group with 4 logical volumes. One of the logical volumes has
> a huge amount of space allocated to it, and another is running out of its
> space.
> 
> I am assuming there is a way to re-allocate space from the one with lots of
> space to the one that is running out. I am nervous about using losing data
> with a reduce-extend combination of commands. Can someone who has done this
> explain exactly how this is done (safely)?
> 
> Thanks,
> 
> -Howard
> 
> 
> =======================================================
> Howard Meadows                 howard-meadows@uiowa.edu
> ITS - SPA, Unix Systems Group              319-335-5519
> The University of Iowa                    Iowa City, IA
>  
> 



> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

-- 

Chris Osicki osk@osk.ch
Dipl. Informatik-Ing. HTL

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Moving space between logical volumes?
@ 2005-09-01 15:28 Meadows, Howard T
  2005-09-02  8:36 ` Chris Osicki
  2005-09-06 14:21 ` David Johnston
  0 siblings, 2 replies; 7+ messages in thread
From: Meadows, Howard T @ 2005-09-01 15:28 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 3426 bytes --]

Chris,

    Thanks for your reply. The logical volumes in question are ext3
filesystems. I did read the man page for lvreduce and its warning about
possible loss of data was what originally prompted me to ask for help.

    I do not want to resize the partition (they are all on the same
partition), so I am wondering if e2fsadm might do the trick? It looks like
you can shrink (and expand) logical volumes using e2fsadm with the
restriction that shrinking only works on unmounted filesystems (if I'm
reading the man page correctly). So... my current thought is as follows:

    * unmount the filesystems in question.
    * use 'tune2fs -O ^has_journal /dev/sda5' to turn off journaling
    * use 'e2fsadm -L -100G /dev/vg/lv1' to reduce lv1 by 100GB
    * use 'e2fsadm -L +100G /dev/vg/lv2' to increase lv2 by 100GB
    * use 'e2fsck -f /dev/sda5' to check the filesystems
    * use 'tune2fs -j /dev/sda5' to turn journaling back on
    * re-mount the filesystems

    It seems (from the man page for e2fsadm) that lvreduce/lvextend would
then not be needed. Is this true?

    I would like to feel more confident that this would actually work before
I jump in there and do it because I don't feel like looking for a new job if
it doesn't. ;-)

    Thanks,

-Howard
 

-----Original Message-----
From: linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com] On
Behalf Of Chris Osicki
Sent: Wednesday, August 31, 2005 4:28 PM
To: LVM general discussion and development
Subject: Re: [linux-lvm] Moving space between logical volumes?


Hi Howard

Your start point is "man lvreduce". Depending of the filesystem type
you're using you would have to find out how to resize the FS _before_
using lvreduce/lvextend. Depending on the FS type it may or may not be
possible to do it on a mounted FS. In worst case a boot from Rescue-CD
would be necessary == down-time.

You will have to do this:

	 resize (decrease size of) the file system on the huge_lvol
	 lvreduce huge_lvol
	 lvextend tight_lvol
	 resize (increase size of) the file system on the tight_lvol

LVols resizing was I think the first and most important motivation to
write LVM.
Good luck.

Regards,
Chris

On Wed, Aug 31, 2005 at 02:56:40PM -0500, Meadows, Howard T wrote:
> 
> I have a volume group with 4 logical volumes. One of the logical volumes
has
> a huge amount of space allocated to it, and another is running out of its
> space.
> 
> I am assuming there is a way to re-allocate space from the one with lots
of
> space to the one that is running out. I am nervous about using losing data
> with a reduce-extend combination of commands. Can someone who has done
this
> explain exactly how this is done (safely)?
> 
> Thanks,
> 
> -Howard
> 
> 
> =======================================================
> Howard Meadows                 howard-meadows@uiowa.edu
> ITS - SPA, Unix Systems Group              319-335-5519
> The University of Iowa                    Iowa City, IA
>  
> 



> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

-- 

Chris Osicki osk@osk.ch
Dipl. Informatik-Ing. HTL

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3038 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [linux-lvm] Moving space between logical volumes?
  2005-09-01 15:28 [linux-lvm] Moving space between logical volumes? Meadows, Howard T
@ 2005-09-02  8:36 ` Chris Osicki
  2005-09-06 14:21 ` David Johnston
  1 sibling, 0 replies; 7+ messages in thread
From: Chris Osicki @ 2005-09-02  8:36 UTC (permalink / raw)
  To: LVM general discussion and development


Howard

I've got more experience with growing filesystems as with reducing them. Never managed to 
delete enough data so a shring would make sense ;-)
Just yesterday I inncreased size of a ext3 FS by doing this

	umount /local
	lvextend --size +4G /dev/gv00/local
	resize2fs

resize2fs asked me to fsck -f /dev/gv00/local

	mount /local

That was it.
Shrinking is a bit more tricky as you have to be careful shrinking your LVol not to make is 
smaller than the filesystem. 

I've never used tune2fs or e2fsadm for this purpose and I think it's not the way to go.

Hope it helps.

Regards,
Chris

On Thu, 1 Sep 2005 10:28:57 -0500
"Meadows, Howard T" <howard-meadows@uiowa.edu> wrote:

> Chris,
> 
>     Thanks for your reply. The logical volumes in question are ext3
> filesystems. I did read the man page for lvreduce and its warning about
> possible loss of data was what originally prompted me to ask for help.
> 
>     I do not want to resize the partition (they are all on the same
> partition), so I am wondering if e2fsadm might do the trick? It looks like
> you can shrink (and expand) logical volumes using e2fsadm with the
> restriction that shrinking only works on unmounted filesystems (if I'm
> reading the man page correctly). So... my current thought is as follows:
> 
>     * unmount the filesystems in question.
>     * use 'tune2fs -O ^has_journal /dev/sda5' to turn off journaling
>     * use 'e2fsadm -L -100G /dev/vg/lv1' to reduce lv1 by 100GB
>     * use 'e2fsadm -L +100G /dev/vg/lv2' to increase lv2 by 100GB
>     * use 'e2fsck -f /dev/sda5' to check the filesystems
>     * use 'tune2fs -j /dev/sda5' to turn journaling back on
>     * re-mount the filesystems
> 
>     It seems (from the man page for e2fsadm) that lvreduce/lvextend would
> then not be needed. Is this true?
> 
>     I would like to feel more confident that this would actually work before
> I jump in there and do it because I don't feel like looking for a new job if
> it doesn't. ;-)
> 
>     Thanks,
> 
> -Howard
>  
> 
> -----Original Message-----
> From: linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com] On
> Behalf Of Chris Osicki
> Sent: Wednesday, August 31, 2005 4:28 PM
> To: LVM general discussion and development
> Subject: Re: [linux-lvm] Moving space between logical volumes?
> 
> 
> Hi Howard
> 
> Your start point is "man lvreduce". Depending of the filesystem type
> you're using you would have to find out how to resize the FS _before_
> using lvreduce/lvextend. Depending on the FS type it may or may not be
> possible to do it on a mounted FS. In worst case a boot from Rescue-CD
> would be necessary == down-time.
> 
> You will have to do this:
> 
> 	 resize (decrease size of) the file system on the huge_lvol
> 	 lvreduce huge_lvol
> 	 lvextend tight_lvol
> 	 resize (increase size of) the file system on the tight_lvol
> 
> LVols resizing was I think the first and most important motivation to
> write LVM.
> Good luck.
> 
> Regards,
> Chris
> 
> On Wed, Aug 31, 2005 at 02:56:40PM -0500, Meadows, Howard T wrote:
> > 
> > I have a volume group with 4 logical volumes. One of the logical volumes
> has
> > a huge amount of space allocated to it, and another is running out of its
> > space.
> > 
> > I am assuming there is a way to re-allocate space from the one with lots
> of
> > space to the one that is running out. I am nervous about using losing data
> > with a reduce-extend combination of commands. Can someone who has done
> this
> > explain exactly how this is done (safely)?
> > 
> > Thanks,
> > 
> > -Howard
> > 
> > 
> > =======================================================
> > Howard Meadows                 howard-meadows@uiowa.edu
> > ITS - SPA, Unix Systems Group              319-335-5519
> > The University of Iowa                    Iowa City, IA
> >  
> > 
> 
> 
> 
> > _______________________________________________
> > linux-lvm mailing list
> > linux-lvm@redhat.com
> > https://www.redhat.com/mailman/listinfo/linux-lvm
> > read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
> 
> -- 
> 
> Chris Osicki osk@osk.ch
> Dipl. Informatik-Ing. HTL
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Moving space between logical volumes?
  2005-09-01 15:28 [linux-lvm] Moving space between logical volumes? Meadows, Howard T
  2005-09-02  8:36 ` Chris Osicki
@ 2005-09-06 14:21 ` David Johnston
  1 sibling, 0 replies; 7+ messages in thread
From: David Johnston @ 2005-09-06 14:21 UTC (permalink / raw)
  To: LVM general discussion and development

On Thu, 2005-09-01 at 10:28 -0500, Meadows, Howard T wrote:
> The logical volumes in question are ext3 filesystems. I did read the
> man page for lvreduce and its warning about possible loss of data was
> what originally prompted me to ask for help.
> 
> I am wondering if e2fsadm might do the trick? It looks like you can shrink
> (and expand) logical volumes using e2fsadm with the restriction that
> shrinking only works on unmounted filesystems (if I'm reading the man
> page correctly). So... my current thought is as follows:
> 
>     * unmount the filesystems in question.
>     * use 'tune2fs -O ^has_journal /dev/sda5' to turn off journaling
>     * use 'e2fsadm -L -100G /dev/vg/lv1' to reduce lv1 by 100GB
>     * use 'e2fsadm -L +100G /dev/vg/lv2' to increase lv2 by 100GB
>     * use 'e2fsck -f /dev/sda5' to check the filesystems
>     * use 'tune2fs -j /dev/sda5' to turn journaling back on
>     * re-mount the filesystems
> 
>     It seems (from the man page for e2fsadm) that lvreduce/lvextend would
> then not be needed. Is this true?

e2fsadm is a front end for the LVM tools.  It simplifies things by doing
the math for you, and by doing the steps in the correct order (which
changes depending on whether you are growing or shrinking).

If /dev/vg/lv1 and /dev/vg/lv2 are logical volumes, and you have ext3
filesystems on them, all you need to do is this:

# Shrink lv1
umount /dev/vg/lv1
e2fsadm -L -100G /dev/vg/lv1
mount /dev/vg/lv1

# Expand lv2
umount /dev/vg/lv2
e2fsadm -L +100G /dev/vg/lv2
mount /dev/vg/lv2

That's it.

I'm concerned about your reference to /dev/sda5.  Is that your LVM
partition?  If so, leave it alone.  From its name, it's clear that it is
not a logical partition, so you can't use LVM tools to manipulate it.
What's special about /dev/sda5 that makes you think you need to turn
journaling off before you can resize /dev/vg/lv1?

-DJ

LVM vocabulary in newbie terms:
	physical volume = a disk
	logical volume  = a partition
By extention,
	lvresize = fdisk

In reality, it's not that simple, but until you're comfortable with LVM,
these simple definitions will steer you well.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Moving space between logical volumes?
@ 2005-09-06 15:18 Meadows, Howard T
  2005-09-06 21:20 ` David Johnston
  0 siblings, 1 reply; 7+ messages in thread
From: Meadows, Howard T @ 2005-09-06 15:18 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 4116 bytes --]

On Tue, 2005-09-06 at 9:22 AM, David Johnston wrote:

>
>e2fsadm is a front end for the LVM tools.  It simplifies things by doing
>the math for you, and by doing the steps in the correct order (which
>changes depending on whether you are growing or shrinking).
>
>If /dev/vg/lv1 and /dev/vg/lv2 are logical volumes, and you have ext3
>filesystems on them, all you need to do is this:
>
># Shrink lv1
>umount /dev/vg/lv1
>e2fsadm -L -100G /dev/vg/lv1
>mount /dev/vg/lv1
>
># Expand lv2
>umount /dev/vg/lv2
>e2fsadm -L +100G /dev/vg/lv2
>mount /dev/vg/lv2
>
>That's it.
>
>I'm concerned about your reference to /dev/sda5.  Is that your LVM
>partition?  If so, leave it alone.  From its name, it's clear that it is
>not a logical partition, so you can't use LVM tools to manipulate it.
>What's special about /dev/sda5 that makes you think you need to turn
>journaling off before you can resize /dev/vg/lv1?
>
>-DJ
>
>LVM vocabulary in newbie terms:
>	physical volume = a disk
>	logical volume  = a partition
>By extention,
>	lvresize = fdisk
>
>In reality, it's not that simple, but until you're comfortable with LVM,
>these simple definitions will steer you well.
>

David,

    Thanks very much for the information. 

    To clarify my present configuration, I'm including data from fdisk,
vgdisplay and lvdisplay for the two logical volumes I want to resize.

    From what I see, it sounds like I can use the commands you specified
(with the correct lv and vg names) and all should be well (with no loss of
data). If I could take advantage of your kindness just a little more, could
you look at my information below and confirm that those commands are
correct?

    Thanks VERY much,

-Howard

Here is the data:
=====================================

Data reported with fdisk p command:

Disk /dev/sda: 254 heads, 63 sectors, 44798 cylinders
Units = cylinders of 16002 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *         1         3     23971+  83  Linux
/dev/sda2             4       259   2048256   83  Linux
/dev/sda3           260       514   2040255   82  Linux swap
/dev/sda4           515     44798 354316284    5  Extended
/dev/sda5           515       770   2048224+  8e  Linux LVM
/dev/sda6           771     32767 256007965+  8e  Linux LVM

=======================================

Output from vgdisplay command for 
volume group containing logical
volumes in question:

# vgdisplay /dev/storagevg
--- Volume group ---

VG Name               storagevg
VG Access             read/write
VG Status             available/resizable
VG #                  1
MAX LV                256
Cur LV                4
Open LV               4
MAX LV Size           2 TB
Max PV                256
Cur PV                2
Act PV                2
VG Size               585.88 GB
PE Size               32 MB
Total PE              18748
Alloc PE / Size       18208 / 569 GB
Free  PE / Size       540 / 16.88 GB
VG UUID               Ntjcgr-zTVs-Lp6e-Tvrj-HU9u-ZcCq-cY10Lv

====================================

Output from lvdisplay command for the logical
volume I want to reduce by 100 GB:

# lvdisplay /dev/storagevg/atdevel
--- Logical volume ---
LV Name                /dev/storagevg/atdevel
VG Name                storagevg
LV Write Access        read/write
LV Status              available
LV #                   1
# open                 1
LV Size                505 GB
Current LE             16160
Allocated LE           16160
Allocation             next free
Read ahead sectors     1024
Block device           58:4

=================================

Output from lvdisplay for logical 
volume I want to increase by 100 GB:

# lvdisplay /dev/storagevg/gcg
--- Logical volume ---
LV Name                /dev/storagevg/gcg
VG Name                storagevg
LV Write Access        read/write
LV Status              available
LV #                   4
# open                 1
LV Size                50 GB
Current LE             1600
Allocated LE           1600
Allocation             next free
Read ahead sectors     1024
Block device           58:1

===============================


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3038 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [linux-lvm] Moving space between logical volumes?
  2005-09-06 15:18 Meadows, Howard T
@ 2005-09-06 21:20 ` David Johnston
  0 siblings, 0 replies; 7+ messages in thread
From: David Johnston @ 2005-09-06 21:20 UTC (permalink / raw)
  To: LVM general discussion and development

On Tue, 2005-09-06 at 10:18 -0500, Meadows, Howard T wrote:
> On Tue, 2005-09-06 at 9:22 AM, David Johnston wrote:
> >e2fsadm is a front end for the LVM tools.  It simplifies things by doing
> >the math for you, and by doing the steps in the correct order (which
> >changes depending on whether you are growing or shrinking).
*snip*

> Thanks very much for the information. 
> To clarify my present configuration, I'm including data from fdisk,
> vgdisplay and lvdisplay for the two logical volumes I want to resize.

Output from "df" is also useful, particularly for lv's you plan to
shrink.

> From what I see, it sounds like I can use the commands you specified and
> all should be well (with no loss of data). If I could take advantage of
> your kindness just a little more, could you look at my information below
> and confirm that those commands are correct?
> Thanks VERY much

I'm glad to try to help.  

Step one: make sure you've got backups.  This is general advice, not
just for this.  What happens if the dog knocks the computer off the
table and out the window?  It's not likely, but things can and do go
wrong sometimes.  MAKE BACKUPS ;-)

> Data reported with fdisk p command:
>    Device Boot    Start       End    Blocks   Id  System
> /dev/sda5           515       770   2048224+  8e  Linux LVM
> /dev/sda6           771     32767 256007965+  8e  Linux LVM
This is less than optimal unless sda5 and sda6 belong to different
volume groups.  It's fine to play around, but on a production server you
should only have one LVM partition per disk.

> Output from vgdisplay command:
> # vgdisplay /dev/storagevg
> --- Volume group ---
> VG Name               storagevg
> Cur PV                2
This tells me that you've got two physical volumes in storagevg. 

> VG Size               585.88 GB
> Alloc PE / Size       18208 / 569 GB
> Free  PE / Size       540 / 16.88 GB
This tells me that your volume group has 585GB of total space, of which
569GB is allocated logical volumes and 16GB is unallocated.

> Output from lvdisplay for the lv I want to reduce by 100 GB:
> --- Logical volume ---
> LV Name                /dev/storagevg/atdevel

I'd be interested to see "df -h | grep atdevel" as well; that will tell
us how much of the 505GB allocated to this lv is actually used.  You
will get something like this:
/dev/mapper/storagevg-atdevel   505.0G  100.5G  404.5G  20% /atdevel

Make certain that you've got at least 110GB of free space in that
filesystem.  Once you're sure, shrink it:
	# umount /dev/storagevg/atdevel
	# e2fsadm -L -100G /dev/storagevg/atdevel

> Output from lvdisplay for lv I want to increase by 100 GB:
> --- Logical volume ---
> LV Name                /dev/storagevg/gcg

Now, expand gcg.
	# umount /dev/storagevg/gcg
	# e2fsadm -L +100G /dev/storagevg/gvg

In both cases, e2fsadm should stop and complain if you've asked it to do
something that might loose data, but again, make sure you've got good
backups of anthing important.  If you get an error, STOP AND ASK FOR
HELP.  It's a lot easier to fix one problem than it is to fix 6 or 7
compounded errors.

You've still got 16GB of free space.  That's not necessarily a bad
thing, you never know when or where you might need it.

Good luck!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-09-06 21:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 15:28 [linux-lvm] Moving space between logical volumes? Meadows, Howard T
2005-09-02  8:36 ` Chris Osicki
2005-09-06 14:21 ` David Johnston
  -- strict thread matches above, loose matches on Subject: below --
2005-09-06 15:18 Meadows, Howard T
2005-09-06 21:20 ` David Johnston
2005-08-31 19:56 Meadows, Howard T
2005-08-31 21:28 ` Chris Osicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).