Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[solved] extend VG; Volume Group is missing Pysical Volume at boot

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
mental
Posts: 3
Joined: 2021-10-23 09:10
Has thanked: 1 time

[solved] extend VG; Volume Group is missing Pysical Volume at boot

#1 Post by mental »

Hello Forum,

I am new here, and to Debian.
I played with minimal Ubuntu to repurpose some otherwise unusable hardware into a mediaplayer/xbmc in the past,
unfortunately always with a pretty ignorant approach towards the final application and too long ago to be much good.
I started with with Debian in order to get a little more familiar with Linux systems and to use it as host for further test VM's,
where i ran into a problem which exceeds my searching skills.

I puzzled stuff together using LVM and cryptsetup Manual while using tutorials as orientation for the needed steps and order,
because I wasn't able to find a source delivering exactly what i wanted to do.
I probably just missed some crucial step while extending my LUKS encrypted System with additional Partitions,
which a more experienced user probably can easy identify so I am gonna start with what i did.


System (no Problems until here:, as far as i can tell)
-Dell Latitude e6220 with one 320GB Hdd and Debian 11 Bullseye
-Partitioning, LUKS2 encryption of "/" , LVM, during installation
-LUKS1 encryption of "/boot"
-added 2 encrypted Partitions in order to be able to easy remove Storage gradually and reassign it to VM's
-added entries in /"etc/crypttab"

System was booting fine and i could see the "/dev/mapper/..." via "lsblk" so i assumed that they got recognized correctly and proceeded as follows.
...hope u can bare with the photos, just did them as little reminder for myself, thinking everything went as planned.
Photos show procedure to add "sda4".
Same was applied to add "sda3" which is accordingly already visible.

Image
Image

In my inexperienced eyes everything looked fine so i proceeded downloading a rather large file to "/home/Downloads".
Then Firefox complained about lack of disk-space.
Clicking the popup made it disappear instead of revealing further information and i couldn't find the file.
Which probably was send to "/dev/null" caused by the LVM or OS not being able to see or handle the added disk-space.

Rebooting the system I noticed the following Warnings.
I also rebooted after adding "sda3" and "sda4" and probably overlooked them then.

Image

So I started to check the filesystems.

Code: Select all

chnott@schnott:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                           8:0    0 298.1G  0 disk  
├─sda1                        8:1    0   953M  0 part  
│ └─boot_crypt              254:4    0   951M  0 crypt /boot
├─sda2                        8:2    0  46.6G  0 part  
│ └─sda2_crypt              254:0    0  46.6G  0 crypt 
│   ├─vg--host-lv--root     254:1    0  20.5G  0 lvm   /
│   ├─vg--host-lv--swap     254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg--host-lv--home     254:6    0  67.4G  0 lvm   /home
├─sda3                        8:3    0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 254:5    0  24.4G  0 crypt 
│   └─vg--host-lv--home     254:6    0  67.4G  0 lvm   /home
└─sda4                        8:4    0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext2 254:3    0  24.4G  0 crypt 
    └─vg--host-lv--home     254:6    0  67.4G  0 lvm   /home

Code: Select all

schnott@schnott:~$ sudo blkid
[sudo] password for schnott: 
/dev/sda1: UUID="9c3e110f-9ef0-425c-894f-6615fd2fb1a7" TYPE="crypto_LUKS" PARTUUID="1647cd99-01"
/dev/sda2: UUID="3ba3350e-e2db-4102-ac69-695f361578e0" TYPE="crypto_LUKS" PARTUUID="1647cd99-02"
/dev/sda3: UUID="0853cf3e-711a-4ba6-bef5-19c30b75ef1d" TYPE="crypto_LUKS" PARTUUID="1647cd99-03"
/dev/sda4: UUID="49d2fc3c-24b5-4dd4-ad40-931ad62a1fbd" TYPE="crypto_LUKS" PARTUUID="1647cd99-04"
/dev/mapper/sda2_crypt: UUID="8S9OEZ-jh1f-p4JA-bZGB-SJfK-tzR1-MgZj5p" TYPE="LVM2_member"
/dev/mapper/vg--host-lv--root: LABEL="root" UUID="850309ba-7bcf-423b-a8e0-d18dde6ceca1" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg--host-lv--swap: UUID="1d96b69e-dd36-4cd4-abe7-c6a0ee1b7be6" TYPE="swap"
/dev/mapper/sda4_crypt_vg-host_ext2: UUID="ElA6Rk-5Y9i-yOWp-TiGu-rYYt-6JPO-cVoyTZ" TYPE="LVM2_member"
/dev/mapper/boot_crypt: UUID="b30a607e-be82-424c-808b-d3788395108c" BLOCK_SIZE="4096" TYPE="ext2"
/dev/mapper/sda3_crypt_vg-host_ext1: UUID="Mvrdym-IS10-IDCK-msAZ-EfbF-K0k7-V5Bqw6" TYPE="LVM2_member"
/dev/mapper/vg--host-lv--home: LABEL="home" UUID="529f0500-3df2-49c3-bc24-24a04936023b" BLOCK_SIZE="4096" TYPE="ext4"

Code: Select all

schnott@schnott:~$ sudo vgdisplay
  --- Volume group ---
  VG Name               vg-host
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               <95.34 GiB
  PE Size               4.00 MiB
  Total PE              24406
  Alloc PE / Size       24406 / <95.34 GiB
  Free  PE / Size       0 / 0   
  VG UUID               afpZck-7M3m-fjso-z1Bi-8WvS-d8YW-Wc4Xj4

Code: Select all

schnott@schnott:~$ sudo lvs
  LV      VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-home vg-host -wi-ao----  67.41g                                                    
  lv-root vg-host -wi-ao---- <20.49g                                                    
  lv-swap vg-host -wi-ao----   7.43g

Code: Select all

schnott@schnott:~$ df -h
Filesystem                     Size  Used Avail Use% Mounted on
udev                           1.9G     0  1.9G   0% /dev
tmpfs                          381M  1.6M  380M   1% /run
/dev/mapper/vg--host-lv--root   20G  4.7G   15G  25% /
tmpfs                          1.9G   98M  1.8G   6% /dev/shm
tmpfs                          5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/boot_crypt         935M  113M  823M  13% /boot
/dev/mapper/vg--host-lv--home   19G  5.9G   12G  34% /home
tmpfs                          381M  664K  381M   1% /run/user/1000

Process as I understood it....

As the warning during boot states its obviously some kind of UUID based hick-up.
Looks like I still suffer a gap in the understanding of the Filesystem-layers.
Looking at "/dev/sda3" as example.
"/dev/sda3" with it's UUID is recognized via "crypttab", gets decrypted to /"dev/mapper/..." with it's UUID which then is used by LVM to find the LV.
Since the UUID LVM is not able to find and the UUID of "/dev/mapper/..." via "blkid" is the same, I need some help at this point.


Where I am stuck...

Did I just have a fail in the Procedure which prevented update of the LVM-Label in the 2.nd 512MB Sector?
Is it just a timing issue where LVM is searching while the Partition is not decrypted yet?
Or do I have to make the disk-space I added to the LVM somehow known to the OS ? (maybe also the reason why the added space is visible via "lvs" but not via "df -h"?)
Or did I miss to update some Config-File; because LVM requires the UUID of "/dev/sda3" instead of UUID of /dev/mapper/..."?
Or am I so damn of that nothing I've done makes sense? ....still just standing in front of the rabbit whole.



Any help, or pointing towards the solution, or origin of my Problem would be much appreciated since it feels like I am starting to tumble over what little I understood yet.
Thanks for your Time.
Have a nice weekend.
mental
Last edited by mental on 2021-11-25 13:47, edited 1 time in total.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: extend VG; Volume Group is missing Pysical Volume at boot

#2 Post by p.H »

You made two "mistakes", but nothing's really wrong. You just forgot two steps.

1) The extended VG contains the root filesystem and the swap area used for resume from hibernation. For this reason it must be activated by the initramfs. The original PV /dev/sda2_crypt is an encrypted device, which must also be unlocked by the initramfs. So the initramfs was built with information from /etc/crypttab to unlock this encrypted device. But for now it does not know about the two new encrypted volumes and complains that the PVs they contain are missing. They only contain extents allocated to the home LV which cannot be activated. Fortunately /home is not required by the initramfs, and you did not extend the root or swap LVs into the new PVs. After the initramfs hands over to the system init, the two new encrypted volumes are unlocked according to /etc/crypttab and the home LV can be activated.

So the warning messages are transient and harmless. You can remove them by updating the initramfs with :

Code: Select all

update-initramfs -u
so that it know about the new lines in /etc/crypttab.
WARNING : You must do it if you extend the root or swap LVs with new PV space.

2) You extended the home LV, but not the filesystem it contains. lsblk and lvs show that the LV size is 67 GiB but df shows its filesystem size is only 19 GiB. So the extra space is unusable. You can extend the filesystem with :

Code: Select all

resize2fs /dev/mapper/vg--host-lv--home
3) Yes, I wrote "two mistakes", because the 3rd one is merely "cosmetic". The names you gave to the encrypted volumes look like they are LVM logical volumes /dev/mapper/vgname-lvname, which could be confusing. At first I thought you tried to extend the volume group with one of its own logical volumes, which would have been really wrong...

4) Don't use "-" in VG and LV names. It gives really ugly device mapper names such as "vg--host-lv--home".

mental
Posts: 3
Joined: 2021-10-23 09:10
Has thanked: 1 time

Re: extend VG; Volume Group is missing Pysical Volume at boot

#3 Post by mental »

First of all, thank you very much p.H for the detailed answer to my problem.
It really helped understanding the problem i was facing and definitely showed where I had to dig a little deeper in order to get more comfortable with debian/linux.

I am sorry that it took so long to reply, but I ran into a few Problems on the way and dealing with them took a lot of time.
Unfortunately I am more or less still stuck at "mistake 1)".

Problem: "update-initramfs -u" somehow isn't working as it should.
....probably due to some kind of fail I produced wile setting up the system, which i guess led to some kind of miss-configured "initramfs-CFG-file".
How I came to this conclusion is listed below.

1) Attempt: "update-initramfs -u"
I got some warning messages "i915" like shown below - just an example. I failed to make a copy of the exact list.
"W: Possible missing firmware /lib/firmware/i915/bxt_dmc_ver1_07.bin for module i915"

Code: Select all

sudo apt-get install firmware-linux
...solved the problem and "update-initramfs -u" ran without any warning or failure message.
...and confirmed the updated "Initrd" which was the same version as used upon boot and identified by "uname -r"

Unfortunately the warning messages during boot as described in 1st post where still there (picture see "3) Attempt") and
"crypttab" extracted from "Initrd" was exactly the same as prior to "update-initramfs -u".

2) Attempt: following your information that the warning originates form outdated "/etc/crypttab" I did the "Initrd" update manually.
I extracted the "initrd.img" using "unmkinitramfs".
Edited the "crypttab" and repacked it using following commands.

Code: Select all

cd /early
find kernel -print0 | cpio --null --create --format=newc >> /newinitrd
cd /main
find . | cpio --create --format=newc | gzip -9 >> /newinitrd

Then I renamed it to "initrd.img-5.10.0-9-amd64" using "mv".
I shredded the original image at "/boot" using "shred -u".
And copied the modded image to "/boot" using "cp".

Which made the warnings disappear gradually as I entered the key's like shown below.

Image

Which I hope is normal, indicating the manual "Initrd" update worked.

3) Attempt: trying to figure out why "update-initramfs -u" isn't updating "Initrd crypttab" and checking for reproducibility.
I ran...

Code: Select all

sudo update-initramfs -u > ./meindump.txt 2>&1
...ending up with only 1 line.

Code: Select all

update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
Which got me back to the warning messages and "initrd crypttab" content i started with.
Image
Here I hit a dead end because my attempts for finding a solution didn't even get me close to the origin of my problem, at least as far as I can tell.

Furthermore, I didn't even touch "mistake 2 and 3/4" in order not to generate more chaos as I already did.
...hopefully not the reason for above described Problem.

So again, any help, or pointing towards the solution, or origin of my Problem would be much appreciated as the only attempt I have left at the moment would be try and error reinstall.
Thanks for your Time.
Have a nice weekend.
mental

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: extend VG; Volume Group is missing Pysical Volume at boot

#4 Post by p.H »

mental wrote: 2021-11-05 15:05 W: Possible missing firmware /lib/firmware/i915/bxt_dmc_ver1_07.bin for module i915
These are harmless warning messages and do not indicate any failure. They are displayed because
- plymouth is installed and causes inclusion of kernel graphic driver modules such as i915 (for Intel GPU) into the initramfs
- the i915 module exports a list of firmware files it may use with some GPUs
- some or all of these files are not present

However if the graphics work well the "missing" firmware files are optional.
mental wrote: 2021-11-05 15:05 Unfortunately the warning messages during boot as described in 1st post where still there
Indeed. I tested on my computer and confirm this. It seems that the initramfs generator is smart enough to know which encrypted volumes are required by the initramfs. Since the two new volumes do not contain any part of / or the swap, they are not required.

You can force inclusion of these encrypted volumes in the initramfs' /cryptboot/crypttab by adding "initramfs" to their option field in /etc/crypttab. But IMO it does not provide any benefit as it does not suppress the messages ; it seems the initramfs tries again to activate all VGs after unlocking each single encrypted volume, printing the message until all encrypted volumes are unlocked.

I don't know if and how the initramfs or LVM can be set up to no print these messages when incomplete VGs are found. In any case a LVM VG spanning across multiple encrypted volumes is an awkward situation I avoid whenever possible. Instead I use a setup I nicknamed the "LVM-crypto sandwich" :
- one unencrypted LVM VG spanning across multiple physical volumes
- one LV using all the space in this VG
- one encrypted volume in the LV
- a second VG in the LV
- LVs as needed in the second (encrypted) VG

One encryption layer between two LVM layers => "sandwich".
One single encrypted volume, one passphrase.

When I want to extend the encrypted VG, I add the new physical volume to the unencrypted VG, extend its LV, extend the encrypted volume, and extend the encrypted VG physical volume. Still one encrypted volume and one passphrase.

mental
Posts: 3
Joined: 2021-10-23 09:10
Has thanked: 1 time

Re: extend VG; Volume Group is missing Pysical Volume at boot

#5 Post by mental »

Again, thank you very much p.H. for taking the time and easing my way into Linux.
Thanks to you I could solve the problems at hand.

I don’t mind the LVM messages at boot as long as they are harmless and not affecting the system; thanks for the clarification.

I agree, Adding the Partitions to initrd /etc/crypttab doesn’t give any benefit.
In my case it’s even rather the contrary due to my “odd HDD setup”.
The reason why I chose this setup was purely academic.
Like this I can play around with all Storage-Levels down to Partitions with only one HDD/PC.
Because I used same PW for the encryption of the base system and the extension the PW for / is also just called once at boot. The extension gets decrypted/mounted automatically when the system starts, if only the base system partition is added to initrd /etc/crypttab.
If the extension is added to /etc/crypttab the PW is called for every partition listed.

Thanks for the crypto sandwich tip, I’ll definitely give it a try on one of the free partitions when the basics are tackled.



For every other Linux beginner who might run across similar problems I’ll try to wrap up what I did to finish my LVM setup.
Keep in mind that I am new to Debian so it might be wise to seek confirmation from more experienced users before applying to critical-systems.



Renaming the Volume Group:
Sry, my attempt was super messy cause I failed to check the LVM Wiki in first approach [no comment PLS ;)] and just started working.
Just use the Wiki ;)
...only thing I noticed there is no hint about /swap and changing entry in /etc/initramfs-tools/conf.d/resume .

Renaming a Logical Volume

Code: Select all

schnott@schnott:~/Documents$ df -hT
Filesystem                   Type      Size  Used Avail Use% Mounted on
udev                         devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                        tmpfs     381M  1.6M  380M   1% /run
/dev/mapper/vg_host-lv--root ext4       20G  5.6G   14G  30% /
tmpfs                        tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                        tmpfs     5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/boot_crypt       ext2      935M  161M  774M  18% /boot
/dev/mapper/vg_host-lv--home ext4       67G  9.6G   55G  15% /home
tmpfs                        tmpfs     381M   96K  381M   1% /run/user/1000
schnott@schnott:~/Documents$ su
Password: 
root@schnott:/# sudo lvrename /dev/vg_host/lv-root /dev/vg_host/lv_root
  Renamed "lv-root" to "lv_root" in volume group "vg_host"
root@schnott:/# sudo nano /etc/fstab
root@schnott:/# #####change every entry accordingly ^C

For SWAP!!! additionally change entry  accordingly in
nano /etc/initramfs-tools/conf.d/resume

root@schnott:/# cat /boot/grub/grub.cfg | grep lv--root
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv--root ro  quiet
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv--root ro  quiet
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv--root ro single 
		linux	/vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg_host-lv--root ro  quiet
		linux	/vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg_host-lv--root ro single 
root@schnott:/# sed -i 's/lv--root/lv_root/g' /boot/grub/grub.cfg
root@schnott:/# cat /boot/grub/grub.cfg | grep lv--root
root@schnott:/# cat /boot/grub/grub.cfg | grep lv_root
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv_root ro  quiet
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv_root ro  quiet
		linux	/vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg_host-lv_root ro single 
		linux	/vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg_host-lv_root ro  quiet
		linux	/vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg_host-lv_root ro single 
root@schnott:/# sudo vgchange -ay
  3 logical volume(s) in volume group "vg_host" now active
root@schnott:/# sudo lvchange /dev/vg_host/lv-home --refresh
root@schnott:/# sudo lvchange /dev/vg_host/lv_root --refresh
root@schnott:/# sudo lvchange /dev/vg_host/lv-swap --refresh
root@schnott:/# sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
cryptsetup: ERROR: Couldn't resolve device /dev/mapper/vg_host-lv--root
cryptsetup: WARNING: Couldn't determine root device
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
cryptsetup: ERROR: Couldn't resolve device /dev/mapper/vg_host-lv--root
cryptsetup: WARNING: Couldn't determine root device
>>>>> then reboot >>>>> 
root@schnott:/home/schnott# sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-8-amd64
Found initrd image: /boot/initrd.img-5.10.0-8-amd64
done
Remove encrypted Partition LVM

Code: Select all

