2017/12/04

VMware - Resize HDD by LVM on Ubuntu 14.04

1. Set your VM OS HDD 20GB to 40GB
2. Boot your VM and use SSH login
3. Follow the command as below:
  
    sudo su
    parted
    mkpart primary 20GB 40GB
    print
    quit
    reboot
  
    sudo su
    lvm
    pvcreate /dev/sda3
    pvs
    quit
  
    pvscan
    vgextend ubuntu1404-vg /dev/sda3
  
    pvscan
    ls /dev/ubuntu1404-vg
    df -h
  
    lvextend -L +20G /dev/ubuntu1404-vg/root
    resize2fs /dev/ubuntu1404-vg/root
    df -h