How can I extend a partition capacity?

I probably specified the partition incorrectly during the installation step.

I have 4TB HDD and one ssd.

Is there a command that can resize a partition?

Thank you for reading my question.

First, bitmap screenshots are inconvenient; one can copy-paste text from terminal (and preferably use the code tags – The </> button above).

You seem to have legacy boot mode installation (UEFI mode is current hype) and the default LVM2-based volumes.

You can see/show more with commands, like lsblk, pvs, vgs, lvs, and

lsblk -o name,type,fstype,size,fsavail,mountpoints

An example from latter:

$ lsblk -o name,type,fstype,size,fsavail,mountpoints
sda                    disk             465.8G         
├─sda1                 part ext4            1G         
├─sda2                 part LVM2_member   138G         
│ ├─centos_x-swap      lvm  swap            4G         
│ ├─centos_x-opt       lvm  ext4           10G         
│ ├─centos_x-home      lvm  ext4          100G   93.2G /local
│ └─centos_x-root      lvm  ext4           24G         
├─sda3                 part ext4            1G  596.6M /boot
├─sda4                 part                 1K         
└─sda5                 part LVM2_member    34G         
  ├─almalinux_x-root   lvm  ext4           24G   13.7G /
  └─almalinux_x-opt    lvm  ext4           10G      8G /opt

Yes, there are commands, but the appropriate ones depend on the details; what you have.


Thank you for your help!

[serc@localhost ~/Desktop]$ lsblk -o name,type,fstype,size,mountpoint
sda         disk               3.7T 
nvme0n1     disk             931.5G 
├─nvme0n1p1 part xfs             1G /boot
└─nvme0n1p2 part LVM2_member 930.5G 
  ├─rl-root lvm  xfs            70G /
  ├─rl-swap lvm  swap         31.4G [SWAP]
  └─rl-home lvm  xfs         829.1G /home

I changed code with chatgpt because of an error.

$ lsblk -o name,type,fstype,size,fsavail,mountpoints
lsblk: unknown column: fsavail,mountpoints

My bad. The el8 version of lsblk does not have columns fsavail and mountpoints (but does have mountpoint).
I was running on el9, where the command has all three. (mountpoint and mountpoints mean the same.)

Now we see that your system has two drives: slower HDD (sda) and SDD (nvme0n1).
The HDD has nothing and is not used at all.
The SDD has two partitions. They use the entire drive.
The small partition has XFS filesystem. Its contents is seen in directory /boot
The large partition has LVM physical volume.
The physical volume is part of LVM volume group named “rl”.
The volume group “rl” has three LVM logical volumes: “root”, “swap”, and “home”.
The volume groups use all of the physical volume.

The “root” and “home” have XFS filesystem.
The content of logical volume “home” is seen in directory /home
The content of logical volume “root” is in directory / – but /boot and /home are not on it.
The logical volume “swap” is in practice a “swapfile”, even though it is not a file within any filesystem.

Most oy your files should be under /home which is almost a terabyte. The / has mainly OS files.

Since only the HDD has unallocated space, it is the only place to “expand to”. There are more than one way to do it.

Note that the XFS filesystem cannot shrink. It can be expanded, but if one has to make it smaller, then one has to make a backup, remove XFS, create new smaller filesystem, and restore data.

Anyway, one should create one (or more partitions) into the HDD. I usually use gdisk for that.

Within the partitions one can initialize a filesystem (with e.g. mkfs.xfs) or a LVM physical volume (PV, with pvcreate). If one makes a PV, then one can create a new volume group VG, or add the PV to the existing VG “rl”. In a separate VG one would create a new logical volume (LV), and into the LV a filesystem.

If HDD is added to the “rl”, then one can expand existing LV into the HDD. Downside is that then part of that LV is in SDD and another in HDD. If either drive breaks, then entire LV is lost. Furthermore, all parts of LV will not be equally fast. There is an option to move LV from one PV to other PV and then expand the LV within that PV. That keeps the LV “in one place”.

Resize of LV (or partition) does not automatically resize filesystem in the volume. The lvextend command has option --resizefs. See man lvextend

If one creates a new filesystem (in plain partition or in new LV), then one has to mount it so that it shows as a directory (just like the /boot and /home) do. File /etc/fstab lists what is mounted automatically during boot.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.