使用现有分区扩展 lvm

使用现有分区扩展 lvm

我有以下分区:

    root@test02 [~]# df -l
    Filesystem           1K-blocks    Used Available Use% Mounted on 
    /dev/mapper/vg_test02-lv_root
                         119277820 4947592 108274344   5% /
    tmpfs                   961132       0    961132   0% /dev/shm
    /dev/sda1               495844   54380    415864  12% /boot
    /dev/sdb1            103211296  714176  97254292   1% /tmp

    root@test02 [~]# fdisk -l

    Disk /dev/sdb: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000448a6

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       13055   104856576   83  Linux

    Disk /dev/sda: 128.8 GB, 128849018880 bytes
    255 heads, 63 sectors/track, 15665 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0000c49e

       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    /dev/sda3           13055       15665    20971512+  8e  Linux LVM

    Disk /dev/mapper/vg_test02-lv_root: 124.1 GB, 124088483840 bytes
    255 heads, 63 sectors/track, 15086 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000


    Disk /dev/mapper/vg_test02-lv_swap: 4227 MB, 4227858432 bytes
    255 heads, 63 sectors/track, 514 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    root@test02 [~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_test02
  PV Size               99.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25474
  Free PE               0
  Allocated PE          25474
  PV UUID               GS07qb-CYuk-ywp9-A3C5-HoRt-HF9L-tlkJmc

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg_test02
  PV Size               20.00 GiB / not usable 3.99 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5119
  Free PE               0
  Allocated PE          5119
  PV UUID               dKk7VD-PZfO-9Zji-b8xq-WPP3-2tsG-sGJKFj

root@test02 [~]# vgdisplay
  --- Volume group ---
  VG Name               vg_test02
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               119.50 GiB
  PE Size               4.00 MiB
  Total PE              30593
  Alloc PE / Size       30593 / 119.50 GiB
  Free  PE / Size       0 / 0
  VG UUID               kPHRMG-yF75-j7pW-H3fR-cIvb-eQXD-inhdvI

问题: 如何使用 /dev/sdb1 扩展我的 /dev/mapper/vg_test02-lv_root 卷空间?

非常感谢

答案1

要扩展 LVM 磁盘,请将 sdb 类型更改为 Linux LVM,fdisk然后创建该磁盘的物理卷:

pvcreate /dev/sdb1

然后您必须扩展逻辑磁盘所在的卷组并检查是否正确扩展:

vgextend vg_group /dev/sdb1
vgdisplay

扩展逻辑磁盘:

lvextend /dev/vg_group/lv_disk /dev/sdb1

最后一步是调整文件系统的大小,以便可以利用这个额外的空间,这可以使用 resize2fs 命令完成。

resize2fs /dev/vg_group/lv_disk

相关内容