CentOS下VPS以LVM方式掛載擴充硬碟分區

來源:互聯網
上載者:User

CentOS下VPS以LVM方式掛載擴充硬碟分區

Linux分區為LVM,擴充硬碟共分三個階段:建立分區——建立PV——擴充VG——擴充LV
單個硬碟如需分為多個邏輯分區請建立分區,如使用整個硬碟可略過此步驟:

1234567891011121314151617
#http://www.haiyun.mefdisk -l #查看需要掛載的分區,一般為/dev/xvdbfdisk /dev/xvdb Command (m for help): n #建立分區Command action  e   extended #擴充分區p   primary partition (1-4) #主要磁碟分割p #輸入p選擇建立為主要磁碟分割Partition number (1-4): 1 #主要磁碟分割編號First cylinder (1-3263, default 1): #分區起始位置,預設即可Last cylinder, (1-3263, default 3263): #結束位置,預設即可Command (m for help): t  #指定分區格式Hex code (type L to list codes): 8e #設定為LVMChanged system type of partition 1 to 8e (Linux LVM)Command (m for help): w  #儲存#The partition table has been altered!quit #退出

建立PV,並擴充到VolGroup00中
123456
partprobe #重新讀取分區表pvcreate /dev/xvdb1 #建立PVvgscan #顯示當前VG#Reading all physical volumes.  This may take a while...#Found volume group "VolGroup00" using metadata type lvm2 #VG名稱為VolGroup00vgextend VolGroup00 /dev/xvdb1 #擴充PV到PG中

查看VolGroup00剩餘PE數量,為擴充LV準備
1234
vgdisplay #--- Volume group ---#VG Name               VolGroup00 #VG名稱#Free  PE / Size      2553 / 79.78 GB #2553為剩餘PE數

查看要擴充的LV
123
lvscan #列出LV,容量較大的為要擴充的LV#ACTIVE            '/dev/VolGroup00/LogVol00' [10.53 GB] inherit #要擴充的LV#ACTIVE            '/dev/VolGroup00/LogVol01' [256.00 MB] inherit

擴充LV
12
lvresize -l +2553 /dev/VolGroup00/LogVol00 #2553為VG內剩餘PE數resize2fs /dev/VolGroup00/LogVol00

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.