root partition doesn't have all space available

root partition doesn't have all space available

It's been 10+ years since I've done any server admin work and now I have installed on an old laptop an Ubuntu 20.04 server and I have some problems in making all space available in the / partition ... or maybe I am getting it wrong ?

df -h shows only 110GB allocated

root@dell-csi:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              792M  1.5M  791M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  110G  6.4G   98G   7% /         <<--------------------
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                          976M  104M  806M  12% /boot
/dev/loop0                          55M   55M     0 100% /snap/core18/1880
/dev/loop1                          72M   72M     0 100% /snap/lxd/16099
/dev/loop2                          30M   30M     0 100% /snap/snapd/8542
tmpfs                              792M     0  792M   0% /run/user/1000

but the partition has about double in size:

root@dell-csi:~# fdisk -l
Disk /dev/loop0: 54.98 MiB, 57626624 bytes, 112552 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 /dev/loop1: 71.28 MiB, 74735616 bytes, 145968 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 /dev/loop2: 29.9 MiB, 31334400 bytes, 61200 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 /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors
Disk model: OCZ-ARC100
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BD916C44-BD95-4405-8E21-8E00B2071A77

Device       Start       End   Sectors   Size Type
/dev/sda1     2048      4095      2048     1M BIOS boot
/dev/sda2     4096   2101247   2097152     1G Linux filesystem
/dev/sda3  2101248 468858879 466757632 222.6G Linux filesystem         <<-------------------

Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 111.29 GiB, 119491526656 bytes, 233381888 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

pvscan shows the following:

root@dell-csi:~# pvscan
File descriptor 4 (pipe:[30683]) leaked on pvscan invocation. Parent PID 1196: bash
File descriptor 5 (pipe:[30683]) leaked on pvscan invocation. Parent PID 1196: bash
File descriptor 9 (pipe:[30686]) leaked on pvscan invocation. Parent PID 1196: bash
  PV /dev/sda3   VG ubuntu-vg       lvm2 [<222.57 GiB / 111.28 GiB free]
  Total: 1 [<222.57 GiB] / in use: 1 [<222.57 GiB] / in no VG: 0 [0   ]

Any idea in making all the space available to / is highly appreciated. Thanks!

答案1

The solution was:

  1. use lvextend to extend the logical volume
root@dell-csi:~# lvextend -L +111G /dev/mapper/ubuntu--vg-ubuntu--lv
File descriptor 4 (pipe:[30683]) leaked on lvextend invocation. Parent PID 1196: bash
File descriptor 5 (pipe:[30683]) leaked on lvextend invocation. Parent PID 1196: bash
File descriptor 9 (pipe:[30686]) leaked on lvextend invocation. Parent PID 1196: bash
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <111.29 GiB (28489 extents) to <222.29 GiB (56905 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
  1. then use resize2fs
root@dell-csi:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 14, new_desc_blocks = 28
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 58270720 (4k) blocks long.

Now all space is available in root.

root@dell-csi:~# df -h /home/
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv  219G  6.6G  202G   4% /

相关内容