> For the complete documentation index, see [llms.txt](https://ghoulsec.gitbook.io/ghoulsec-vault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ghoulsec.gitbook.io/ghoulsec-vault/server-are-fun/managing-partitions/lvm/re-claiming-unused-disk-space.md).

# Re-claiming unused disk space

{% code overflow="wrap" %}

```bash
vishvam@ubuntu:~$ lsblk
sda                         8:0    0   30G  0 disk 
├─sda1                      8:1    0    1M  0 part 
├─sda2                      8:2    0  1.8G  0 part /boot
└─sda3                      8:3    0 23.2G  0 part 
  └─ubuntu--vg-ubuntu--lv 253:0    0 23.2G  0 lvm  /
```

{% endcode %}

Here we can see that the disk size is `30G` but we only have usable space of `23.2G` inside the data partition where the remaining `5G` of space is still allocated on the disk and we will now allocate the space in the data partition using the following steps :&#x20;

***

## Step -1 : Resizing partition&#x20;

we can extend the partition `sda3` using the parted utility with the following commands :&#x20;

```bash
sudo parted /dev/sda
```

Here we can type `help` to get the manual and we can use the resize command to resize the partition

```
resizepart NUMBER END
```

In our case the partition numner is `3` so the command will look like :&#x20;

```bash
resizepart 3 100%
```

This will resize the partition to its 100% capacity & the updated output should look like :&#x20;

```bash
vishvam@ubuntu:~$ lsblk
sda                         8:0    0   30G  0 disk 
└─sda3                      8:3    0 28.2G  0 part 
  └─ubuntu--vg-ubuntu--lv 253:0    0 23.2G  0 lvm  /
```

The new size of `sda3` is updated to `28.2G` and the unallocated space is now allocated to sda3, Now we will have to update the lvm to claim the space.

```bash
sudo partprobe /dev/sda
```

***

## Step -2 Extending LVM

First we will see the lvm name using the following command :

```bash
sudo lvdisplay
```

This will display the output like :&#x20;

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2FjfBxXh6v49mqxBkHpnXR%2Fimage.png?alt=media&amp;token=d2078be6-d220-47a8-bce3-c43bd5aee92e" alt=""><figcaption></figcaption></figure>

We will note down the `LV_NAME`  and pass the command like :&#x20;

```bash
sudo lvextend -l +100%FREE <LV_NAME>
#sudo lvextend -L +100%FREE /dev/ubuntu-vg/ubuntu-lv
```

Now we have successfully reclaimed to extended space on the ubuntu system.

***
