One of the logical volumes on my desktop is running out of space. I want to add 200GB to that volume. Here is one way to achieve this task.
First a bit of warning. Don’t, or never, just copy and paste what you see here if you want to apply it to your own system. You may accidentally destroy your precious data.
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
backup data -wi-ao---- 200.00g
scratch data -wi-ao---- 1.00t
home system -wi-ao---- 90.00g
root system -wi-ao---- 100.00g
swap system -wi-ao---- 16.00g
tmp system -wi-a----- 4.00g
var system -wi-ao---- 20.00g
Let’s check the available disk space of volume groups we can use:
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 2 0 wz--n- 1.82t 639.01g
system 1 5 0 wz--n- 232.38g 2.38g
I want to resize ‘scratch’, which sits on ‘data’ volume group. There are about 639GB free on ‘data’.
Let’s give ‘data’ another 200GB.
# lvresize -rL +200G /dev/data/scratch
Size of logical volume data/scratch changed from 1.00 TiB (262144 extents) to 1.20 TiB (313344 extents).
Logical volume scratch successfully resized.
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mapper/data-scratch is mounted on /srv/scratch; on-line resizing required
old_desc_blocks = 64, new_desc_blocks = 77
The filesystem on /dev/mapper/data-scratch is now 320864256 (4k) blocks long.
Finally, we can verify the change:
# lvs data
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
backup data -wi-ao---- 200.00g
scratch data -wi-ao---- 1.20t
Now ‘scratch’ has a total of 1.20TB.