root@eq12b:~# lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                            8:0    0 476.9G  0 disk 
nvme0n1                      259:0    0 953.9G  0 disk 
├─nvme0n1p1                  259:1    0  1007K  0 part 
├─nvme0n1p2                  259:2    0     1G  0 part /boot/efi
└─nvme0n1p3                  259:3    0 952.9G  0 part 
  ├─pve-swap                 253:0    0   7.5G  0 lvm  [SWAP]
  ├─pve-root                 253:1    0    96G  0 lvm  /
  ├─pve-data_tmeta           253:2    0   8.3G  0 lvm  
  │ └─pve-data-tpool         253:4    0 816.7G  0 lvm  
  │   ├─pve-data             253:5    0 816.7G  1 lvm  
  │   └─pve-vm--100--disk--0 253:6    0     6G  0 lvm  
  └─pve-data_tdata           253:3    0 816.7G  0 lvm  
    └─pve-data-tpool         253:4    0 816.7G  0 lvm  
      ├─pve-data             253:5    0 816.7G  1 lvm  
      └─pve-vm--100--disk--0 253:6    0     6G  0 lvm  
# 设置存储池名称
name=thin-pool-data
# 设置存储池设备,多个设备使用空格间隔
disk="/dev/sda"
# 创建PV
pvcreate $disk
vgcreate thin-pool $disk
lvcreate -T thin-pool/data -l +99%FREE
pvesm add lvmthin $name --content rootdir,images --thinpool data --vgname thin-pool

效果

root@eq12b:~# disk="/dev/sda"
root@eq12b:~# pvcreate $disk
root@eq12b:~# vgcreate thin-pool $disk
root@eq12b:~# lvcreate -T thin-pool/data -l +99%FREE
pvesm add lvmthin $name --content rootdir,images --thinpool data --vgname thin-pool
  Physical volume "/dev/sda" successfully created.
  Volume group "thin-pool" successfully created
  Thin pool volume with chunk size 256.00 KiB can address at most 63.50 TiB of data.
  Logical volume "data" created.
root@eq12b:~# lsblk 
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                            8:0    0 476.9G  0 disk 
├─thin--pool-data_tmeta      253:7    0   120M  0 lvm  
│ └─thin--pool-data          253:9    0 471.9G  0 lvm  
└─thin--pool-data_tdata      253:8    0 471.9G  0 lvm  
  └─thin--pool-data          253:9    0 471.9G  0 lvm  
nvme0n1                      259:0    0 953.9G  0 disk 
├─nvme0n1p1                  259:1    0  1007K  0 part 
├─nvme0n1p2                  259:2    0     1G  0 part /boot/efi
└─nvme0n1p3                  259:3    0 952.9G  0 part 
  ├─pve-swap                 253:0    0   7.5G  0 lvm  [SWAP]
  ├─pve-root                 253:1    0    96G  0 lvm  /
  ├─pve-data_tmeta           253:2    0   8.3G  0 lvm  
  │ └─pve-data-tpool         253:4    0 816.7G  0 lvm  
  │   ├─pve-data             253:5    0 816.7G  1 lvm  
  │   └─pve-vm--100--disk--0 253:6    0     6G  0 lvm  
  └─pve-data_tdata           253:3    0 816.7G  0 lvm  
    └─pve-data-tpool         253:4    0 816.7G  0 lvm  
      ├─pve-data             253:5    0 816.7G  1 lvm  
      └─pve-vm--100--disk--0 253:6    0     6G  0 lvm  
root@eq12b:~# 

image-1712413934570