使用挂载设备或者多路径设备作为 lvm 后端

使用挂载设备或者多路径设备作为 lvm 后端

如果没有挂载设备,可以使用本地磁盘空间做 loop 设备提供给 lvm 使用。
参考:使用本地空间创建回环设备用来做 lvm 后端

1. 获取需要操作的设备(多路径设备也可以)

    [root@yenai ~]#  multipath -ll
    mpathnr (360002ac00000000000002aff0001a082) dm-1 3PARdata,VV
    size=50G features='0' hwhandler='0' wp=rw
    `-+- policy='service-time 0' prio=1 status=active
      |- 13:0:0:1 sde 8:64  active ready running
      |- 14:0:0:1 sdh 8:112 active ready running
      |- 12:0:0:1 sdg 8:96  active ready running
      `- 15:0:0:1 sdf 8:80  active ready running

2. 初始化设备(分区)

    fdisk /dev/mapper/mpathnr
    n(默认值即可,走完一个完整流程,新建分区)
    p(确认分区信息)
    t,8e,p(修改分区为 Linux LVM)
    w(写分区信息并退出)
    [root@yenai ~]#  fdisk -l /dev/mapper/mpathnr(再次确认分区信息正确,为 Linux LVM)

3. 创建 PV

    [root@yenai ~]#  pvcreate /dev/mapper/mpathnr1
      Device /dev/mapper/mpathnr1 not found (or ignored by filtering).
    [root@yenai ~]#  partprobe(将最新的分区通知内核)
    [root@yenai ~]#  pvcreate /dev/mapper/mpathnr1
      Physical volume "/dev/mapper/mpathnr1" successfully created
    [root@yenai ~]#  pvdisplay(确认 PV 信息)
      "/dev/mapper/mpathnr1" is a new physical volume of "49.98 GiB"
      --- NEW Physical volume ---
      PV Name               /dev/mapper/mpathnr1
      VG Name
      PV Size               49.98 GiB
      Allocatable           NO
      PE Size               0
      Total PE              0
      Free PE               0
      Allocated PE          0
      PV UUID               MOycIM-7cN4-Q0ef-taVG-SXjw-FQRc-cnyFSz

4. 创建 VG

    [root@yenai ~]#  vgcreate cinder-volumes /dev/mapper/mpathnr1
      Volume group "cinder-volumes" successfully created
    [root@yenai ~]#  vgdisplay(确认 VG 信息)
      --- Volume group ---
      VG Name               cinder-volumes
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  1
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                0
      Open LV               0
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               49.97 GiB
      PE Size               4.00 MiB
      Total PE              12792
      Alloc PE / Size       0 / 0
      Free  PE / Size       12792 / 49.97 GiB
      VG UUID               TDHieT-EiYZ-tusb-E8e6-hIs0-lHmb-76hAZp
    [root@yenai ~]#  vgs
      VG             #PV #LV #SN Attr   VSize  VFree
      cinder-volumes   1   0   0 wz--n- 49.97g 49.97g
展开阅读全文

没有更多推荐了,返回首页