[linux-lvm] Moving space between logical volumes?

Meadows, Howard T howard-meadows at uiowa.edu
Tue Sep 6 15:18:10 UTC 2005


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

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3038 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20050906/d6bee8f4/attachment.bin>


More information about the linux-lvm mailing list