Extending a Linux Partition On a Running Server

If a partition like the root (/) partition is out of space and you cannot free any more space then it is possible to expand the partition using LVM. To do this follow the steps below adapting for your specific setup.

1. Log in to virt-manager (or vSphere) and add a new hard drive to the running server. I've added a 5GB drive

 

root@dev-db1 plorimer]# fdisk -l 
Disk /dev/vda: 26.8 GB, 26843545600 bytes 16 heads, 63 sectors/track, 52012 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000ab560

Device Boot Start End Blocks Id System /dev/vda1 * 3 1018 512000 83 Linux Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 52013 25701376 8e Linux LVM Partition 2 does not end on cylinder boundary.


Disk /dev/vdb: 80.5 GB, 80530636800 bytes 16 heads, 63 sectors/track, 156038 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x196b7ae1

Device Boot Start End Blocks Id System /dev/vdb1 1 156038 78643120+ 83 Linux
Disk /dev/vdc: 477.8 GB, 477815111680 bytes 16 heads, 63 sectors/track, 925826 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000


Disk /dev/mapper/vg_devdb1-lv_root: 23.6 GB, 23630708736 bytes 255 heads, 63 sectors/track, 2872 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000


Disk /dev/mapper/vg_devdb1-lv_swap: 2684 MB, 2684354560 bytes 255 heads, 63 sectors/track, 326 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000


Disk /dev/vdd: 5368 MB, 5368709120 bytes 16 heads, 63 sectors/track, 10402 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000

2. fdisk -l will show you the list of partitions, find your new partition on the output, in this example it is /dev/vdd



From bland to brand, get your business online
Website hosting and design by Dedicated to Servers, contact info@dedicatedtoservers.com

Click to send a quick inquiry

All rights Reserved © 2014-2024