Translate this Page

 

To Extend Logical Volume :
Scenario :
Increase size of /backup to 90GB
 

$ df -H
 Filesystem              Size   Used  Avail Use% Mounted on
 /dev/mapper/vg00-lvol01 6.3G   187M   5.8G   4% /
 /dev/mapper/vg01-lvol02 8.3G   3.0G   5.0G  38% /archive
 /dev/mapper/vg01-lvol03  83G    11G    69G  13% /backup


        
1. Check the avalaible space on the volume group
  

$ lvm
  lvm> vgdisplay vg01
    --- Volume group ---
    VG Name               vg01
    System ID
    Format                lvm2
    Metadata Areas        1
    Metadata Sequence No  4
    VG Access             read/write
    VG Status             resizable
    MAX LV                0
    Cur LV                3
    Open LV               3
    Max PV                0
    Cur PV                1
    Act PV                1
    VG Size               273.38 GB
    PE Size               32.00 MB
    Total PE              8748
    Alloc PE / Size       7438 / 232.44 GB
    Free  PE / Size       1310 / 40.94 GB
    VG UUID               J4jYR2-p288-O55T-JOjP-WZ1c-tf1y-j1ko3r
   

 

2. Unmount the filesystem

  $ umount /dev/mapper/vg01-lvol03

 

3. Extend the Logical Volume

  $ lvextend -L +7G /dev/vg01/lvol03
    Extending logical volume lvol03 to 90.12 GB
    Logical volume lvol03 successfully resized

  

4. Resize the File system

 
  $ resize2fs -f -F -p /dev/vg01/lvol03 +90G

 

 

5. Mount File System

  $ mount /dev/mapper/vg01-lvol03 /backup

  

To Reduce Logical Volume :Scenario :
Decrease size of /backup to 87GB 

 $ df -H
 Filesystem              Size   Used  Avail Use% Mounted on
 /dev/mapper/vg00-lvol01 6.3G   187M   5.8G   4% /
 /dev/mapper/vg01-lvol02 8.3G   3.0G   5.0G  38% /archive
 /dev/mapper/vg01-lvol03  96G    11G    82G  12% /backup
 

1. Unmount the File System

  $ umount /dev/mapper/vg01-lvol03

2. Resize the File System

  $ resize2fs -f -F -p /dev/vg01/lvol03 +87G
   resize2fs 1.35 (28-Feb-2004)
   Resizing the filesystem on /dev/vg01/lvol03 to 22806528 (4k) blocks.
   Begin pass 3 (max = 720)
   Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   The filesystem on /dev/vg01/lvol03 is now 22806528 blocks long.

3. Reduce the Logical Volume

  $ lvreduce -L -3G /dev/vg01/lvol03
    WARNING: Reducing active logical volume to 87.12 GB
    THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce lvol03? [y/n]: y
    Reducing logical volume lvol03 to 87.12 GB
    Logical volume lvol03 successfully resized

4. Checking the File System

  $ e2fsck /dev/mapper/vg01-lvol03
  e2fsck 1.35 (28-Feb-2004)
  /dev/mapper/vg01-lvol03: clean, 15/11403264 files, 2825574/22806528 blocks

5. Mount File System

  $ mount /dev/mapper/vg01-lvol03 /backup

  One Response to “HOW TO Extend Or Reduce Logical Volume in Linux”

  1. Hi,

    Very interesting. Nice article and discussion.
    Thanks a lot for same.

    Regards,
    Gitesh Trivedi
    http://www.dbametrix.com

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 LevICORP's webnote Suffusion theme by Sayontan Sinha