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 / 问题 / 733407
Accepted
ReynierPM
ReynierPM
Asked: 2015-11-03 13:24:19 +0800 CST2015-11-03 13:24:19 +0800 CST 2015-11-03 13:24:19 +0800 CST

可用空间不足:需要 X 个扩展区,但只有 Y 个可用

  • 772

我正在尝试在 Vmware Workstation 12 Pro CentOS VM 中扩展 LVM。以下是我正在遵循的步骤以及我停止的地方,因为不知道如何从那里开始:

  1. fdisk使用命令创建主分区
  2. 使用以下方法获取分区表信息fdisk -l:

    # fdisk -l
    
    Disk /dev/sda: 85.9 GB, 85899345920 bytes
    255 heads, 63 sectors/track, 10443 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: 0x0001d929
    
       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        5222    41430016   8e  Linux LVM
    /dev/sda3            5222       10443    41940357+  8e  Linux LVM
    
    Disk /dev/mapper/vg_webserver-lv_root: 38.3 GB, 38277218304 bytes
    255 heads, 63 sectors/track, 4653 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_webserver-lv_swap: 4143 MB, 4143972352 bytes
    255 heads, 63 sectors/track, 503 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
    
  3. 将分区转换为物理卷:

    # pvcreate /dev/sda3
      Physical volume "/dev/sda3" successfully created  
    
  4. 获取要扩展的卷的名称:

    # vgdisplay
      --- Volume group ---
      VG Name               vg_webserver
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      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               39.51 GiB
      PE Size               4.00 MiB
      Total PE              10114
      Alloc PE / Size       10114 / 39.51 GiB
      Free  PE / Size       0 / 0
      VG UUID               qo4qm0-yTZc-TVzt-Ys0t-Ap2j-sH4X-rtMqPS
    
  5. 扩展物理卷:

    # vgextend vg_webserver /dev/sda3
      Volume group "vg_webserver" successfully extended
    
  6. 获得可用的“免费”空间:

    # vgextend vg_webserver /dev/sda3
      Volume group "vg_webserver" successfully extended
    
  7. 获取逻辑卷的信息:

    # lvdisplay
      --- Logical volume ---
      LV Path                /dev/vg_webserver/lv_root
      LV Name                lv_root
      VG Name                vg_webserver
      LV UUID                ayl9Ae-Y7nk-CVXG-c0G1-P4vx-wdlD-hEmXSO
      LV Write Access        read/write
      LV Creation host, time webserver.localhost, 2015-10-27 12:48:48 -0400
      LV Status              available
      # open                 1
      LV Size                35.65 GiB
      Current LE             9126
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
    
      --- Logical volume ---
      LV Path                /dev/vg_webserver/lv_swap
      LV Name                lv_swap
      VG Name                vg_webserver
      LV UUID                vwXfta-tGr0-kQFI-B2vF-L4gT-skE5-yb5qXA
      LV Write Access        read/write
      LV Creation host, time webserver.localhost, 2015-10-27 12:48:52 -0400
      LV Status              available
      # open                 1
      LV Size                3.86 GiB
      Current LE             988
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
    
  8. 扩展逻辑卷:

    # lvextend -L+40G /dev/vg_webserver/lv_root
      Insufficient free space: 10240 extents needed, but only 10239 available
    

我得到了上面的错误,我不知道从那里去哪里以及如何解决这个问题,有什么可以帮助我的吗?我做错了什么,我正在运行的问题背后的逻辑解释是什么?

注意:我已阅读此内容,但我不确定如何撤消我已经做出的所有更改,以及此信息是否是要遵循的路径

更新

这里要求的是以下命令的输出:

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_webserver
  PV Size               39.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              10114
  Free PE               0
  Allocated PE          10114
  PV UUID               mwFIHY-mwwJ-b3uk-PkbP-7JXp-Vp2t-foCZtt

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg_webserver
  PV Size               40.00 GiB / not usable 1.38 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              10239
  Free PE               0
  Allocated PE          10239
  PV UUID               tWg4Oj-ZknB-mefb-Ggy9-V8Cu-C7S2-OvO5aU

