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

97 lines
2.4 KiB
Markdown

---
type: "note"
created: "2024-06-29T20:42:08.000Z"
updated: "2024-06-29T20:42:08.000Z"
---
# LVM
## Proxmox
```bash Thu Jun 27 2024 20:20:43 GMT-0700 (Mountain Standard Time)
# 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
```
```bash Sat Jun 29 2024 08:45:54 GMT-0700 (Mountain Standard Time)
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
```
```bash Sat Jun 29 2024 09:25:39 GMT-0700 (Mountain Standard Time)
lvcreate -L 1G -n test pve
lvconvert --type thin-pool pve/test
lvcreate -L 200m --thinpool tpool pve
```
```bash Sat Jun 29 2024 10:28:51 GMT-0700 (Mountain Standard Time)
# https://quantum5.ca/2024/02/17/cloning-proxmix-with-lvm-thin-pools/
lvdisplay --units G pve/data
```
```bash Sat Jun 29 2024 10:37:38 GMT-0700 (Mountain Standard Time)
# 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
```
```bash Sat Jun 29 2024 13:42:08 GMT-0700 (Mountain Standard Time)
mkdir /mnt/proxmox
mount /dev/pve/vm-102-disk-1 /mnt/proxmox
```