# Manage disk space

Grow a machine's disk, see what each machine takes, and keep enough free space for machines to run.

## Grow a disk

A disk can grow but can't shrink.

1. Shut down the machine.
2. Select it, choose **Machine > Machine Settings**, then click **Storage**.
3. Click **Grow Disk**, enter a size, and confirm.
4. Start the machine. Linux, Windows, and macOS extend their system volume to fill the disk.

```sh
osmates vm set dev --disk 96G
```

Storage settings and `osmates vm info` show a growth that waits, and why. If it fails, click **Try Again at Next Start**. Snapshots keep the size they were taken with.

## See what machines take

Select a machine, click **Overview**, and look at **Storage**. **Total on This Mac** counts the whole machine, with snapshots, saved memory, and firmware. **Snapshots** shows their share.

The figures count blocks that files share, as Finder and `du` do.

Usage in the Overview shows CPU, power, and memory while the machine runs. A machine over its memory budget for about a minute sends a notification. `osmates vm info` shows the same figures.

## Keep room on your Mac

These limits apply to the volume that holds your machines, and the 14 GiB notification watches your startup disk only. Finder's free space can be higher, because it counts purgeable space.

| Free space | What happens |
|---|---|
| Under 14 GiB | A notification, with a sound |
| Under 6 GiB | Starts, clones, snapshots, and `osmates run` are refused, with how much to free |
| About 4 GiB | Linux and macOS machines pause, and guest requests are refused |
| None | Windows machines pause, and guest requests fail |

A paused Linux or macOS machine continues by itself once about 6 GiB is free for a few seconds. A Windows machine continues once there's room, with its programs intact. Shut Down still works, but `vm resume` can't end a pause for space.

To free space on your startup disk, [move machines to another drive](https://osmates.com/docs/volumes#move-a-machine). Space a Windows guest deletes returns to your Mac through trim, once no snapshot or clone shares those blocks. ExFAT and FAT volumes can't take it back.

## Compact a fragmented disk

Snapshots and clones pause a running machine while its disk is copied. A fragmented disk makes that pause longer, up to about 20 seconds for a Windows disk used for months. A busy Windows machine [can still stall](https://osmates.com/docs/known-issues#windows-stalls-around-snapshots).

1. Shut down the machine.
2. Choose **Machine > Compact Disk**, or click **Compact Disk** in the Overview's Storage section.
3. Follow the progress in the Overview. Click **Cancel** to stop.

```sh
osmates vm compact dev
```

Compacting needs room for the disk's data. With less than 20 GiB left over, the disk can stay fragmented, and you see a warning first.