# vgdisplay
  --- Volume group ---
  VG Name               vg_webserver
  System ID
  Format                lvm2
  Metadata Areas        2
  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                2
  Act PV                2
  VG Size               79.50 GiB
  PE Size               4.00 MiB
  Total PE              20353
  Alloc PE / Size       20353 / 79.50 GiB
  Free  PE / Size       0 / 0
  VG UUID               qo4qm0-yTZc-TVzt-Ys0t-Ap2j-sH4X-rtMqPS

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_webserver/lv_root
  LV Name                lv_root
  VG Name                vg_webserver
  LV UUID                ayl9Ae-Y7nk-CVXG-c0G1-P4vx-wdlD-hEmXSO
  LV Write Access        read/write
  LV Creation host, time webserver.localhost, 2015-10-27 12:48:48 -0400
  LV Status              available
  # open                 1
  LV Size                75.64 GiB
  Current LE             19365
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg_webserver/lv_swap
  LV Name                lv_swap
  VG Name                vg_webserver
  LV UUID                vwXfta-tGr0-kQFI-B2vF-L4gT-skE5-yb5qXA
  LV Write Access        read/write
  LV Creation host, time webserver.localhost, 2015-10-27 12:48:52 -0400
  LV Status              available
  # open                 1
  LV Size                3.86 GiB
  Current LE             988
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
virtual-machines
  • 4 4 个回答
  • 54682 Views

4 个回答

  • Voted
  1. Best Answer
    shodanshok
    2015-11-03T13:38:01+08:002015-11-03T13:38:01+08:00

    我认为工作中的一些四舍五入会导致你lvextend失败​​。

    尝试这个:lvextend /dev/vg_webserver/lv_root -l+100%FREE

    上述命令将要求系统将所有可用空间分配给选定的逻辑卷,而不要求特定大小。

    • 17
  2. Debashis Prusty
    2018-05-03T04:48:52+08:002018-05-03T04:48:52+08:00

    您可以运行获取所有可用空间:lvextend /dev/vg_webserver/lv_root -l+100%FREE

    之后您需要运行: 如果是 xfs:xfs_growfs <partition> 对于 ext4:resize2fs <partition>

    • 1
  3. junior ruby developer
    2020-11-03T02:40:55+08:002020-11-03T02:40:55+08:00

    您可以使用-l带有可用范围数量的选项:

    sudo lvextend  -l+10239 /dev/vg_webserver/lv_root
    

    引自man lvextend:

       -l|--extents [+]Number[PERCENT]
    

    以逻辑范围指定 LV 的新大小。
    --size 和 --extents 选项是指定大小的替代方法。当 RAID 级别需要冗余数据时,所使用的物理盘区总数会更多。另一种语法允许将大小间接确定为相关 VG、LV 或 PV 集大小的百分比。后缀 %VG 表示 VG 的总大小,后缀 %FREE 表示 VG 中剩余的可用空间,后缀 %PVS 表示指定 PV 中的可用空间。对于快照,大小可以表示为原始 LV 总大小的百分比,后缀为 %ORIGIN(100%ORIGIN 为整个源提供空间)。当以百分比表示时,大小定义了新 LV 中逻辑盘区数的上限。直到命令完成后才能确定新 LV 中逻辑盘区的精确数量。

    • 0
  4. Vamshi
    2021-08-19T21:58:30+08:002021-08-19T21:58:30+08:00

    更好的方法是:

    #vgdisplay
    
      --- Volume group ---
      VG Name               vg2
      System ID             
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  2
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                1
      Open LV               1
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               <2.00 GiB
      PE Size               4.00 MiB
      Total PE              511
      Alloc PE / Size       256 / 1.00 GiB
      Free  PE / Size       255 / 1020.00 MiB
      VG UUID               aY23Dw-zS2G-Ng0k-KwBr-G3mD-uQhk-VxNIpi
    

    寻找“免费 PE / 尺寸”。在这种情况下为 1020M。这样做:

    #lvresize -L +1020M "device"
    
    • 0

相关问题

  • Xen - 无法创建域,因为“无法连接 vdb”

  • 我可以安全地为我的虚拟机使用什么范围的 MAC 地址?

  • 将 VMDK 转换为 VHD 后启动虚拟机时出现问题

  • 在 VM 中运行 Fedora 目录服务器

  • 如何提高 Hyper-V 性能

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