schnott@schnott:~$ sudo pvs -o+pv_used
[sudo] password for schnott: 
  PV                                  VG      Fmt  Attr PSize   PFree Used   
  /dev/mapper/sda2_crypt              vg_host lvm2 a--  <46.55g    0  <46.55g
  /dev/mapper/sda3_crypt_vg-host_ext1 vg_host lvm2 a--   24.39g    0   24.39g
  /dev/mapper/sda4_crypt_vg-host_ext2 vg_host lvm2 a--   24.39g    0   24.39g
  schnott@schnott:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                           8:0    0 298.1G  0 disk  
├─sda1                        8:1    0   953M  0 part  
│ └─boot_crypt              254:4    0   951M  0 crypt /boot
├─sda2                        8:2    0  46.6G  0 part  
│ └─sda2_crypt              254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_root       254:1    0  20.5G  0 lvm   /
│   ├─vg_host-lv_swap       254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
├─sda3                        8:3    0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 254:5    0  24.4G  0 crypt 
│   └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
└─sda4                        8:4    0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext2 254:3    0  24.4G  0 crypt 
    └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
    
Following steps need to be run from a live system - online shrinking is not suported

Code: Select all

user@debian:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0   2.3G  1 loop /usr/lib/live/mount/rootfs/filesystem.squashfs
sda      8:0    1  14.4G  0 disk 
├─sda1   8:1    1   4.4G  0 part /usr/lib/live/mount/persistence/sda1
└─sda2   8:2    1    10G  0 part /usr/lib/live/mount/persistence/sda2
sdb      8:16   0 298.1G  0 disk 
├─sdb1   8:17   0   953M  0 part 
├─sdb2   8:18   0  46.6G  0 part 
├─sdb3   8:19   0  24.4G  0 part 
└─sdb4   8:20   0  24.4G  0 part 

user@debian:~$ sudo cryptsetup luksOpen /dev/sdb2 sda2_crypt
Enter passphrase for /dev/sdb2: 
 
user@debian:~$ sudo cryptsetup luksOpen /dev/sdb3 sda3_crypt_vg-host_ext1

user@debian:~$ sudo cryptsetup luksOpen /dev/sdb4 sda4_crypt_vg-host_ext1
Enter passphrase for /dev/sdb4: 
user@debian:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                         7:0    0   2.3G  1 loop  /usr/lib/live/mount/rootfs/filesystem.squashfs
sda                           8:0    1  14.4G  0 disk  
├─sda1                        8:1    1   4.4G  0 part  /usr/lib/live/mount/persistence/sda1
└─sda2                        8:2    1    10G  0 part  /usr/lib/live/mount/persistence/sda2
sdb                           8:16   0 298.1G  0 disk  
├─sdb1                        8:17   0   953M  0 part  
├─sdb2                        8:18   0  46.6G  0 part  
│ └─sda2_crypt              253:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_home       253:3    0  67.4G  0 lvm   
│   ├─vg_host-lv_root       253:4    0  20.5G  0 lvm   
│   └─vg_host-lv_swap       253:5    0   7.4G  0 lvm   
├─sdb3                        8:19   0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 253:1    0  24.4G  0 crypt 
│   └─vg_host-lv_home       253:3    0  67.4G  0 lvm   
└─sdb4                        8:20   0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext1 253:2    0  24.4G  0 crypt 
    └─vg_host-lv_home       253:3    0  67.4G  0 lvm   

user@debian:~$ sudo vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  vg_host   3   3   0 wz--n- <95.34g    0 
user@debian:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           381M  1.6M  380M   1% /run
/dev/sda1       4.5G  2.6G  2.0G  58% /run/live/persistence/sda1
/dev/loop0      2.3G  2.3G     0 100% /run/live/rootfs/filesystem.squashfs
tmpfs           1.9G     0  1.9G   0% /run/live/overlay
/dev/sda2       9.9G  1.1G  8.4G  12% /run/live/persistence/sda2
overlay         9.9G  1.1G  8.4G  12% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           1.9G  8.0K  1.9G   1% /tmp
tmpfs           381M  108K  381M   1% /run/user/1000

   
user@debian:~$ sudo vgchange -ay vg_host
  3 logical volume(s) in volume group "vg_host" now active
user@debian:~$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_host/lv_home
  LV Name                lv_home
  VG Name                vg_host
  LV UUID                vj9H7j-ITeb-UD3V-qFa1-Dwev-nXW6-NHwQhL
  LV Write Access        read/write
  LV Creation host, time schnott, 2021-10-14 22:26:56 +0000
  LV Status              available
  # open                 1
  LV Size                67.41 GiB
  Current LE             17258
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
   
  --- Logical volume ---
  LV Path                /dev/vg_host/lv_root
  LV Name                lv_root
  VG Name                vg_host
  LV UUID                Mdvn1e-jWYq-WDRR-SgRk-cr52-mouM-dpgcuW
  LV Write Access        read/write
  LV Creation host, time schnott, 2021-10-14 22:27:18 +0000
  LV Status              available
  # open                 0
  LV Size                <20.49 GiB
  Current LE             5245
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4
   
  --- Logical volume ---
  LV Path                /dev/vg_host/lv_swap
  LV Name                lv_swap
  VG Name                vg_host
  LV UUID                i0pgNg-SYk9-AP2I-Gs9u-U334-z7a8-EldCnC
  LV Write Access        read/write
  LV Creation host, time schnott, 2021-10-14 22:27:33 +0000
  LV Status              available
  # open                 0
  LV Size                7.43 GiB
  Current LE             1903
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5
   

user@debian:~$ sudo umount /media/user/home 
user@debian:~$ sudo resize2fs /dev/vg_host/lv_home 12G    #needs to be larger than the data to be stored
resize2fs 1.46.2 (28-Feb-2021)
Please run 'e2fsck -f /dev/vg_host/lv_home' first.


user@debian:~$ sudo e2fsck -f /dev/vg_host/lv_home
e2fsck 1.46.2 (28-Feb-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
home: 11786/4423680 files (0.3% non-contiguous), 2611746/17672192 blocks
user@debian:~$ sudo resize2fs /dev/vg_host/lv_home 12G
resize2fs 1.46.2 (28-Feb-2021)
Resizing the filesystem on /dev/vg_host/lv_home to 3145728 (4k) blocks.
The filesystem on /dev/vg_host/lv_home is now 3145728 (4k) blocks long.
^^Remaining size needs to be larger than the data to be stored.
Rest can be done from within the system.

Code: Select all


schnott@schnott:~$ sudo vgs
  VG      #PV #LV #SN Attr   VSize   VFree
  vg_host   3   3   0 wz--n- <95.34g    0 
schnott@schnott:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         1.9G     0  1.9G   0% /dev
tmpfs                        381M  1.6M  380M   1% /run
/dev/mapper/vg_host-lv_root   20G  5.7G   14G  30% /
tmpfs                        1.9G     0  1.9G   0% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/boot_crypt       935M  161M  774M  18% /boot
/dev/mapper/vg_host-lv_home   12G  8.8G  2.4G  79% /home
tmpfs                        381M   92K  381M   1% /run/user/1000
schnott@schnott:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                           8:0    0 298.1G  0 disk  
├─sda1                        8:1    0   953M  0 part  
│ └─boot_crypt              254:4    0   951M  0 crypt /boot
├─sda2                        8:2    0  46.6G  0 part  
│ └─sda2_crypt              254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_root       254:1    0  20.5G  0 lvm   /
│   ├─vg_host-lv_swap       254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
├─sda3                        8:3    0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 254:3    0  24.4G  0 crypt 
│   └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
└─sda4                        8:4    0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext2 254:5    0  24.4G  0 crypt 
    └─vg_host-lv_home       254:6    0  67.4G  0 lvm   /home
schnott@schnott:~$ sudo lvreduce -L 18G /dev/mapper/vg_host-lv_home
  WARNING: Reducing active and open logical volume to 18.00 GiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vg_host/lv_home? [y/n]: y
  Size of logical volume vg_host/lv_home changed from 67.41 GiB (17258 extents) to 18.00 GiB (4608 extents).
  Logical volume vg_host/lv_home successfully resized.
  
^^^^^^########## needs to be larger than the "home"-filesystem  and smaller than space provided by remaining physicalpartitions of the volumegroup
  


schnott@schnott:~$ sudo pvs -o+pv_used
  PV                                  VG      Fmt  Attr PSize   PFree   Used  
  /dev/mapper/sda2_crypt              vg_host lvm2 a--  <46.55g 640.00m 45.92g
  /dev/mapper/sda3_crypt_vg-host_ext1 vg_host lvm2 a--   24.39g  24.39g     0 
  /dev/mapper/sda4_crypt_vg-host_ext2 vg_host lvm2 a--   24.39g  24.39g     0 
schnott@schnott:~$ ^^^^^^^^^if the partition is used u need to move the content^^^^^^^^^^^^^^C

schnott@schnott:~$ sudo pvmove /dev/mapper/sda3_crypt_vg-host_ext1
  No data to move for vg_host.

schnott@schnott:~$ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C

schnott@schnott:~$ sudo vgreduce vg_host /dev/mapper/sda3_crypt_vg-host_ext1
  Removed "/dev/mapper/sda3_crypt_vg-host_ext1" from volume group "vg_host"
schnott@schnott:~$ sudo vgreduce vg_host /dev/mapper/sda4_crypt_vg-host_ext2
  Removed "/dev/mapper/sda4_crypt_vg-host_ext2" from volume group "vg_host"
schnott@schnott:~$ sudo pvremove /dev/mapper/sda3_crypt_vg-host_ext1
  Labels on physical volume "/dev/mapper/sda3_crypt_vg-host_ext1" successfully wiped.
schnott@schnott:~$ sudo pvremove /dev/mapper/sda4_crypt_vg-host_ext2
  Labels on physical volume "/dev/mapper/sda4_crypt_vg-host_ext2" successfully wiped.
schnott@schnott:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                           8:0    0 298.1G  0 disk  
├─sda1                        8:1    0   953M  0 part  
│ └─boot_crypt              254:4    0   951M  0 crypt /boot
├─sda2                        8:2    0  46.6G  0 part  
│ └─sda2_crypt              254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_root       254:1    0  20.5G  0 lvm   /
│   ├─vg_host-lv_swap       254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg_host-lv_home       254:6    0    18G  0 lvm   /home
├─sda3                        8:3    0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 254:3    0  24.4G  0 crypt 
└─sda4                        8:4    0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext2 254:5    0  24.4G  0 crypt 
schnott@schnott:~$ sudo pvs -o+pv_used
  PV                     VG      Fmt  Attr PSize   PFree   Used  
  /dev/mapper/sda2_crypt vg_host lvm2 a--  <46.55g 640.00m 45.92g
schnott@schnott:~$ sudo lvextend /dev/mapper/vg_host-lv_home /dev/mapper/sda2_crypt
[sudo] password for schnott: 
  Size of logical volume vg_host/lv_home changed from 18.00 GiB (4608 extents) to 18.62 GiB (4768 extents).
  Logical volume vg_host/lv_home successfully resized.
schnott@schnott:~$ sudo pvs -o+pv_used
  PV                     VG      Fmt  Attr PSize   PFree Used   
  /dev/mapper/sda2_crypt vg_host lvm2 a--  <46.55g    0  <46.55g
schnott@schnott:~$ sudo resize2fs /dev/mapper/vg_host-lv_home
resize2fs 1.46.2 (28-Feb-2021)
Filesystem at /dev/mapper/vg_host-lv_home is mounted on /home; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/mapper/vg_host-lv_home is now 4882432 (4k) blocks long.

schnott@schnott:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         1.9G     0  1.9G   0% /dev
tmpfs                        381M  1.6M  380M   1% /run
/dev/mapper/vg_host-lv_root   20G  5.7G   14G  30% /
tmpfs                        1.9G     0  1.9G   0% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/boot_crypt       935M  161M  774M  18% /boot
/dev/mapper/vg_host-lv_home   19G  8.8G  8.7G  51% /home
tmpfs                        381M   96K  381M   1% /run/user/1000
schnott@schnott:~$ lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                           8:0    0 298.1G  0 disk  
├─sda1                        8:1    0   953M  0 part  
│ └─boot_crypt              254:4    0   951M  0 crypt /boot
├─sda2                        8:2    0  46.6G  0 part  
│ └─sda2_crypt              254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_root       254:1    0  20.5G  0 lvm   /
│   ├─vg_host-lv_swap       254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg_host-lv_home       254:6    0  18.6G  0 lvm   /home
├─sda3                        8:3    0  24.4G  0 part  
│ └─sda3_crypt_vg-host_ext1 254:3    0  24.4G  0 crypt 
└─sda4                        8:4    0  24.4G  0 part  
  └─sda4_crypt_vg-host_ext2 254:5    0  24.4G  0 crypt 
schnott@schnott:~$ sudo pvs -o+pv_used
  PV                     VG      Fmt  Attr PSize   PFree Used   
  /dev/mapper/sda2_crypt vg_host lvm2 a--  <46.55g    0  <46.55g
schnott@schnott:~$ sudo nano /etc/crypttab  # change accordingly

schnott@schnott:~$ sudo vgchange -ay
  3 logical volume(s) in volume group "vg_host" now active
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_home --refresh
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_root --refresh
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_swap --refresh
schnott@schnott:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
schnott@schnott:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-8-amd64
Found initrd image: /boot/initrd.img-5.10.0-8-amd64
done
schnott@schnott:~$ 
Add encrypted Partition LVM

Code: Select all

schnott@schnott:~$ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 298.1G  0 disk  
├─sda1                  8:1    0   953M  0 part  
│ └─boot_crypt        254:4    0   951M  0 crypt /boot
├─sda2                  8:2    0  46.6G  0 part  
│ └─sda2_crypt        254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_home 254:1    0  18.6G  0 lvm   /home
│   ├─vg_host-lv_root 254:2    0  20.5G  0 lvm   /
│   └─vg_host-lv_swap 254:3    0   7.4G  0 lvm   [SWAP]
├─sda3                  8:3    0  24.4G  0 part  
└─sda4                  8:4    0  24.4G  0 part  
schnott@schnott:~$ sudo gparted
GParted 1.2.0
configuration --enable-libparted-dmraid --enable-online-resize
libparted 3.4
schnott@schnott:~$ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 298.1G  0 disk  
├─sda1                  8:1    0   953M  0 part  
│ └─boot_crypt        254:4    0   951M  0 crypt /boot
├─sda2                  8:2    0  46.6G  0 part  
│ └─sda2_crypt        254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_home 254:1    0  18.6G  0 lvm   /home
│   ├─vg_host-lv_root 254:2    0  20.5G  0 lvm   /
│   └─vg_host-lv_swap 254:3    0   7.4G  0 lvm   [SWAP]
├─sda3                  8:3    0  48.8G  0 part  
├─sda4                  8:4    0     1K  0 part  
├─sda5                  8:5    0  66.4G  0 part  
├─sda6                  8:6    0  64.5G  0 part  
└─sda7                  8:7    0  70.9G  0 part 
schnott@schnott:~$ sudo cryptsetup luksFormat --type luks2 /dev/sda3 
WARNING: Device /dev/sda3 already contains a 'ext4' superblock signature.

WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/sda3: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksOpen /dev/sda3 sda3_crypt
Enter passphrase for /dev/sda3: 
schnott@schnott:~$ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 298.1G  0 disk  
├─sda1                  8:1    0   953M  0 part  
│ └─boot_crypt        254:4    0   951M  0 crypt /boot
├─sda2                  8:2    0  46.6G  0 part  
│ └─sda2_crypt        254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_home 254:1    0  18.6G  0 lvm   /home
│   ├─vg_host-lv_root 254:2    0  20.5G  0 lvm   /
│   └─vg_host-lv_swap 254:3    0   7.4G  0 lvm   [SWAP]
├─sda3                  8:3    0  48.8G  0 part  
│ └─sda3_crypt        254:5    0  48.8G  0 crypt 
├─sda4                  8:4    0     1K  0 part  
├─sda5                  8:5    0  66.4G  0 part  
├─sda6                  8:6    0  64.5G  0 part  
└─sda7                  8:7    0  70.9G  0 part  
schnott@schnott:~$ sudo nano /etc/crypttab

#add entry accordingly
sda2_crypt UUID=3ba3350e-e2db-4102-ac69-695f361578e0 none luks
boot_crypt UUID=9c3e110f-9ef0-425c-894f-6615fd2fb1a7 none luks
sda3_crypt UUID=003c5656-a80f-48c0-a172-3cdec0708895 none luks



schnott@schnott:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
schnott@schnott:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-8-amd64
Found initrd image: /boot/initrd.img-5.10.0-8-amd64
done
schnott@schnott:~$ 

>>>>>>>>>>>>>>>>>>>>reboot

schnott@schnott:~$ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 298.1G  0 disk  
├─sda1                  8:1    0   953M  0 part  
│ └─boot_crypt        254:5    0   951M  0 crypt /boot
├─sda2                  8:2    0  46.6G  0 part  
│ └─sda2_crypt        254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_home 254:1    0  18.6G  0 lvm   /home
│   ├─vg_host-lv_root 254:2    0  20.5G  0 lvm   /
│   └─vg_host-lv_swap 254:3    0   7.4G  0 lvm   [SWAP]
├─sda3                  8:3    0  48.8G  0 part  
│ └─sda3_crypt        254:4    0  48.8G  0 crypt 
├─sda4                  8:4    0     1K  0 part  
├─sda5                  8:5    0  66.4G  0 part  
├─sda6                  8:6    0  64.5G  0 part  
└─sda7                  8:7    0  70.9G  0 part

schnott@schnott:~$ sudo pvs -o+pv_used
  PV                     VG      Fmt  Attr PSize   PFree Used   
  /dev/mapper/sda2_crypt vg_host lvm2 a--  <46.55g    0  <46.55g
schnott@schnott:~$ sudo pvscan
  PV /dev/mapper/sda2_crypt   VG vg_host         lvm2 [<46.55 GiB / 0    free]
  Total: 1 [<46.55 GiB] / in use: 1 [<46.55 GiB] / in no VG: 0 [0   ]
schnott@schnott:~$ sudo pvcreate /dev/mapper/sda3_crypt
  Physical volume "/dev/mapper/sda3_crypt" successfully created.
schnott@schnott:~$ sudo vgextend vg_host /dev/mapper/sda3_crypt
  Volume group "vg_host" successfully extended
schnott@schnott:~$ sudo lvextend /dev/mapper/vg_host-lv_home /dev/mapper/sda3_crypt
  Size of logical volume vg_host/lv_home changed from 18.62 GiB (4768 extents) to 67.43 GiB (17263 extents).
  Logical volume vg_host/lv_home successfully resized.
schnott@schnott:~$ sudo pvs -o+pv_used
  PV                     VG      Fmt  Attr PSize   PFree Used   
  /dev/mapper/sda2_crypt vg_host lvm2 a--  <46.55g    0  <46.55g
  /dev/mapper/sda3_crypt vg_host lvm2 a--  <48.81g    0  <48.81g
schnott@schnott:~$ sudo pvscan
  PV /dev/mapper/sda2_crypt   VG vg_host         lvm2 [<46.55 GiB / 0    free]
  PV /dev/mapper/sda3_crypt   VG vg_host         lvm2 [<48.81 GiB / 0    free]
  Total: 2 [<95.36 GiB] / in use: 2 [<95.36 GiB] / in no VG: 0 [0   ]
schnott@schnott:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         1.9G     0  1.9G   0% /dev
tmpfs                        381M  1.6M  380M   1% /run
/dev/mapper/vg_host-lv_root   20G  5.7G   14G  30% /
tmpfs                        1.9G     0  1.9G   0% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/vg_host-lv_home   19G  8.8G  8.7G  51% /home
/dev/mapper/boot_crypt       935M  161M  774M  18% /boot
tmpfs                        381M   96K  381M   1% /run/user/1000
schnott@schnott:~$ sudo resize2fs /dev/mapper/vg_host-lv_home
[sudo] password for schnott: 
resize2fs 1.46.2 (28-Feb-2021)
Filesystem at /dev/mapper/vg_host-lv_home is mounted on /home; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 9
The filesystem on /dev/mapper/vg_host-lv_home is now 17677312 (4k) blocks long.

schnott@schnott:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         1.9G     0  1.9G   0% /dev
tmpfs                        381M  1.6M  380M   1% /run
/dev/mapper/vg_host-lv_root   20G  5.7G   14G  30% /
tmpfs                        1.9G     0  1.9G   0% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
/dev/mapper/vg_host-lv_home   67G  8.8G   55G  14% /home
/dev/mapper/boot_crypt       935M  161M  774M  18% /boot
tmpfs                        381M   96K  381M   1% /run/user/1000
schnott@schnott:~$ sudo vgchange -ay
  3 logical volume(s) in volume group "vg_host" now active
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_home --refresh
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_root --refresh
schnott@schnott:~$ sudo lvchange /dev/vg_host/lv_swap --refresh
schnott@schnott:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
schnott@schnott:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-8-amd64
Found initrd image: /boot/initrd.img-5.10.0-8-amd64
done
schnott@schnott:~$ 



schnott@schnott:~$ lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                     8:0    0 298.1G  0 disk  
├─sda1                  8:1    0   953M  0 part  
│ └─boot_crypt        254:5    0   951M  0 crypt /boot
├─sda2                  8:2    0  46.6G  0 part  
│ └─sda2_crypt        254:0    0  46.6G  0 crypt 
│   ├─vg_host-lv_root 254:1    0  20.5G  0 lvm   /
│   ├─vg_host-lv_swap 254:2    0   7.4G  0 lvm   [SWAP]
│   └─vg_host-lv_home 254:4    0  67.4G  0 lvm   /home
├─sda3                  8:3    0  48.8G  0 part  
│ └─sda3_crypt        254:3    0  48.8G  0 crypt 
│   └─vg_host-lv_home 254:4    0  67.4G  0 lvm   /home
├─sda4                  8:4    0     1K  0 part  
├─sda5                  8:5    0  66.4G  0 part  
├─sda6                  8:6    0  64.5G  0 part  
└─sda7                  8:7    0  70.9G  0 part  
schnott@schnott:~$ sudo cryptsetup luksDump /dev/sda3
LUKS header information
Version:       	2
Epoch:         	3
Metadata area: 	16384 [bytes]
Keyslots area: 	16744448 [bytes]
UUID:          	003c5656-a80f-48c0-a172-3cdec0708895
Label:         	(no label)
Subsystem:     	(no subsystem)
Flags:       	(no flags)

Data segments:
  0: crypt
	offset: 16777216 [bytes]
	length: (whole device)
	cipher: aes-xts-plain64
	sector: 512 [bytes]

Keyslots:
  0: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     772533
	Threads:    4
	Salt:       ea 3e bd d0 aa 48 79 2d ff fd 69 4d 55 04 29 b6 
	            35 c3 26 90 74 4b c7 b9 e3 ff b9 4d 46 38 1e 7d 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:32768 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
	Hash:       sha256
	Iterations: 81715
	Salt:       21 a8 6d 83 c8 23 db 05 0b 42 18 2e f9 6c df 12 
	            eb 5d 83 ed 98 eb d3 70 e7 4f 3b e3 07 69 20 12 
	Digest:     51 e7 56 35 ca f9 7d 3e 3b f5 ad 7e 87 cf 67 84 
	            16 d5 eb eb 6f 53 32 be 71 ea cf 1e cb 10 16 30 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase:
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksAddKey /dev/sda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
schnott@schnott:~$ sudo cryptsetup luksDump /dev/sda3
LUKS header information
Version:       	2
Epoch:         	10
Metadata area: 	16384 [bytes]
Keyslots area: 	16744448 [bytes]
UUID:          	003c5656-a80f-48c0-a172-3cdec0708895
Label:         	(no label)
Subsystem:     	(no subsystem)
Flags:       	(no flags)

Data segments:
  0: crypt
	offset: 16777216 [bytes]
	length: (whole device)
	cipher: aes-xts-plain64
	sector: 512 [bytes]

Keyslots:
  0: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     772533
	Threads:    4
	Salt:       ea 3e bd d0 aa 48 79 2d ff fd 69 4d 55 04 29 b6 
	            35 c3 26 90 74 4b c7 b9 e3 ff b9 4d 46 38 1e 7d 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:32768 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  1: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     772528
	Threads:    4
	Salt:       3b e9 43 cc 78 28 8a b6 64 d3 3e 0d 58 ca 95 bc 
	            a5 91 fd a1 cb 84 b7 d1 a0 00 d6 51 bc 51 8f 70 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:290816 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  2: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     772661
	Threads:    4
	Salt:       ac b9 9a 38 8c d0 a3 8b 27 fe ed 32 df 23 7c 3a 
	            87 c0 27 b2 ef 8e e2 48 72 f6 3c 8e cb ac 96 f7 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:548864 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  3: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     774024
	Threads:    4
	Salt:       96 95 8c 26 98 a4 a5 e4 2b 06 4e bb 42 58 88 90 
	            32 fb f4 5a 02 63 7c 94 8b 59 99 20 9c 46 e5 77 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:806912 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  4: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     774280
	Threads:    4
	Salt:       b1 04 a2 c9 26 c7 a4 36 7d d3 6e 8d 0a 7d 45 03 
	            9a e3 4c 60 06 f3 bf 10 62 17 bb 22 8f 59 2b c6 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:1064960 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  5: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     771195
	Threads:    4
	Salt:       a6 d2 92 a0 88 9d 15 6c dc 8c f1 0e 95 14 1b 68 
	            63 33 86 45 03 7e 16 42 6f 6e 4b 35 3f 00 0d 5b 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:1323008 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  6: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     772661
	Threads:    4
	Salt:       76 bf de f3 3c 98 e1 4f c4 86 03 76 28 74 8b fb 
	            14 47 67 6e a5 ca b9 dd 2b 7f 80 40 97 8e d9 0e 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:1581056 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
  7: luks2
	Key:        512 bits
	Priority:   normal
	Cipher:     aes-xts-plain64
	Cipher key: 512 bits
	PBKDF:      argon2i
	Time cost:  4
	Memory:     773832
	Threads:    4
	Salt:       1f d5 02 ef 4b 44 1e 12 2a e9 dc 01 da 76 88 13 
	            50 cc 06 08 d4 3f 13 7e 13 80 b8 56 b6 1b b2 93 
	AF stripes: 4000
	AF hash:    sha256
	Area offset:1839104 [bytes]
	Area length:258048 [bytes]
	Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
	Hash:       sha256
	Iterations: 81715
	Salt:       21 a8 6d 83 c8 23 db 05 0b 42 18 2e f9 6c df 12 
	            eb 5d 83 ed 98 eb d3 70 e7 4f 3b e3 07 69 20 12 
	Digest:     51 e7 56 35 ca f9 7d 3e 3b f5 ad 7e 87 cf 67 84 
	            16 d5 eb eb 6f 53 32 be 71 ea cf 1e cb 10 16 30 
schnott@schnott:~$ 
schnott@schnott:~$ su
Password: 
root@schnott:/home/schnott# cd ~
root@schnott:~# sudo cryptsetup luksHeaderBackup /dev/sda3 --header-backup-file /home/schnott/Documents/luks_header_backup/dev_sda3-sda3_crypt-vg_host-lv_home
Relabel encrypted Boot-Partition LVM

Code: Select all

schnott@schnott:~$ lsblk -o NAME,TYPE,FSTYPE,SIZE,MOUNTPOINT
NAME                  TYPE  FSTYPE        SIZE MOUNTPOINT
sda                   disk              298.1G 
├─sda1                part  crypto_LUKS   953M 
│ └─boot_crypt        crypt ext2          951M /boot
├─sda2                part  crypto_LUKS  46.6G 
│ └─sda2_crypt        crypt LVM2_member  46.6G 
│   ├─vg_host-lv_root lvm   ext4         20.5G /
│   ├─vg_host-lv_swap lvm   swap          7.4G [SWAP]
│   └─vg_host-lv_home lvm   ext4         67.4G /home
├─sda3                part  crypto_LUKS  48.8G 
│ └─sda3_crypt        crypt LVM2_member  48.8G 
│   └─vg_host-lv_home lvm   ext4         67.4G /home
├─sda4                part                  1K 
├─sda5                part  ext4         66.4G 
├─sda6                part  ext4         64.5G 
└─sda7                part  ext4         70.9G 
schnott@schnott:~$ sudo nano /etc/crypttab
OLD
  GNU nano 5.4                         /etc/crypttab                                                                  
sda2_crypt UUID=3ba3350e-e2db-4102-ac69-695f361578e0 none luks
boot_crypt UUID=9c3e110f-9ef0-425c-894f-6615fd2fb1a7 none luks
sda3_crypt UUID=003c5656-a80f-48c0-a172-3cdec0708895 none luks

CHANGED TO
  GNU nano 5.4                         /etc/crypttab *                                                                
sda2_crypt UUID=3ba3350e-e2db-4102-ac69-695f361578e0 none luks
sda1_crypt UUID=9c3e110f-9ef0-425c-894f-6615fd2fb1a7 none luks
sda3_crypt UUID=003c5656-a80f-48c0-a172-3cdec0708895 none luks


schnott@schnott:~$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-9-amd64
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
schnott@schnott:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-9-amd64
Found initrd image: /boot/initrd.img-5.10.0-9-amd64
Found linux image: /boot/vmlinuz-5.10.0-8-amd64
Found initrd image: /boot/initrd.img-5.10.0-8-amd64
done

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>reboot

schnott@schnott:~$ lsblk -o NAME,TYPE,FSTYPE,SIZE,MOUNTPOINT
NAME                  TYPE  FSTYPE        SIZE MOUNTPOINT
sda                   disk              298.1G 
├─sda1                part  crypto_LUKS   953M 
│ └─sda1_crypt        crypt ext2          951M /boot
├─sda2                part  crypto_LUKS  46.6G 
│ └─sda2_crypt        crypt LVM2_member  46.6G 
│   ├─vg_host-lv_root lvm   ext4         20.5G /
│   ├─vg_host-lv_swap lvm   swap          7.4G [SWAP]
│   └─vg_host-lv_home lvm   ext4         67.4G /home
├─sda3                part  crypto_LUKS  48.8G 
│ └─sda3_crypt        crypt LVM2_member  48.8G 
│   └─vg_host-lv_home lvm   ext4         67.4G /home
├─sda4                part                  1K 
├─sda5                part  ext4         66.4G 
├─sda6                part  ext4         64.5G 
└─sda7                part  ext4         70.9G
Thanks for the Help
mental

Post Reply