Find the answer to your Linux question:
Results 1 to 5 of 5
Can someone help me understand by giving me the commands I need in order to shrink my "debian-home" logical volume by 10GBs and increase the size of my "debian-root" logical ...
  1. #1
    s3a
    s3a is offline
    Just Joined!
    Join Date
    Dec 2008
    Posts
    23

    How do I resize partitions with LVM2?

    Can someone help me understand by giving me the commands I need in order to shrink my "debian-home" logical volume by 10GBs and increase the size of my "debian-root" logical volume by that same 10GB of data? (Everything in that computer is ext4 including the /boot ... physical volume? (I think that's what it's called))

    I would REALLY appreciate it if someone could just give me the exact or approximate terminal commands that I would need to use. I assure you, I will never forget them

    Thanks in advance!

    P.S.
    This (http : // tldp. org/ HOWTO /LVM -HOWTO /intro. html ) is the best read I've found and I don't think I know enough yet to understand it so again, I'd appreciate it if someone could first give me the commands I need so that further reading could follow whenever I'm done with my current semester of schooling. Not to mention, I'm too busy with my school workload to be able to figure out things like this at this moment which is yet another reason for my post here.

  2. #2
    s3a
    s3a is offline
    Just Joined!
    Join Date
    Dec 2008
    Posts
    23
    Anybody know?

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Location
    North
    Posts
    2
    Use resize2fs to shrink the /home filesystem followed by lvresize to shrink the logical volume. I usually shrink the fs a little smaller than I want and then resize it again to fit the LV. Then use lvresize to expand the root logical volume, followed by resize2fs to expand the filesystem to fit the logical volume.

  4. #4
    s3a
    s3a is offline
    Just Joined!
    Join Date
    Dec 2008
    Posts
    23
    Thanks for your response but could you supply (an) example(s) please?

  5. #5
    Just Joined!
    Join Date
    Mar 2010
    Location
    Mountain View, CA
    Posts
    24
    some example for resize the lvm partiton is give below. pls have a look

    # lvdisplay
    --- Logical volume ---
    LV Name /dev/skx-vol/test
    VG Name skx-vol
    LV UUID J5XlaT-e0Zj-4mHz-wtET-P6MQ-wsDV-Lk2o5A
    LV Write Access read/write
    LV Status available
    # open 0
    LV Size 1.00 GB
    Current LE 256
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 254:0

    We see it is 1Gb in size (no suprise really!) before we go on to resize the volume remember we should unmount it first:

    root@lappy:~# umount /home/test/
    root@lappy:~# lvextend -L+1g /dev/skx-vol/test
    Extending logical volume test to 2.00 GB
    Logical volume test successfully resized

    (It is possible to resize ext3 filesystems whilst they're mounted, but I'd still suggest doing it offline as that is less scary.)

    Looking at lvdisplay again we can see the volume was resized:

    # lvdisplay
    --- Logical volume ---
    LV Name /dev/skx-vol/test
    VG Name skx-vg
    LV UUID uh7umg-7DqT-G2Ve-nNSX-03rs-KzFA-4fEwPX
    LV Write Access read/write
    LV Status available
    # open 0
    LV Size 2.00 GB
    Current LE 512
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 254:0

    The important thing to realise is that although the volume has been resized the ext3 filesystem on it has stayed unchanged. We need to resize the filesystem to actually fill the volume:

    # e2fsck -f /dev/skx-vol/test
    # resize2fs /dev/skx-vol/test

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •