Growing logical volume

Print Friendly, PDF & Email

We keep most disk space on our server un-allocated and grow partitions as needed.  Here’s how:

To see how much space is used:

root@tempest ~] df -H
Filesystem                         Size Used Avail Use% Mountpoint
/dev/mapper/vg_tempest-lv_root      42G 825M   39G   3% /         
none                                34G 697k   34G   1% /dev/shm  
/dev/sda1                          508M  87M  396M  18% /boot     
/dev/mapper/vg_tempest-lv_home     627G 576G   20G  97% /home     
/dev/mapper/vg_tempest-lv_students  52G  46G  3.0G  94% /students 
/dev/mapper/vg_tempest-lv_usr       17G  15G  925M  95% /usr      
/dev/mapper/vg_tempest-lv_var       49G  24G   22G  53% /var      
/dev/mapper/vg_tempest-lv_tmp       11G 159M  9.7G   2% /tmp      
bigdata:/volume1/data              3.0T 2.6T  368G  88% /data

To expand the /usr partition by 1GB, do:

[root@tempest ~] lvextend --size +1G --resizefs /dev/mapper/vg_tempest-lv_usr 
  Extending logical volume lv_usr to 16.62 GiB
  Logical volume lv_usr successfully resized
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_tempest-lv_usr is mounted on /usr; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/vg_tempest-lv_usr to 4358144 (4k) blocks.
The filesystem on /dev/mapper/vg_tempest-lv_usr is now 4358144 blocks long.

We’d like to keep the /home partion not more than about 90% full, so this brings it back up to snuff:

[root@tempest ~] lvextend --size +37G --resizefs /dev/mapper/vg_tempest-lv_home 
  Extending logical volume lv_home to 629.97 GiB
  Logical volume lv_home successfully resized
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_tempest-lv_home is mounted on /home; on-line resizing required
old desc_blocks = 38, new_desc_blocks = 40
Performing an on-line resize of /dev/mapper/vg_tempest-lv_home to 165142528 (4k) blocks.
The filesystem on /dev/mapper/vg_tempest-lv_home is now 165142528 blocks long.
[root@tempest ~] df -H
Filesystem                         Size Used Avail Use% Mountpoint
/dev/mapper/vg_tempest-lv_root      42G 825M   39G   3% /         
none                                34G 697k   34G   1% /dev/shm  
/dev/sda1                          508M  87M  396M  18% /boot     
/dev/mapper/vg_tempest-lv_home     666G 576G   57G  92% /home     
/dev/mapper/vg_tempest-lv_students  52G  46G  3.0G  94% /students 
/dev/mapper/vg_tempest-lv_usr       18G  15G  2.0G  89% /usr      
/dev/mapper/vg_tempest-lv_var       49G  24G   22G  53% /var      
/dev/mapper/vg_tempest-lv_tmp       11G 159M  9.7G   2% /tmp      
bigdata:/volume1/data              3.0T 2.6T  368G  88% /data     
[root@tempest ~] 


 

About CS SysAdmins

The CS Department System Administrators
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *