Partition is not using the full space

0

The sda5 partition has 1953 GB, but dev/mapper/MediaServer--vg-root is only actually using 496 GB. How do I extend dev/mapper/MediaServer--vg-root to take advantage of the full space?

sudo fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000a9ebd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758  3907028991  1953263617    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5          501760  3907028991  1953263616   8e  Linux LVM

Disk /dev/mapper/MediaServer--vg-root: 495.9 GB, 495909339136 bytes
255 heads, 63 sectors/track, 60290 cylinders, total 968572928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/MediaServer--vg-root doesn't contain a valid partition table

Disk /dev/mapper/MediaServer--vg-swap_1: 3883 MB, 3883925504 bytes
255 heads, 63 sectors/track, 472 cylinders, total 7585792 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/MediaServer--vg-swap_1 doesn't contain a valid partition table
linux
ubuntu
command-line-interface
partition
asked on Server Fault Mar 25, 2016 by Randy • edited Apr 3, 2016 by kasperd

1 Answer

1

You can run lvextend to increase the size of the logical volume:

sudo lvextend /dev/mapper/MediaServer--vg-root

You'll need to extend the filesytem as well to take advantage of the new space. For an ext2/3/4 filesystem, run:

sudo resize2fs /dev/mapper/MediaServer--vg-root

If you're running a modern version of Linux, you should be able to do this all on-line. Standard warnings apply about mucking with storage and the potential for data loss. Take a backup of important files and proceed with caution.

If this doesn't work, it would be nice to see your lvm structure. This should give some useful debugging info:

sudo pvdisplay 
sudo vgdisplay
sudo lvdisplay
answered on Server Fault Mar 25, 2016 by David Kent

User contributions licensed under CC BY-SA 3.0