# How can I extend a partition capacity?

**URL:** <https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8\
**Created:** [October 4, 2023, 12:34pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475 "2023-10-04T12:34:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloud](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@cloud](https://forums.rockylinux.org/u/cloud)\
**Post date:** [October 4, 2023, 12:34pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/1 "2023-10-04T12:34:20Z")

</div>

![Screenshot from 2023-10-04 21-26-00](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/b/bf2958e08bad07a27922a434e1fddb51a4ccd047.png)

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.

---

<div class="post-metadata">

**Author:** ![cloud](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@cloud](https://forums.rockylinux.org/u/cloud)\
**Post date:** [October 4, 2023, 12:34pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/2 "2023-10-04T12:34:52Z")

</div>

![Screenshot from 2023-10-04 21-26-57](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/9/9d68a4e3790fb95aa12246b5340b6187a5812471.png)

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [October 4, 2023, 12:46pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/3 "2023-10-04T12:46:46Z")

</div>

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

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

```

An example from latter:

```plaintext
$ lsblk -o name,type,fstype,size,fsavail,mountpoints
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.

---

<div class="post-metadata">

**Author:** ![cloud](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@cloud](https://forums.rockylinux.org/u/cloud)\
**Post date:** [October 5, 2023, 1:22am UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/4 "2023-10-05T01:22:27Z")

</div>

Thank you for your help!

```auto
[serc@localhost ~/Desktop]$ lsblk -o name,type,fstype,size,mountpoint
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

```

---

<div class="post-metadata">

**Author:** ![cloud](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@cloud](https://forums.rockylinux.org/u/cloud)\
**Post date:** [October 5, 2023, 1:27am UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/5 "2023-10-05T01:27:33Z")

</div>

I changed code with chatgpt because of an error.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/7/7fb28794fd9ba7746d92fa8a3a13c5f5aa962db9.png)

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [October 5, 2023, 2:32pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/6 "2023-10-05T14:32:18Z")

</div>

> ```plaintext
> $ 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.)

* * *

> [@cloud](#):
>
> ```auto
> [serc@localhost ~/Desktop]$ lsblk -o name,type,fstype,size,mountpoint
> 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
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [December 4, 2023, 2:33pm UTC](https://forums.rockylinux.org/t/how-can-i-extend-a-partition-capacity/11475/7 "2023-12-04T14:33:00Z")

</div>

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