帮助扩展 LVM

帮助扩展 LVM

我为其中一台使用 LVM 的 redis 16.04 服务器添加了 30GB 的空间。

我已经能够让物理驱动器看到它,但我不知道如何扩展逻辑磁盘

root@Redis5:/dev# lvmdiskscan
  /dev/Redis1-vg/root   [      45.52 GiB]
  /dev/sda1                [     487.00 MiB]
  /dev/Redis1-vg/swap_1 [       4.00 GiB]
  /dev/sda5                [      79.52 GiB] LVM physical volume
  1 disk
  2 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

我试过:

root@Redis5:/dev# sudo lvresize -l+100%FREE --resizefs Redis1-vg/root
  Size of logical volume Redis1-vg/root unchanged from 45.52 GiB (11653 extents).
  Logical volume root successfully resized.
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 11932672 (4k) blocks long.  Nothing to do!


root@Redis5:/dev# vgdisplay
  --- Volume group ---
  VG Name               Redis1-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               49.52 GiB
  PE Size               4.00 MiB
  Total PE              12677
  Alloc PE / Size       12677 / 49.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               IIvQQr-JfYI-wJYh-tLBI-FqnX-IW6R-q8uDCm


root@Redis5:/dev# fdisk -l
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 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
Disklabel type: dos
Disk identifier: 0x96a5b056

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048    999423    997376  487M 83 Linux
/dev/sda2       1001470 167772126 166770657 79.5G  5 Extended
/dev/sda5       1001472 167772126 166770655 79.5G 8e Linux LVM


Disk /dev/mapper/Redis1--vg-root: 45.5 GiB, 48876224512 bytes, 95461376 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/Redis1--vg-swap_1: 4 GiB, 4294967296 bytes, 8388608 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

任何帮助将不胜感激。

答案1

终于明白了——

sudo growpart /dev/sda 5 # extend the existing part

sudo pvresize /dev/sda5 # bring in the extra space
sudo lvresize -l+100%FREE --resizefs ORDRedis1-vg/root ## resize

答案2

由于您似乎已经调整了底层分区的大小,因此您现在应该pvresize在调整 LV 大小之前运行。

相关内容