增加音量

增加音量

当我重新启动并尝试使用时,我使用 Gparted Live cd 来调整卷组和逻辑分区的大小,lvextend –l +100%FREE /dev/vda5我收到此消息:

  Path required for Logical Volume "–l"
  Please provide a volume group name
  Run `lvextend --help' for more information.

这是我pvslvs输出vgs

  VG       #PV #LV #SN Attr   VSize VFree
  d8dev-vg   1   2   0 wz--n- 9.76g 5.01g

  PV         VG       Fmt  Attr PSize PFree
  /dev/vda5  d8dev-vg lvm2 a--  9.76g 5.01g

  LV     VG       Attr      LSize    Pool Origin Data%  Move Log Copy%  Convert
  root   d8dev-vg -wi-ao---    3.75g
  swap_1 d8dev-vg -wi-ao--- 1020.00m

这是df -h输出

Filesystem      Size  Used Avail Use% Mounted on
udev            487M  4.0K  487M   1% /dev
tmpfs           100M  632K   99M   1% /run
/dev/dm-0       3.7G  3.2G  325M  91% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            498M  184K  497M   1% /run/shm
none            100M     0  100M   0% /run/user
/dev/vda1       236M   37M  188M  17% /boot
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/a5516e7a4136a510a3b6b388a57b266067cce4b2240db77a859910d3c741f988
shm              64M     0   64M   0% /var/lib/docker/containers/f5c852ead8bd3578b63fd5a259586c5a9c4b375b8505bb339e9f3c27cabc130f/shm
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/074360c189d2dae1477d9eeed419a86880355cab68c266155eb649aaee9e80ff
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/921ae5230e127989f8f12ecbd52a454965ed385531397fc46cfc5a82392ec876
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/eda6cf31040113c7216c4e07071596c724288071a94869b3606e90ea9fdc6034
shm              64M     0   64M   0% /var/lib/docker/containers/27d44748763ef03fea24464e11dde5498329ce438002812cc5168379825c5003/shm
shm              64M     0   64M   0% /var/lib/docker/containers/7a79506bb707843b3eea9d062f934e5f53a8ca72326a497559b0cd391f5f271b/shm
shm              64M     0   64M   0% /var/lib/docker/containers/78fbe6d2bccc7d29f08051a9ab4d2f02b0794fd7a95e28446e208184fa84b149/shm
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/d06efbeda0bcf8352e88aa078d23caf3855ae14dbd9100980c3431dfce5870a7
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/10dd1eb657163fb314d1fd5e7951645e957365b9760b46846491c8374e106039
shm              64M     0   64M   0% /var/lib/docker/containers/90a5ef4a9a761778fbad4bd052426263f5fe14d5248aaf7cdecd87013fb2c706/shm
shm              64M     0   64M   0% /var/lib/docker/containers/dd20465dc2764916efb2d29887dfe76d3bf8cf823b9e032d7ec399aa40dc083f/shm
none            3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/966dc571c622e09757ceebbfefd540a6ab4b27922b2fbab8615277e343a67357
shm              64M     0   64M   0% /var/lib/docker/containers/312cceb4eb20613ad493df37097ab47a204da19669c3aa065feb7fc9818c126c/shm

我尝试过这个命令

  lvextend –l +100%FREE /dev/vda5
  lvextend –l +100%FREE d8dev-vg
  lvextend –l +100%FREE /dev/root

但所有输出都相同

  Path required for Logical Volume "–l"
  Please provide a volume group name

编辑 :lvextend /dev/dm-0 /dev/vda5现在的lvs输出是:

  LV     VG       Attr      LSize    Pool Origin Data%  Move Log Copy%  Convert
  root   d8dev-vg -wi-ao---    8.76g
  swap_1 d8dev-vg -wi-ao--- 1020.00m

/dev/dm-0仍然很低:

Filesystem      Size  Used Avail Use% Mounted on
udev            487M  4.0K  487M   1% /dev
tmpfs           100M  632K   99M   1% /run
/dev/dm-0       3.7G  3.2G  325M  91% /

编辑2vgdisplaylvdisplay

  --- Volume group ---
  VG Name               d8dev-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  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               9.76 GiB
  PE Size               4.00 MiB
  Total PE              2498
  Alloc PE / Size       2498 / 9.76 GiB
  Free  PE / Size       0 / 0
  VG UUID               AGVHqT-IO1R-l3uB-AeN4-q62b-z33r-b4NwS7

  --- Logical volume ---
  LV Path                /dev/d8dev-vg/root
  LV Name                root
  VG Name                d8dev-vg
  LV UUID                qet8dK-Izh1-uJul-2T0R-rDyy-ONNH-Xwvs2h
  LV Write Access        read/write
  LV Creation host, time d8dev, 2016-05-19 08:17:01 -0700
  LV Status              available
  # open                 1
  LV Size                8.76 GiB
  Current LE             2243
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/d8dev-vg/swap_1
  LV Name                swap_1
  VG Name                d8dev-vg
  LV UUID                4mbhDG-PmAN-Fym3-yXSI-gRkd-owki-eYqWqj
  LV Write Access        read/write
  LV Creation host, time d8dev, 2016-05-19 08:17:01 -0700
  LV Status              available
  # open                 2
  LV Size                1020.00 MiB
  Current LE             255
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

DF-Th

Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  487M  4.0K  487M   1% /dev
tmpfs          tmpfs     100M  632K   99M   1% /run
/dev/dm-0      ext4      3.7G  3.2G  325M  91% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs     498M  184K  497M   1% /run/shm
none           tmpfs     100M     0  100M   0% /run/user
/dev/vda1      ext2      236M   37M  188M  17% /boot
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/a5516e7a4136a510a3b6b388a57b266067cce4b2240db77a859910d3c741f988
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/f5c852ead8bd3578b63fd5a259586c5a9c4b375b8505bb339e9f3c27cabc130f/shm
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/074360c189d2dae1477d9eeed419a86880355cab68c266155eb649aaee9e80ff
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/921ae5230e127989f8f12ecbd52a454965ed385531397fc46cfc5a82392ec876
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/eda6cf31040113c7216c4e07071596c724288071a94869b3606e90ea9fdc6034
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/27d44748763ef03fea24464e11dde5498329ce438002812cc5168379825c5003/shm
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/7a79506bb707843b3eea9d062f934e5f53a8ca72326a497559b0cd391f5f271b/shm
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/78fbe6d2bccc7d29f08051a9ab4d2f02b0794fd7a95e28446e208184fa84b149/shm
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/d06efbeda0bcf8352e88aa078d23caf3855ae14dbd9100980c3431dfce5870a7
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/10dd1eb657163fb314d1fd5e7951645e957365b9760b46846491c8374e106039
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/90a5ef4a9a761778fbad4bd052426263f5fe14d5248aaf7cdecd87013fb2c706/shm
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/dd20465dc2764916efb2d29887dfe76d3bf8cf823b9e032d7ec399aa40dc083f/shm
none           aufs      3.7G  3.2G  325M  91% /var/lib/docker/aufs/mnt/966dc571c622e09757ceebbfefd540a6ab4b27922b2fbab8615277e343a67357
shm            tmpfs      64M     0   64M   0% /var/lib/docker/containers/312cceb4eb20613ad493df37097ab47a204da19669c3aa065feb7fc9818c126c/shm

答案1

使用 LVM(逻辑卷管理器)时,您应该记住操作顺序是必须的。如果您不遵守该命令,您将面临丢失数据的风险。

如果您已经有PV(物理卷)和VG(卷组),则通过添加其他设备来扩展卷组会更容易。

要扩展卷组,例如,vg1您可以执行以下操作:

vgextend vg1 /dev/vda5

扩展卷组后,我们需要调整LV(逻辑卷)的大小

要扩展LV您可以使用以下内容

lvextend /dev/vg1/your_lv /dev/vda5 

此阶段仅扩展了逻辑卷,未扩展文件系统。

要扩展文件系统,您可以使用resize2fs后跟LV.例如:

resize2fs /dev/vg1/your_lv

注意:lvextend具有在后台-r调用并自动执行此操作的标志。resize2fs

总结以上内容:

  1. 扩展卷组
  2. 扩展逻辑卷
  3. 调整文件系统大小

要收缩文件系统(无法使用xfs),请按照以下步骤操作:

  1. 缩小文件系统
  2. 减小逻辑卷的大小
  3. /dev/vda5例如从卷组中删除设备

相关内容