2

When I run the command diskutil list, I get the following output:

enter image description here

I was shocked to see that there was a partition on my internal drive called Linux Filesystem. I would appreciate it if someone could inform me as to what both the Linux Filesystem volume is doing on disk0 and what the VM volume is on disk1.

For some clarification: I did used to have a VirtualBox machine on my Mac running Linux but I thought that everything was correctly uninstalled. Therefore, I would like to remove any possible remnants which have persisted.

Even if these are the result of the VirtualBox, I do not understand how the Linux Filesystem volume has been integrated into disk0; surely it should've been contained by VirtualBox?

3

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
  • 1
    Hey there, thanks for your answer! I understand that I have marked the answer as solved but I admit that I was hasty to do so as after running the first command without a problem, I ran the second one around an hour ago and the second I ran it, my computer froze and is unresponsive to the extent that the 2016 haptic mousepad isn't even clicking anymore. Is this normal? Would I be okay to force shutdown my computer if this persists for much longer or does this risk permanent damage? – Tom Aug 2 '18 at 10:17
  • 1
    Just an update: After about 20 minutes more of the computer being completely unresponsive, I decided to force shut it down (holding the power button down for a while) and then restarted it and it seems to be okay. I ran diskutil list again and whilst the Linux Filesystem partition has disappeared, I am unsure as to whether the second command you wrote has succeeded. See here for a screenshot of what shows when I run diskutil list now. – Tom Aug 2 '18 at 10:41
  • 1
    @JohnGreeny It looks like the second command didn't work, since disk0s2 is still just 250.0 GB (it should expand to 250.6 or .7). You can try the second command again, but before you do I'd recommend making sure you have a good backup un case something goes weird. Actually, I recommend making sure you have a good backup even when you're not about to adjust the partitions. – Gordon Davisson Aug 3 '18 at 1:23
  • 1
    @GordonDavisson I did suspect that the second command didn't go through (mainly because I forced the shutdown. I have a feeling I won't bother running the second command again as it's only a few hundred MB and I'd rather lose that than my time trying to fix any problems. Luckily, regularly keep TimeMachine backups should I ever need them. Thanks for your comment! – Tom Aug 3 '18 at 2:34
  • 1
    @John Greeny: I updated my answer. – David Anderson Aug 3 '18 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .