AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1141692
Accepted
小太郎
小太郎
Asked: 2023-08-16 20:08:14 +0800 CST2023-08-16 20:08:14 +0800 CST 2023-08-16 20:08:14 +0800 CST

pvmove:尝试移动镜像 LV 时“可用空间不足”

  • 772

最初我有两个 PV /dev/nvme0n1p2,并/dev/nvme1n1p1包含各种镜像 LV。
我最近添加了两个新的更大容量的 PV/dev/nvme2n1p1和/dev/nvme3n1p1,并扩展了 LV ( home/windows-persistent) 以利用新空间。

然而,我注意到 LV 现在分布在所有 4 个 PV 上,而我更喜欢它只分布在 2 个 PV 上,因此我尝试将 LV 移动到新的 PV pvmove:

lvm> pvmove /dev/nvme0n1p2 -n home/windows-persistent /dev/nvme2n1p1
  Insufficient free space: 57793 extents needed, but only 0 available
  Unable to allocate mirror extents for home/pvmove0.
  Failed to convert pvmove LV to mirrored.
lvm> pvmove /dev/nvme1n1p1 -n home/windows-persistent /dev/nvme3n1p1
  Insufficient free space: 57793 extents needed, but only 0 available
  Unable to allocate mirror extents for home/pvmove0.
  Failed to convert pvmove LV to mirrored.

LVM 为什么会抱怨可用空间不足?如何正确移动 LV?


pvdisplay//vgdisplay输出lvdisplay:

lvm> pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/nvme0n1p2
  VG Name               home
  PV Size               476.74 GiB / not usable 0   
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              122046
  Free PE               2812
  Allocated PE          119234
  PV UUID               n6vD1c-pF3t-mqlg-g4Ge-HPT7-FwOC-p7t6wK
   
  --- Physical Segments ---
  Physical extent 0 to 51199:
    Logical volume  /dev/home/dom0
    Logical extents 0 to 51199
  Physical extent 51200 to 51200:
    Logical volume  /dev/home/windows-persistent_rmeta_0
    Logical extents 0 to 0
  Physical extent 51201 to 89600:
    Logical volume  /dev/home/windows-persistent_rimage_0
    Logical extents 0 to 38399
  Physical extent 89601 to 89601:
    Logical volume  /dev/home/windows_rmeta_0
    Logical extents 0 to 0
  Physical extent 89602 to 99841:
    Logical volume  /dev/home/windows_rimage_0
    Logical extents 0 to 10239
  Physical extent 99842 to 119233:
    Logical volume  /dev/home/windows-persistent_rimage_0
    Logical extents 38400 to 57791
  Physical extent 119234 to 122045:
    FREE
   
  --- Physical volume ---
  PV Name               /dev/nvme1n1p1
  VG Name               home
  PV Size               465.76 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              119234
  Free PE               0
  Allocated PE          119234
  PV UUID               1dmaeN-j0D3-EU60-kQg2-a5t7-CNdP-qpBYyp
   
  --- Physical Segments ---
  Physical extent 0 to 51199:
    Logical volume  /dev/home/dom0-mirror
    Logical extents 0 to 51199
  Physical extent 51200 to 51200:
    Logical volume  /dev/home/windows-persistent_rmeta_1
    Logical extents 0 to 0
  Physical extent 51201 to 81920:
    Logical volume  /dev/home/windows-persistent_rimage_1
    Logical extents 0 to 30719
  Physical extent 81921 to 92161:
    Logical volume  /dev/home/windows-persistent_rimage_1
    Logical extents 38400 to 48640
  Physical extent 92162 to 99841:
    Logical volume  /dev/home/windows-persistent_rimage_1
    Logical extents 30720 to 38399
  Physical extent 99842 to 99842:
    Logical volume  /dev/home/windows_rmeta_1
    Logical extents 0 to 0
  Physical extent 99843 to 110082:
    Logical volume  /dev/home/windows_rimage_1
    Logical extents 0 to 10239
  Physical extent 110083 to 119233:
    Logical volume  /dev/home/windows-persistent_rimage_1
    Logical extents 48641 to 57791
   
  --- Physical volume ---
  PV Name               /dev/nvme2n1p1
  VG Name               home
  PV Size               <1.82 TiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              476931
  Free PE               457923
  Allocated PE          19008
  PV UUID               UzD83f-tnya-9wbR-TRrf-qkxe-2lf7-ewF3M7
   
  --- Physical Segments ---
  Physical extent 0 to 19007:
    Logical volume  /dev/home/windows-persistent_rimage_0
    Logical extents 57792 to 76799
  Physical extent 19008 to 476930:
    FREE
   
  --- Physical volume ---
  PV Name               /dev/nvme3n1p1
  VG Name               home
  PV Size               <1.82 TiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              476931
  Free PE               457923
  Allocated PE          19008
  PV UUID               Rf7CoD-NxTs-ohO3-pqJx-dMZ8-6SCh-SXXhAf
   
  --- Physical Segments ---
  Physical extent 0 to 19007:
    Logical volume  /dev/home/windows-persistent_rimage_1
    Logical extents 57792 to 76799
  Physical extent 19008 to 476930:
    FREE

