關於linux下的lv擴充套件
阿新 • • 發佈:2018-11-14
一、擴充套件VMWare硬碟空間
關閉Vmware 的 Linux系統,這樣,才能在VMWare選單中設定:
VM -> Settings... -> Hardware -> Hard Disk -> Utilities -> Expand
我擴充套件了一個,sda由原來的100G擴充套件到了151G 另外新增加了一個塊50G,是sdb
二、對新增加的硬碟進行分割槽、格式化
詳細內容略,就是fdisk /dev/sda n p 回車 回車 t 8e .... fdisk /dev/sdb n p ....
沒找到盤就重啟一下系統
mkfs.ext3 /dev/sdb1
三、新增新LVM到已有的LVM組,實現擴容
進入lvm管理
lvm> pvcreate /dev/sda3 這是初始化剛才的分割槽,必須的
lvm> vgextend vg_dc01 /dev/sda3 將初始化過的分割槽加入到虛擬卷組vg_dc01
lvm>lvextend -L +49.9G /dev/vg_dc01/lv_root 擴充套件已有卷的容量(29.9G這個數字在後面解釋)
lvm>pvdisplay 檢視卷容量,這時你會看到一個很大的捲了
lvm>quit 退出
以上只是卷擴容了,下面是檔案系統的真正擴容,輸入以下命令:
resize2fs /dev/centos/root
不管用的話,用下面的命令:
xfs_growfs /dev/centos/root
-----------------------------------------------------------
命令:pvdisplay 結果如下: --- Physical volume --- PV Name /dev/sda3 VG Name centos PV Size 50.00GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 12799 Free PE 0 Allocated PE 12799 PV UUID M4BcNF-yDVT-HTGP-zJRn-86Iz-AhS1-FYSOhD --- Physical volume --- PV Name /dev/sdb1 VG Name centos PV Size <50.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 12799 Free PE 0 Allocated PE 12799 PV UUID 88zL8t-52ep-V0Z0-XWhA-9Xfr-RDGC-dXFfoW 命令: [[email protected] ~]# vgdisplay 結果如下: --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 3 Metadata Sequence No 9 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 3 Act PV 3 VG Size <198.99 GiB PE Size 4.00 MiB Total PE 50941 Alloc PE / Size 50941 / <198.99 GiB Free PE / Size 0 / 0 VG UUID wJXSjG-9DZc-Ug11-rbfa-9GdJ-SZ2e-BGnP0j 命令: [[email protected] ~]# lvdisplay 結果如下: --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID TnlYlK-oivn-E64n-o1gw-v7uF-3u5O-BA0Vw8 LV Write Access read/write LV Creation host, time localhost, 2018-04-28 13:17:22 +0800 LV Status available # open 1 LV Size <150.00 GiB Current LE 38399 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0