Files
.infineon/_-Review/lvm.md
2024-11-06 12:39:13 -07:00

2.4 KiB

type, created, updated
type created updated
note 2024-06-29T20:42:08.000Z 2024-06-29T20:42:08.000Z

LVM

Proxmox

# login as root if needed (not needed for proxmox)
sudo su
# list disks and partitions
fdisk -l
# list volume groups
vgdisplay
# list logical volumes
lvdisplay
# edit partitions with fdisk, change device id as needed
fdisk /dev/sda
# print the partition table
p
# delete a partition
d
# enter the lvm partition number
3
# create a new partition
n
# enter the new partition number, same as the number deleted
3
# press enter to accept the default first sector
# press enter to accept the default last sector
# when prompted about removing the LVM signature, enter N
n
# set the partition type
t
# enter the partition number
3
# set the type to Linux LVM
30
# write the changes
w
# list disks and partitions, noting the size increase
fdisk -l
# extend the existing physical volume
pvresize /dev/sda3
# extend the pve-root logical volume to 100% available free space
lvresize -L +8GB /dev/pve/root
# extend the underlying file system
resize2fs /dev/mapper/pve-root
# list logical volumes, noting root is now 8GB larger
lvdisplay
# extend the data to 100% available free space
lvextend -l +100%FREE pve/data
# list logical volumes, noting data is now over 35GB
lvdisplay
lvresize -L -8GB /dev/pve/data
lvchange -an /dev/pve/data
lvreduce -L 8GB /dev/pve/data
lvchange -ay /dev/pve/data
lvs -a
dmsetup info pve-data
dmsetup info -c pve-data
pvesm lvmscan
lvcreate -L 1G -n test pve
lvconvert --type thin-pool pve/test
lvcreate -L 200m --thinpool tpool pve
# https://quantum5.ca/2024/02/17/cloning-proxmix-with-lvm-thin-pools/
lvdisplay --units G pve/data
# https://forum.proxmox.com/threads/can-i-remove-local-and-local-lvm.122850/
lvremove /dev/pve/data -y
lvs
lvcreate -L 79GB --thinpool data pve
lvresize -L +1GB /dev/pve/data
lvresize -L +1GB /dev/pve/root
lvextend -l +100%FREE pve/root
resize2fs /dev/mapper/pve-root
mkdir /mnt/proxmox
mount /dev/pve/vm-102-disk-1 /mnt/proxmox