Requirements for creating or enlarging an LVM volume
sudo -s
apt install parted
for i in /sys/class/scsi_host/*/scan; do echo "- - -">$i; done
for i in /sys/class/scsi_device/*/device/rescan; do echo 1>$i; done
(Optional) Initialization of the partition table with GPT - only for new hard disks (e.g. /dev/sdb)
parted /dev/sdb mktable gpt
parted /dev/sdb unit mib mkpart primary 1 100%
parted /dev/sdb set 1 lvm on
partprobe
pvcreate /dev/sdb1
Enlarge an existing partition and its PV (e.g. /dev/sdb1)
parted /dev/sdb resizepart 1 100%
partprobe
pvresize /dev/sdb1
vgcreate data /dev/sdb1
Create LV (Logical Volume) (e.g. "data01")
lvcreate -l +100%FREE -n data01 data
Create file system (e.g. EXT4)
mkfs.ext4 /dev/data/data01
mkdir /data
Add line: /dev/data/data01 /data ext4 defaults 0 2
mount /data
Extend an existing volume group with a volume
vgextend data /dev/sdb1
Enlarge existing LVM volume
Determine the name of the LV to be enlarged (e.g. /dev/data/data01)
lvdisplay
lvextend -l +100%FREE /dev/data/data01
EXT4: resize2fs -p /dev/data/data01
BTRFS: btrfs filesystem resize max /data (/data = Mount point of LV /dev/data/data01)
XFS: xfs_growfs /dev/data/data01