增加音量

增加音量

當我重新啟動並嘗試使用時,我使用 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例如從磁碟區群組中刪除設備

相關內容