Proxmox VE(PVE)硬盘扩容,支持EMMC

博主发布

pve,esxi都是用lvm管理分区,可以使用lvm扩容分区

  • 启动emmc里的pve
  • 扩充的是local-lvm(local主要是VZDump备份文件, ISO镜像, 容器模板,local-lvm主要是 磁盘映像, 容器)
  • 使用putty、xshell一类的软件通过ssh进pve,端口22,用户名root,密码是安装pve时设置的密码

扩容前

检查可能出现的情况

fdisk -l

如果提示

GPT PMBR size mismatch (67108863 != 121634815) will be corrected by write.

执行

apt-get update
apt-get install parted
parted -l

Fix

扩容分区

安装需要的软件

apt-get update
apt-get install parted

执行

fdisk -l

提示

GPT PMBR size mismatch (67108863 != 121634815) will be corrected by write.
Disk /dev/sda: 58 GiB, 62277025792 bytes, 121634816 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0C17A6FD-69E2-401F-97C8-209F38118AC9

Device       Start      End  Sectors  Size Type
/dev/sda1       34     2047     2014 1007K BIOS boot
/dev/sda2     2048  1050623  1048576  512M EFI System
/dev/sda3  1050624 67108830 66058207 31.5G Linux LVM


Disk /dev/mapper/pve-swap: 3.9 GiB, 4160749568 bytes, 8126464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/pve-root: 7.8 GiB, 8321499136 bytes, 16252928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

查看系统内硬盘名称(这一步可省略)

lsblk

提示

NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk1            179:0    0 58.2G  0 disk
├─mmcblk1p1        179:1    0 1007K  0 part
├─mmcblk1p2        179:2    0  512M  0 part /boot/efi
└─mmcblk1p3        179:3    0 57.8G  0 part
  ├─pve-swap       253:0    0  3.6G  0 lvm  [SWAP]
  ├─pve-root       253:1    0  7.3G  0 lvm  /
  ├─pve-data_tmeta 253:2    0    1G  0 lvm
  │ └─pve-data     253:4    0 44.9G  0 lvm
  └─pve-data_tdata 253:3    0 44.9G  0 lvm
    └─pve-data     253:4    0 44.9G  0 lvm
mmcblk1boot0       179:8    0    4M  1 disk
mmcblk1boot1       179:16   0    4M  1 disk

如果是emmc,硬盘名称是mmcblk1,执行

parted /dev/mmcblk1

如果是非emmc,硬盘名称是sda,执行

parted /dev/sda

提示

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

执行

print

提示

(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 62.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  1049kB  1031kB                     bios_grub
 2      1049kB  538MB   537MB   fat32              boot, esp
 3      538MB   34.4GB  33.8GB                     lvm

(parted)

扩容LVM,执行

resizepart 3 100%

quit

提示

(parted) resizepart 3 100%
(parted) quit
Information: You may need to update /etc/fstab.

更新物理卷的大小,LVM所在驱动器

如果是emmc,执行

pvresize /dev/mmcblk3

非emmc,执行

pvresize /dev/sda3

提示

Physical volume "/dev/sda3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized

扩容逻辑卷,执行

cat /etc/pve/storage.cfg

提示

dir: local
        path /var/lib/vz
        content iso,vztmpl,backup

lvmthin: local-lvm
        thinpool data
        vgname pve
        content rootdir,images

执行

lvdisplay

提示

--- Logical volume ---
  LV Path                /dev/pve/swap
  LV Name                swap
  VG Name                pve
  LV UUID                ArHV9L-H5ZI-M4gs-Gj1M-4bFV-qbWO-K2VYk4
  LV Write Access        read/write
  LV Creation host, time proxmox, 2020-07-02 19:06:14 +0800
  LV Status              available
  # open                 2
  LV Size                <3.88 GiB
  Current LE             992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pve/root
  LV Name                root
  VG Name                pve
  LV UUID                L1MtJ0-LX2s-JfVn-5bTY-WdM8-jfxZ-Gi2oTD
  LV Write Access        read/write
  LV Creation host, time proxmox, 2020-07-02 19:06:14 +0800
  LV Status              available
  # open                 1
  LV Size                7.75 GiB
  Current LE             1984
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Name                data
  VG Name                pve
  LV UUID                AYiySQ-K6O5-Ye17-XAtF-m154-tRoG-mljDuL
  LV Write Access        read/write
  LV Creation host, time proxmox, 2020-07-02 19:06:15 +0800
  LV Pool metadata       data_tmeta
  LV Pool data           data_tdata
  LV Status              available
  # open                 0
  LV Size                <14.00 GiB
  Allocated pool data    0.00%
  Allocated metadata     1.58%
  Current LE             3583
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

执行

pvs

lvextend -l +100%FREE /dev/pve/data

提示

Size of logical volume pve/data_tdata changed from <14.00 GiB (3583 extents) to 43.87 GiB (11231 extents).
Logical volume pve/data_tdata successfully resized.

扩容成功,可在pve控制端网页查看


0 条评论

发表评论

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注