You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

APFS VM Volume taking 320 GB of disk space

I noticed my disk usage creep up for no apparent reason for the past few months until I started constantly running out of disk space on my M1 Pro.


Upon further inspection a Volume called "VM" was taking 319,04 GB of space.




$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:             Apple_APFS_ISC Container disk1         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk3         494.4 GB   disk0s2
   3:        Apple_APFS_Recovery Container disk2         5.4 GB     disk0s3


/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +494.4 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            9.1 GB     disk3s1
   2:              APFS Snapshot com.apple.os.update-... 9.1 GB     disk3s1s1
   3:                APFS Volume Preboot                 4.7 GB     disk3s2
   4:                APFS Volume Recovery                794.5 MB   disk3s3
   5:                APFS Volume Data                    119.0 GB   disk3s5
   6:                APFS Volume VM                      319.0 GB   disk3s6


$ df -h
Filesystem       Size   Used  Avail Capacity iused     ifree %iused  Mounted on
/dev/disk3s1s1  460Gi  8.5Gi   39Gi    18%  356093 406123080    0%   /
devfs           204Ki  204Ki    0Bi   100%     704         0  100%   /dev
/dev/disk3s6    460Gi  297Gi   39Gi    89%       0 406123080    0%   /System/Volumes/VM
/dev/disk3s2    460Gi  4.3Gi   39Gi    11%     831 406123080    0%   /System/Volumes/Preboot
/dev/disk3s4    460Gi   29Mi   39Gi     1%      43 406123080    0%   /System/Volumes/Update
/dev/disk1s2    500Mi  6.0Mi  480Mi     2%       1   4910400    0%   /System/Volumes/xarts
/dev/disk1s1    500Mi  6.2Mi  480Mi     2%      28   4910400    0%   /System/Volumes/iSCPreboot
/dev/disk1s3    500Mi  3.5Mi  480Mi     1%      51   4910400    0%   /System/Volumes/Hardware
/dev/disk3s5    460Gi  111Gi   39Gi    75% 4205181 406123080    1%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0         0  100%   /System/Volumes/Data/home


At first I thought it was just swap, but activity monitor and /System/Volumes/VM show no swap being used at all.


$ ls -alh /System/Volumes/VM
total 0
drwxr-xr-x   2 root  wheel    64B May  8 15:00 .
drwxr-xr-x  14 root  wheel   448B Apr  1 18:46 ..



Restarting, running first aid in recovery mode, nothing seems to shrink the VM volume.


Please assist, would love to avoid having to reinstall Mac OS 🙏

MacBook Pro (M1, 2020)

Posted on May 8, 2023 7:24 AM

Reply
Question marked as Top-ranking reply

Posted on May 15, 2023 7:38 AM

When First Aid is unable to repair an APFS volume, then you will need to perform a clean install & restore from a backup. Since you have an Apple Silicon Mac, you have two methods to do erase the system & reinstall macOS.



The first option is the easiest & best if you have access to another Mac running macOS 12.4+ since making a mistake with Disk Utility may require you to then use the first option.


FYI, running First Aid on the Container first is perfectly fine since First Aid will automatically run a scan on each volume within that Container. Besides, if there is an issue with the Container, then hopefully the scan will repair the Container so that it helps with scanning the volumes inside the Container. In addition, every APFS volume within a Container shares the same resources and are not truly separate anyway.

Similar questions

10 replies
Question marked as Top-ranking reply

May 15, 2023 7:38 AM in response to anttiviljami

When First Aid is unable to repair an APFS volume, then you will need to perform a clean install & restore from a backup. Since you have an Apple Silicon Mac, you have two methods to do erase the system & reinstall macOS.



The first option is the easiest & best if you have access to another Mac running macOS 12.4+ since making a mistake with Disk Utility may require you to then use the first option.


FYI, running First Aid on the Container first is perfectly fine since First Aid will automatically run a scan on each volume within that Container. Besides, if there is an issue with the Container, then hopefully the scan will repair the Container so that it helps with scanning the volumes inside the Container. In addition, every APFS volume within a Container shares the same resources and are not truly separate anyway.

May 9, 2023 12:48 PM in response to James Brickley

Here's what "Macintosh HD volumes" looks like.



Are you running any virtual machines, docker containers, etc? What are the contents of /System/Volumes/VM/ ?


Just a couple of swapfiles:


