Assign space left in sda2 to cl-root

General support questions
Post Reply
cardogar
Posts: 9
Joined: 2017/09/25 10:32:00

Assign space left in sda2 to cl-root

Post by cardogar » 2021/09/24 16:14:51

Hi all,

I'm getting in lot of trouble to assign the non-used space of my sda2 partition to the cl-root

Code: Select all

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  130G  0 disk 
├─sda1        8:1    0    1G  0 part /boot
└─sda2        8:2    0  129G  0 part 
  ├─cl-root 253:0    0 95.7G  0 lvm  /
  └─cl-swap 253:1    0    1G  0 lvm  [SWAP]
I would like to assign the 30G available to cl-root, but I don't know how.

This is current situation of the disk:

Code: Select all

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   272629759   135265280   8e  Linux LVM
 

Code: Select all

Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root  103G   96G  6.8G  94% /
devtmpfs             4.6G     0  4.6G   0% /dev
tmpfs                4.7G     0  4.7G   0% /dev/shm
tmpfs                4.7G  9.9M  4.6G   1% /run
tmpfs                4.7G     0  4.7G   0% /sys/fs/cgroup
/dev/sda1            1.1G  402M  663M  38% /boot
tmpfs                4.7G   25k  4.7G   1% /tmp
tmpfs                921M  4.1k  921M   1% /run/user/42
tmpfs                921M   33k  921M   1% /run/user/1000
 
The idea is to extend cl-root instead of adding a new unit (sda3).

Any help would be greatly appreciated as I have little knowledge on all this... thanks!

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Assign space left in sda2 to cl-root

Post by jlehtone » 2021/09/24 19:07:11

Your partition sda2 appears to be LVM physical volume (PV). You can see PVs with: pvs and pvdisplay
The PV is member of LVM volume group (VG) "cl". You can see VGs with: vgs and vgdisplay
The "cl-root" is a LVM logical volume (LV). You can see LVs with: lvs and lvdisplay

If everything is as it seems, then there is free space (unallocated "VG extents") in "cl". The output of above commands should show that.

Read man lvextend.

A command to expand LV and filesystem within it could look like:

Code: Select all

lvextend -L +30G -r cl/root

Whoever
Posts: 1357
Joined: 2013/09/06 03:12:10

Re: Assign space left in sda2 to cl-root

Post by Whoever » 2021/09/25 00:46:35

jlehtone wrote:
2021/09/24 19:07:11


A command to expand LV and filesystem within it could look like:

Code: Select all

lvextend -L +30G -r cl/root
Instead of "-L +30G", you can use "-l +100%FREE" to use all the free space.

cardogar
Posts: 9
Joined: 2017/09/25 10:32:00

Re: Assign space left in sda2 to cl-root

Post by cardogar » 2021/09/27 08:59:53

It worked like a charm!!! Thanks a lot for your help, very much appreciated!

Post Reply