Expanding the disk size for an Ubuntu guest on VMware ESXi

Stop the guest VM.

Change the attached disk size in VM settings:

Attach a gparted iso or alternatively you can attach the original Ubuntu desktop ISO that you originally installed from.

Change the Boot Option for your VM to boot into the guest VM’s BIOS (‘Force BIOS setup’) to change the boot order with the cdrom first (by default it won’t boot from the attached cdrom as it’s set to only boot from cdrom if the attached disk does not boot first):

With the gparted iso or Ubuntu desktop install iso attached, restart the VM, and then run gparted.

Use gparted to expand the partition into the free space.

Once resized, reboot the Unbuntu guest (reset the boot order or unattach the cdrom iso image).

Use pvdisplay to get the Volume Group name

$ sudo pvdisplay

  --- Physical volume ---

  PV Name               /dev/sda5

  VG Name               ubuntu-vg

  PV Size               39.76 GiB / not usable 2.00 MiB

  Allocatable           yes (but full)

  PE Size               4.00 MiB

  Total PE              10178

  Free PE               0

  Allocated PE          10178

Use vgextend with the volume group name and physical disk name to extend:

sudo vgextend ubuntu-vg /dev/sda5

Use lvextend with param “-l+100%FREE” to expand the logical volume:

sudo lvextend -l+100%FREE /dev/ubuntu-vg/root

Now use resize2fs:

sudo resize2fs /dev/mapper/ubuntu--vg-root

Done!

More info on using gparted here. Info on resizing LVM disks in this article here.

Enabling Docker service to listen on a port

By default the Docker service listens on a local socket. If you want to access the Docker service api remotely, you need to configure the service to listen on a port as well.

On Ubuntu 16.04, edit /lib/systemd/system/docker.service and change this line:

ExecStart=/usr/bin/dockerd -H fd://

to

ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376

Reload the systemd config:

sudo systemctl daemon-reload

and restart the service:

sudo systemctl restart docker.service

More info here.

Ubuntu 14.04 Dockerd : unknown option dirperm1 on startup

Trying to start the Dockerd service on an Ubuntu 14.04 server I ran into ‘sudo service docker start’ hanging, and in the logs seeing this message:

Mar  4 17:12:07 vps kernel: [58270.204343] aufs au_opts_parse:1155:dockerd[12023]: unknown option dirperm1

Mar  4 17:12:49 vps kernel: [58311.799010] init: docker post-start process (12015) terminated with status 1

This is described in this post here and here.

In the Docker CE for Ubuntu instructions, there’a a note for installing additional aufs support for 14.04 here:

sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

Note the Docker CE for Ubuntu install docs say for 16.04:

For Ubuntu 16.04 and higher, the Linux kernel includes support for OverlayFS, and Docker CE uses the overlay2 storage driver by default.

In this particular case I had mistakenly setup this VM from a 14.04 template, and I really wanted to be running 16.04. With 16.04 and the latest Docker install per the installed steps here, I didn’t run into this issue.