Friday, August 04, 2017

Resizing Disk Space in Ubuntu Server v16.04.2 at VMware ESXi v6 Virtual Environment 【中文

【Problem】VM client's disk space is almost full, we must resize it.
【Solution】
  • VMware
    1. shutdown VM client
    2. Configuration >> Hard Disk 1 >> Disk Provisioning >> Provisioned Size >> enlarge
    3. start up VM client
  • use PuTTY/SSH connect to VM client
    • list all disk partitions
    • ls -al /dev/sda*
    • create a new disk partition



    • sudo fdisk /dev/sda
      • p >> show all partitions
      • n >> create a new partition
      • p >> select a physical partition
      • 3 >> create /dev/sda3
      • enter >> input start sector address
      • enter >> input end sector address
      • t >> transfer partition format into Linux LVM
      • 8e >> select partition format as Linux LVM
      • p  >> show all partition
      • w >> execute partition process and then exit
    • reboot system



    • sudo reboot --r 0
      • create physical volume



      • sudo pvcreate /dev/sda3
      • extend current Volume Group to physical volume, show VG Name, find Volume Group and VG Name, VG Name = Volume Group Name



      • sudo vgdisplay



      • sudo vgextend  ApaMoodle-pv /dev/sda3
      • extend primary Logical Volume, find LV Name, such as /dev/ApaMoodle-pv/root. Then extend the Logical Volume size (GBs).



      • sudo lvdisplay



      • sudo lvextend -L +250G  /dev/ApaMoodle-pv/root
      • adjust file system to latest allocated space



      • sudo resize2fs /dev/ApaMoodle-pv/root
      • check new file system size



      • sudo df -hT
      • reboot system again



      • sudo reboot --r 0
    【Reference】
    1. Fotis, "Resizing the disk space on Ubuntu Server VMs running on VMware ESXi 5," 20120909. Available: http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms-running-on-vmware-esxi-5






    No comments: