vmware調整磁碟空間

來源:互聯網
上載者:User

1、登入vcenter調整硬碟大小
2、建立分區
fdisk /dev/sda
Command (m for help): m
Command (m for help): n
Partition number (1-4): 3
First cylinder (2611-5221, default 2611):  //指定開始位置,直接斷行符號
Last cylinder or +size or +sizeM or +sizeK (2611-5221, default 5221):  //結束位置,直接斷行符號

Command (m for help): w

3、更改新加的空間為LVM
fdisk /dev/sda
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e //8e就是lvm格式
Command (m for help): w

4、格式化加的分區
reboot
mkfs -t ext4 /dev/sda3
如果上述命令出錯,運行partprobe即可。
此時已經建立了一個/dev/sda3的分區,可以掛載到新的分區來使用,也可以擴充到原有的分區。

5、擴充已有分區
 lvs
 pvcreate /dev/sda3
vgextend vg_root /dev/sda3 //其中VolGroup是當前需要擴充的lvm組名,可以通過df -h查看

[root@localhost /]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  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               19.50 GiB
  PE Size               4.00 MiB
  Total PE              4992
  Alloc PE / Size       3970 / 15.51 GiB
  Free  PE / Size       1022 / 3.99 GiB //這個就是新增加的空間
  VG UUID               pml97y-LTLm-iZ1F-DP9H-3eT3-gLZ2-f9TB7a
  
lvextend -L +11.9G /dev/mapper/vg_root-lv_root /dev/sda3 //擴充的空間要小於閒置空間
e2fsck -f /dev/mapper/vg_root-lv_root  //檢查
resize2fs /dev/mapper/vg_root-lv_root //重新整理一下分區,告訴系統磁碟分割有所調整

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.