I use VirtualBox with an Ubuntu 16.04 virtual machine on OS X High Sierra. I've increased the size of my dynamic storage and restarted the virtual machine with the help of a live iso and ran gparted.
The two partitions that offer resizing when you right-click are / dev / sda1 and / dev / sda5, but the available space is not equal to the unallocated space … they are as follows:
enter the description of the image here
How to use the unallocated 40G space? An answer (1054352) first indicates increasing the size of the extended partition, but mine (sda2) does not have this option.