Unknown partitions in diskutil
While it is possible to create a virtual machine that uses a physical partition, this is only done by experienced VirtualBox users. In any case, since you have removed your Linux virtual machine, then you probably do no longer need this partition. If you open a Terminal application window and enter the following commands, this unneeded partition will be removed and the free space added back to macOS.

sudo diskutil erasevolume free none disk0s3
sudo diskutil apfs resizecontainer disk0s2 0


The VM volume on disk1 has nothing to do with VirtualBox. The letters VM stand for virtual memory. This is the swap space used by macOS. The macOS operating system, installed on your Mac, uses 4 different volumes to operate. These volumes are stored in the partition named disk0s2 on your physical drive disk0.  This partition was given the container name disk1. The name disk1 implies a drive, but this is just the naming convension chosen by Apple. So disk1 is not drive, it is a container for the 4 volumes used by macOS.

Advice if sudo diskutil apfs resizecontainer disk0s2 0 fails.

This would indicate your a problem with the software stored on your drive. You should verify the drive. The Disk Utility with High Sierra no longer allows you to verify your drive. This must be done by entering commands in a Terminal application window. Also, it would be preferable this be done from either macOS Recovery over the Internet or a bootable installer for macOS. The commands shown below can be used to verify the drive. You can determine, if a verify command was successful, by looking for either an OK message or an exit code of 0.


  Note: None of these commands will change your drive.


diskutil verifydisk disk0
diskutil verifyvolume disk0s2
diskutil unmountdisk disk1
diskutil verifyvolume disk1s1
diskutil verifyvolume disk1s2
diskutil verifyvolume disk1s3
diskutil verifyvolume disk1s4
diskutil mountdisk disk1


The purpose of the sudo diskutil apfs resizecontainer disk0s2 0 command is to add back most free space found immediately after the container disk0s2 partition back to the partition. The command given below can print out the space allocated to your drive.


  Note: This command will not change your drive.


gpt -r show /dev/disk0



  Note: This command needs to be entered while in one of the Recovery modes given above.


For example, the output shown below shows free space after the partition with index of 2.

      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  488281248      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  488690888    1543494         
  490234382         32         Sec GPT table
  490234414          1         Sec GPT header


After entering the sudo diskutil apfs resizecontainer disk0s2 0 command, the output would appear as shown below.

    start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  489824736      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  490234376          6         
  490234382         32         Sec GPT table
  490234414          1         Sec GPT header