How to extend encrypted LVM to the adjacent free space?

Don’t tell me fdisk, I’m scare of that!:wink: Cryptsetup resize? But how to do?

You are welcome here, but you should be aware of the fact that we are no magicians.

You provided us with no information about your disk setup at all. How can we help?

Thus first we want to see what disks with what partitioning:

su -l -c 'fdisk -l'

you being scared or not is of no importance at all.

And it seems that you are using LVM. Thus we want to know how:

su -l -c 'pvdisplay

to begin with.

Also your title and thus question is confusing. You want to extend LVM. But LVM means “Logical Volume Manager” and is the software used. You probably do not want to extend that, but either the space used by it at the moment and/or some of the Logical Volumes it manages at the moment. So please explain the background of your question. What do you have and what do you want to change?

lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk ├─sda1 8:1 0 99M 0 part /boot └─sda2 8:2 0 111.7G 0 part └─vgroup 254:0 0 111.7G 0 crypt ├─vgroup-lvroot 254:1 0 30G 0 lvm / └─vgroup-lvhome 254:2 0 81.7G 0 lvm /home There is one unused space 115 MB adjacented to sda2, I want it added to sda2 and vgroup.

The easiest way to post computer output here in a post is by putting it between CODE tags. You get the CODE tags by clicking on the # button in the tool bar of the post editor.
No need to create and post images ;).

You choose to post something different then I asked for but it also shows useful information as well as about your disks and your partitioning and your LVM usage.

I do not see any unused space or am I missing something? Also I asked “what do you want to change?”, but you gave no further explanation what you want to enlarge and where you think you have the extra space for it.

Do you have any problem that something is getting “full”?

Please try to understand that the people here are willing to help, but that you need to provide the information, background and technical. Else understanding will be difficult.

Before creating and then giving a partition type, the free space can not be displayed by fdisk or lsblk. The free space is adjacent to the Encrypted LVM where the free space would be added to and also be encrypted after the addition. Also I will try that in VirtualBox to see how the fdisk works like

fdisk will show you all free space indirectly by showing the size of the disk and then all start and end addresses of the partitions. Free space is then all between every end address and the next start address when there is free space between the partitions, or between the last end address and the end address of the disk when free space is after the last partition. Not that difficult.

But as your lsblk gives sizes, the disk is 116.8G and sda1 and sda2 are ~115.5G. Left something like 1G at the most. Less then 1% of the LVG size. Not something that is worth a lot of troubles to add IMHO.

I am not quite clear how to interprete what you say.

You seem to doubt that lsblk shows the real size of the disk, but only the total of the partitions. That is not true. On my system:

boven:~ # lsblk
sda      8:0    0 298.1G  0 disk 
├─sda1   8:1    0     2G  0 part [SWAP]
├─sda2   8:2    0    20G  0 part /
├─sda3   8:3    0  92.9G  0 part /home
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0    20G  0 part 
└─sda6   8:6    0   100G  0 part 
sr0     11:0    1  1024M  0 rom  
boven:~ #

sda1 - sda6 together is 2 + 20 + 92.9 + 20 + 100 = 234.9G. Disk is given above as 298.1. Thus there is free space of about 63G.

Also I do not quite understand why you are going to try something with fdisk on a VM. Until now I only suggested you do a listing with fdisk. Making a listing will not change anything with the partitioning.

And fdisk is only for partitioning. It knows nothing about LVM, nor about encryption.

My free space = sda - (sda1 + sda2) = 400M, that is math.

Yes, it is.

Well, at post #7 above I put it roughly at 1 G. Thus even less. I can only repeat:

Less then 1% of the LVG size. Not something that is worth a lot of troubles to add IMHO.

And 400 M it is not even 1%, but more like 0.3%. What is the gain? Even if you want it in the end to be added to your /home, that will only increase to ~82.1 G.