Extend LVM space to the rest of the free space on the disk

Recently, we formatted a server with Ubuntu 22.04 LTS. While selecting the disk settings, we selected the encrypted LVM partition scheme, and even though we selected the whole disk, we did not notice that the LVM would only allocate, by default, 100GB out of the 600GB available on the raid volume.

So, we proceeded with the installation, and at some point, we noticed that we ran out of space which should not have happened.

Using the command df -h we quickly spotted the problem:

$ df -h
Filesystem                 Size  Used Avail Use% Mounted on
tmpfs                      3,2G  3,9M  3,2G   1% /run
/dev/mapper/vgubuntu-root  100G   83G   17G  83% /
tmpfs                       16G   40M   16G   1% /dev/shm
tmpfs                      5,0M  4,0K  5,0M   1% /run/lock
/dev/sda5                  703M  257M  395M  40% /boot
/dev/sda1                  511M   24K  511M   1% /boot/efi
tmpfs                       16G     0   16G   0% /run/qemu
tmpfs                      3,2G  156K  3,2G   1% /run/user/1000

/dev/mapper/vgubuntu-root was only 100GB instead of the 600GB that we would expect it to be.

Using the command vgdisplay we verified that the space allocated to the logical volume group was not what we wanted.

To fix the problem, we issued the following commands:

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv;
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv;

lvextend instructed our logical volume to consume all the available space on the hosting disk.

Then resize2fs allocated all the available space to our partition.

The disk is offline because it has a signature collision with another disk that is online 1

Recently, we cloned a hard disk using dd.
When we booted into Windows, the new drive was not visible.
After checking with the disk utilities, we got the following informative message:

The disk is offline because it has a signature collision with another disk that is online

To resolve the issue, we used diskpart.
To start diskpart, press the key combination Win + R which will pop up the Run prompt.
Type diskpart in the input box and hit the Enter key.

A new terminal window will appear.
Using that we identified the two disks and changed the label for the second one.

First step:

We issued list disk to get the list of disks.


Microsoft DiskPart version 10.0.14393.0
Copyright (C) 1999-2013 Microsoft Corporation.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          931 GB      0 B
  Disk 1    Offline         465 GB      0 B

Second step:

We issued select disk 1 so that we could process the disk 1 that was offline and using uniqueid disk we got the signature of the disk.

DISKPART> select disk 1
Disk 1 is now the selected disk.

DISKPART> uniqueid disk
Disk ID: 09FC13CB

Third step:

Set the signature of the disk to a random value other than the one that it already had using the command uniqueid disk ID=FFAABBCCDD


DISKPART> uniqueid disk

The random value must be 8 characters long and each character must be a value between 0-9 or A-F.


Restart the machine to get both disks running.