lvm> vgdisplay
  --- Volume group ---
  VG Name               home
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  209
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               2
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               <4.56 TiB
  PE Size               4.00 MiB
  Total PE              1195142
  Alloc PE / Size       276484 / 1.05 TiB
  Free  PE / Size       918658 / 3.50 TiB
  VG UUID               1QhLGQ-ljr2-p0or-yAiD-530e-17n4-y8VN0d
   
lvm> lvdisplay
  --- Logical volume ---
  LV Path                /dev/home/dom0
  LV Name                dom0
  VG Name                home
  LV UUID                XKpxWe-g8Rh-faKQ-s8Ht-KPC0-oLHc-tLneqN
  LV Write Access        read/write
  LV Creation host, time home, 2016-07-02 18:55:56 +1000
  LV Status              available
  # open                 1
  LV Size                200.00 GiB
  Current LE             51200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/home/windows-persistent
  LV Name                windows-persistent
  VG Name                home
  LV UUID                4g6nXt-h6LL-YaHc-wfcU-Iote-rFJd-rpzgeF
  LV Write Access        read/write
  LV Creation host, time home, 2018-01-08 22:18:42 +1100
  LV Status              available
  # open                 0
  LV Size                300.00 GiB
  Current LE             76800
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:5
   
  --- Logical volume ---
  LV Path                /dev/home/dom0-mirror
  LV Name                dom0-mirror
  VG Name                home
  LV UUID                WtfyuY-LRxR-nQBk-ft8C-T1gn-2hvE-TIQLgm
  LV Write Access        read/write
  LV Creation host, time home, 2018-12-06 19:02:41 +1100
  LV Status              available
  # open                 1
  LV Size                200.00 GiB
  Current LE             51200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:6
   
  --- Logical volume ---
  LV Path                /dev/home/windows
  LV Name                windows
  VG Name                home
  LV UUID                JKQjjn-4vUO-bwTD-eCl3-eZiM-mato-1R09It
  LV Write Access        read/write
  LV Creation host, time home, 2023-07-06 17:10:07 +1000
  LV Status              available
  # open                 0
  LV Size                40.00 GiB
  Current LE             10240
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:11

pvs//vgs输出lvs:

lvm> pvs
  PV             VG   Fmt  Attr PSize    PFree 
  /dev/nvme0n1p2 home lvm2 a--   476.74g 10.98g
  /dev/nvme1n1p1 home lvm2 a--  <465.76g     0 
  /dev/nvme2n1p1 home lvm2 a--    <1.82t <1.75t
  /dev/nvme3n1p1 home lvm2 a--    <1.82t <1.75t
lvm> vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  home   4   4   0 wz--n- <4.56t 3.50t
lvm> lvs
  LV                 VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  dom0               home -wi-ao---- 200.00g                                                    
  dom0-mirror        home -wi-ao---- 200.00g                                                    
  windows            home rwi-aor---  40.00g                                    100.00          
  windows-persistent home rwi-aor--- 300.00g                                    100.00
lvm
  • 1 1 个回答
  • 26 Views

1 个回答

  • Voted
  1. Best Answer
    小太郎
    2023-08-21T09:18:43+08:002023-08-21T09:18:43+08:00

    由于如何pvmove尝试防止将两个镜像移动到同一 PV 来减少冗余(例如,一个 PV 不应同时包含LV_rimage_0和_rimage_1子 LV),组合/并置同一镜像的不同部分的唯一*方法是移动每个子 LV一对一地,并且仅按名称。
    由于当前错误相当神秘,我已向 LVM 提出 PR 以改进消息传递:https://github.com/lvmteam/lvm2/pull/126

    * 也许可以用 绕过--alloc anywhere,但我没有尝试过

    除此之外,pvmove最终在“允许同一镜像的各个部分并置”代码中出现了一个错误,导致其无法正常工作。在上面的同一个 PR 中,我修复了该错误


    最终通过上述修复,我最终运行了以下命令来成功移动我的 LV:

    pvmove -n home/windows-persistent_rmeta_0 /dev/nvme0n1p2 /dev/nvme2n1p1
    pvmove -n home/windows-persistent_rimage_0 /dev/nvme0n1p2 /dev/nvme2n1p1
    pvmove -n home/windows-persistent_rmeta_1 /dev/nvme1n1p1 /dev/nvme3n1p1
    pvmove -n home/windows-persistent_rimage_1 /dev/nvme1n1p1 /dev/nvme3n1p1
    
    • 0

相关问题

  • OpenBSD 和文件系统快照

  • 卷组空间不足。我该如何收回它?

  • LVM 快照是这样工作的吗?

  • LVM 和快照

  • 如何在 Ubuntu 上挂载 LVM 分区?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve