0

I am running Ubuntu 14.04 and am using lvm for the root and swap partitions. When I use parted ( or gparted) I see 110GB unpartitioned on /dev/sda .

hari@Ubuntu02:~$ sudo parted /dev/sda unit GB print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 3408GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
        0.00GB  0.00GB  0.00GB            Free Space
 1      0.00GB  0.26GB  0.25GB  primary   ext2         boot
        0.26GB  0.26GB  0.00GB            Free Space
 2      0.26GB  805GB   805GB   extended
 5      0.26GB  805GB   805GB   logical                lvm
 3      805GB   1636GB  831GB   primary                lvm
 4      1636GB  3299GB  1662GB  primary                lvm
        3299GB  3408GB  110GB             Free Space

However when I use fdisk to create the partition , It does not show this free space.

hari@Ubuntu02:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 3408.5 GB, 3408486045696 bytes
255 heads, 63 sectors/track, 414391 cylinders, total 6657199308 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d989d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      499711      248832   83  Linux
/dev/sda2          501758  1572861951   786180097    5  Extended
/dev/sda3      1572861952  3196057599   811597824   8e  Linux LVM
/dev/sda4      3196057600  6442450943  1623196672   8e  Linux LVM
/dev/sda5          501760  1572861951   786180096   8e  Linux LVM

It seems that the free space starts at sector 6442450943 and goes till sector 6657199308.

I naively tried a lvextend but it give me the following message.

hari@Ubuntu02:~$ sudo lvextend -L+100G /dev/ubuntu-vg/root
  Extending logical volume root to 3.63 TiB
  Insufficient free space: 25600 extents needed, but only 2 available

Given that /dev/sda2 is my only logical volume and the free sectors are after /dev/sda5 how do I reclaim the 110GB unpartitioned space and add it to my lvm volume-group using parted , fdisk and lv- commands.

  • What's the actual problem here? Except fdisk just doesn't show ANY free spaces on ANY drives for ANYONE? – Tom Yan Jul 10 '16 at 16:03
  • " how do I reclaim the 110GB unpartitioned space and add it to my lvm volume-group using parted , fdisk and lv- commands." – harijay Jul 10 '16 at 20:25
  • I am surprised at the negative vote...the tile and comment above is my question – harijay Jul 10 '16 at 20:28
  • 1
    You need to extend /dev/sda4 using either fdisk or parted before you can use lvextend. – fpmurphy Jul 11 '16 at 1:46
0

I managed to reclaim that 100GB by a four step process

Mounted a new Disk (/dev/sdc) with same size as incompletely used
disk (/dev/sda4) and used pvcreate and lvextend to add it as a
logical volume to the LVM volume group 

I used pvmove to move the data from /dev/sda4 . This took ~16 hrs
but was seamless. It automagically moved it to new /dev/sdc volume
and then showed that /dev/sda4 was unused.   I pvremoved the
/dev/sda4 from the volume group 

I used fdisk to remove the existing partition and repartitioned the
space using gparted. 

I added this volume to the volume group( pvcrate and lvextend) and
then was able to use up all size with a sudo lvresize -r -l
+100%FREE /dev/ubuntu-vg/root 

This added back that 100GB which was not incorporated into the
partition and also the volume-group.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.