Expanding a drive (LUKS and normal)
Normal XFS drives
Most of the times this command will work
sudo growpart /dev/nvme0n1 1
sudo xfs_growfs /dev/nvme0n1p1
If not you need to find out what [Disc] and [Drive] is supposed to be, examine the following commands output
sudo lsblk
In the following example it would be: [Disc] = nvme0n1 [Drive] = nvme0n1p1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:1 0 20G 0 disk
├─nvme0n1p1 259:2 0 20G 0 part /
└─nvme0n1p128 259:3 0 1M 0 part
Run the commands
sudo growpart /dev/[Disc] 1
sudo xfs_growfs /dev/[Drive]
Encrypted LUKS drives
First make sure that the drive is opened and mounted.
To find out what [Drive] is supposed to be, examine the following commands output
sudo lsblk
In the following example it would be crypt-sdf
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:1 0 20G 0 disk
├─nvme0n1p1 259:2 0 20G 0 part /
└─nvme0n1p128 259:3 0 1M 0 part
nvme1n1 259:0 0 50G 0 disk
└─crypt-sdf 253:0 0 30G 0 crypt /mnt/sda
Run the commands
sudo cryptsetup resize [Drive]
sudo resize2fs /dev/mapper/[Drive]