Improve README with instruction for adding more space

Added some instructions for how to add more space easily with LVM
This commit is contained in:
Le0xFF 2022-07-27 16:30:45 +02:00
parent e17e1d6e7c
commit 79dddd7f49

View File

@ -156,7 +156,7 @@ reboot
<br>
# What to do if system breaks?
## What to do if system breaks?
In case anything will break, you will just have to delete the `@` subvolume, create it again and reinstall your distro. `/home` folder won't be affected in any way.
@ -209,6 +209,59 @@ chown -R <same_user>:<same_user> /home/<same_user>
<br>
## How to add more space with a new drive with LVM
> Probably the following could also be done from a running system, but maybe it's better to boot a LiveCD just in case.
First a new physical drive must be added to the system. This drive in the following example will be called `/dev/sda`.
After booting a LiveCD, mount the encrypted partition:
``` bash
cryptsetup open /dev/nvme0n1p2 <encrypted_name>
```
Scan for Volume Groups and then enable the one you need:
``` bash
vgscan
vgchange -ay <vg_name>
```
Scan for Logical Volumes and then enable the one you need:
``` bash
lvscan
lvchange -ay <vg_name>/<lv_root_name>
```
Then a new Physical Volume for the new drive must be created:
``` bash
pvcreate /dev/sda
```
After that it must be added to the existing Logical Volume:
``` bash
vgextend <lv_root_name> /dev/sda
```
Then the Logical Volume must be extended to cover the new free space:
``` bash
lvm lvextend -l +100%FREE <vg_name>/<lv_root_name>
```
Finally also the BTRFS filesystem must be extended to cover all the free space; to do that, the BTRFS partition must be mounted:
``` bash
mount -t btrfs /dev/mapper/<vg_name>-<lv_root_name> /mnt/
btrfs filesystem resize max /mnt/
```
<br>
## Notes
- To speed up decryption at boot you could lower the number of iteration for each key as described on the [Arch Wiki](https://wiki.archlinux.org/title/GRUB/Tips_and_tricks#Speeding_up_LUKS_decryption_in_GRUB), but keep in mind that this comes with its own security concerns.