Linux partition not showing full size

0

Issue

I have a Linux system where the disk space shows as only 29Gb, but when I look at the partition with the parted – print command it shows as a 64Gb partition. I’m not sure if the remaining disk space is unallocated, mounted in other folders, stuck in "tmpfs" or how to add it to the primary partition. This is in Ubuntu 18.04 OS. I would like for the full 64 GB to be available at root. I appreciate any help!

When I run df -h, here are the results:

Filesystem                         Size  Used Avail Use% Mounted on
udev                                16G     0   16G   0% /dev
tmpfs                              3.2G  1.2M  3.2G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   29G   25G  2.7G  91% /
tmpfs                               16G     0   16G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                               16G     0   16G   0% /sys/fs/cgroup
/dev/sda2                          976M   81M  829M   9% /boot
/dev/sda1                          511M  4.4M  507M   1% /boot/efi
tmpfs                              3.2G     0  3.2G   0% /run/user/1000

Results of parted print command shows a 64GB partition:

Model: ATA MSH-64 (scsi)
Disk /dev/sda: 63.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  538MB   537MB   fat32              boot, esp
 2      538MB   1612MB  1074MB  ext4
 3      1612MB  63.3GB  61.7GB

Results of vgs command:

  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n- <57.50g <28.75g

Results of the lvs command:

(talos-env) pradmin@pradmin:~$ sudo lvs
  LV        VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- 28.75g

Solution

The guidance from Andreas proved helpful. I managed to resize the logical volume to the full size of the partition using the following commands and sequence.

Resources that I found helpful:

https://www.redhat.com/sysadmin/resize-lvm-simple

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/ext4grow

root:~# lvs
  LV        VG        Attr       LSize   Pool Origin 
Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <57.50g

 
Here you can see that the logical volume doesn’t fill the full partition size

root:~# vgs
  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n- <57.50g <28.75g

Extend the logical volume to 100% of the free space, /dev/{VG FROM lvs CMD}/{LV FROM lvs CMD}

root:~# lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from 28.75 GiB (7360 extents) to <57.50 GiB (14719 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Checked disk space and saw that it hadn’t changed yet

root:~# df
Filesystem                        1K-blocks     Used 
Available Use% Mounted on
udev                               16390292        0  16390292   0% /dev
tmpfs                               3284628     1164   3283464   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  29542388 25311328   2707348  91% /
tmpfs                              16423128        0  16423128   0% /dev/shm
tmpfs                                  5120        0      5120   0% /run/lock
tmpfs                              16423128        0  16423128   0% /sys/fs/cgroup
/dev/sda2                            999320    82552    847956   9% /boot
/dev/sda1                            523248     4492    518756   1% /boot/efi
tmpfs                               3284624        0   3284624   0% /run/user/1000

Resize file system to full size of logical volume, use Filesystem name from df command above. Note this is an ext4 filesystem, you may have to use a different command for a different filesystem.

root:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line 
resizing required
old_desc_blocks = 4, new_desc_blocks = 8
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 15072256 (4k) blocks 
long.

root:~# df
Filesystem                        1K-blocks     Used Available Use% Mounted on
udev                               16390292        0  16390292   0% /dev
tmpfs                               3284628     1164   3283464   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  59211724 25319316  31128948  45% /
tmpfs                              16423128        0  16423128   0% /dev/shm
tmpfs                                  5120        0      5120   0% /run/lock
tmpfs                              16423128        0  16423128   0% 
/sys/fs/cgroup
/dev/sda2                            999320    82552    847956   9% /boot
/dev/sda1                            523248     4492    518756   1% /boot/efi
tmpfs                               3284624        0   3284624   0% 
/run/user/1000

Answered By – Konan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More