$ ls -alh /System/Volumes/VM/
total 4194304
drwxr-xr-x   4 root  wheel   128B May  9 19:23 .
drwxr-xr-x  14 root  wheel   448B Apr  1 18:46 ..
-rw-------   1 root  wheel   1.0G May  8 23:02 swapfile0
-rw-------   1 root  wheel   1.0G May  8 23:14 swapfile1


I do run Docker for Desktop, but even stopping it doesn't stop the VM volume growing. Here's how Activity Monitor Disk tab looks like:

May 14, 2023 11:03 AM in response to James Brickley

Launched into safe mode, waited a few hours but the problem just keeps slowly getting worse.


Even tried running first aid in recovery, but it would always fail with an error saying "error: unable to perform deferred repairs without full space verification"


Nothing seems to shrink the VM volume and I'm getting desperate. :/


Can't think of doing anything else other than backing up my user directory on an external drive and attempt to wipe Mac OS.


May 8, 2023 7:35 AM in response to anttiviljami

In Disk Utility highlight 'Macintosh HD volumes' and click the View pulldown menu and turn on Show APFS Snapshots.


If you have Time Machine enabled it will create hourly snapshots to the local M1 Pro internal disk. When you connect to the Time Machine drive it will backup those snapshots and clear then in 24-48 hours. If you don't connect the Time Machine drive regularly, you may find these snapshots piling up.


Snapshots do not normally take disk space until you make changes to the internal disk. If you delete things on the internal disk then the snapshots will increase in size as they are now holding that deleted data.


It is NOT recommended to delete Time Machine snapshots as it could result in data loss in your backup. However, there may be other types of snapshots that have yet to be deleted. Once you display the snapshots look for anything that is not named like this, 'com.apple.TimeMachine.2023-05-07-103811.local'. Depending on what the odd snapshots are you can likely delete them in Disk Utility. Just don't delete the Time Machine ones.


If it's all just Time Machine snapshots, then either connect to the Time Machine drive and allow it to backup those snapshots or consider turning off Time Machine altogether. There are alternatives such as Carbon Copy Cloner / SuperDuper, cloud backup such as Backblaze, and cloud storage providers.

May 8, 2023 10:12 AM in response to anttiviljami

You highlighted the 'Macintosh HD snapshot' instead of 'Macintosh HD volumes' on the left sidebar. Make sure you don't have any snapshots on the other one.


You do have the initial single snapshot comprised of the read only System volume, macOS boots from that snapshot.


Are you running any virtual machines, docker containers, etc? What are the contents of /System/Volumes/VM/ ?


May 9, 2023 4:38 PM in response to anttiviljami

The /System/Volumes/VM is an APFS Volume within the Container. That means it shares the free space with the other volumes in the Container. The size of a volume may fluctuate in relation to the other volumes in the container. There's also a lot of system managed purgeable files which will be cleared when necessary.


It's possible that your VM volume grew due to swap need from running Docker containers and has yet to shrink back. Disk Utility, Finder and command line tooling are not exactly accurate in their depiction of free space. Another gotcha are sparse files. The reason I mentioned snapshots first was because it's usually a bunch of snapshots piling up. APFS Snapshots are for the entire volume so if you have multiple snapshots due to Time Machine and then you are clearing disk space by deleting a lot of things. Then the snapshot actually grows in size. Once the snapshot is backed up to Time Machine it will free the space within a couple of days.


Have you rebooted lately? I would also try booting into Safe Mode which on Intel you hold the Shift button while powering on. On Apple Silicon you hold the power button while powering on until you reach the Startup Options screen. Then click once on Macintosh HD and hold shift key and the button changes from Continue to Continue in Safe Mode. Let it boot into Safe Mode (you'll be asked to login twice) and when you reach the desktop, go take a break for about 15min and then restart normally when you return. Then re-examine your volumes and their sizes. Safe Mode runs a bunch of system maintenance tasks and it might trigger a cleanup of the disk as well.


https://eclecticlight.co/2022/12/30/free-space-on-an-apfs-volume-is-an-illusion/


Read the above and note that Sparse Files are used by virtual machines and likely Docker. Have you been moving virtual machines or docker containers around? Backing them up, etc.? If you aren't very careful, those sparse files can explode to their maximum size.


It's far more complex than you think...

https://eclecticlight.co/2023/04/27/where-does-macos-get-its-volume-free-space-figures-from/


You might just need to step back and not worry about it and when you hit a tipping point which requires free space changes, then macOS should automatically take care of business by purging and dynamically adjusting the APFS Volumes in the container.


APFS VM Volume taking 320 GB of disk space

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.