2021-04-05 09:31:32 -04:00
<!--
Title: How to use Time Machine and APFS snapshots on macOS
Description: Learn how to use Time Machine and APFS snapshots on macOS.
Author: Sun Knudsen < https: / / github . com / sunknudsen >
Contributors: Sun Knudsen < https: / / github . com / sunknudsen >
Reviewers:
Publication date: 2021-04-02T17:40:53.608Z
Listed: true
2023-09-06 19:23:39 -04:00
Pinned:
2021-04-05 09:31:32 -04:00
-->
# How to use Time Machine and APFS snapshots on macOS
2022-10-31 08:43:01 -04:00
[](https://www.youtube.com/watch?v=PY2gzNrK9Wc "How to use Time Machine and APFS snapshots on macOS")
2021-04-06 16:45:03 -04:00
2021-04-05 09:31:32 -04:00
## Time Machine setup guide
### Step 1: exclude folders from Time Machine
> Heads-up: excluded folders vary depending on use case.

### Step 2: format Time Machine disk as “Mac OS Extended (Journaled, Encrypted)” using “Disk Utility”
> WARNING: DATA ON TIME MACHINE DISK WILL BE PERMANENTLY DELETED.

### Step 3: enable “Encrypt Backup Disk” and click “Use as Backup Disk”

### Step 4: confirm encryption is enabled and enable “Show Time Machine in menu bar”

Encrypted
👍
2022-04-09 11:29:18 -04:00
---
2021-04-05 09:31:32 -04:00
## Time Machine usage guide
### Create backup
Click “Time Machine” menu bar icon and then “Back Up Now” or run `tmutil startbackup` .
### Delete specific backup
Heads-up: use `tmutil listbackups` to list backups.
2021-04-05 16:48:41 -04:00
```console
$ sudo tmutil delete "/Volumes/LaCie/Backups.backupdb/Sun’ s MacBook Pro/2021-04-05-161636"
Deleting: /Volumes/LaCie/Backups.backupdb/Sun’ s MacBook Pro/2021-04-05-161636
Deleted (43.5M): /Volumes/LaCie/Backups.backupdb/Sun’ s MacBook Pro/2021-04-05-161636
Total deleted: 43.5M
2021-04-05 09:31:32 -04:00
```
2021-04-05 16:48:41 -04:00
Total deleted: 43.5M
👍
2022-04-09 11:29:18 -04:00
---
2021-04-05 09:31:32 -04:00
## APFS snapshot usage guide
### Create local APFS snapshot
2021-04-05 16:48:41 -04:00
```console
$ tmutil localsnapshot
Created local snapshot with date: 2021-04-05-162425
2021-04-05 09:31:32 -04:00
```
2021-04-05 16:48:41 -04:00
Created local snapshot with date: 2021-04-05-162425
👍
2021-04-05 09:31:32 -04:00
### List local APFS snapshots
2021-04-05 16:48:41 -04:00
```console
$ tmutil listlocalsnapshots /
Snapshots for volume group containing disk /:
com.apple.TimeMachine.2021-04-05-162416.local
com.apple.TimeMachine.2021-04-05-162425.local
2021-04-05 09:31:32 -04:00
```
### Mount local read-only APFS snapshot
2022-02-16 16:07:46 -05:00
> Heads-up: use `umount /tmp/snapshot` to unmount snapshot.
2021-04-05 09:31:32 -04:00
2022-02-16 16:07:46 -05:00
> Heads-up: replace `com.apple.TimeMachine.2021-04-05-162416.local` with snapshot from [List local APFS snapshots](#list-local-apfs-snapshots).
2021-04-05 09:31:32 -04:00
```shell
mkdir -p /tmp/snapshot
2021-04-05 16:48:41 -04:00
mount_apfs -s com.apple.TimeMachine.2021-04-05-162416.local / /tmp/snapshot
2021-04-05 09:31:32 -04:00
open /tmp/snapshot
```
### Restore local APFS snapshot
2021-06-21 09:07:17 -04:00
Restart computer and press < kbd > cmd+r< / kbd > to boot to recovery mode.
2021-04-05 09:31:32 -04:00
Select “Restore From Time Machine Backup”, then “Macintosh HD”, choose local snapshot, click “Continue” and “Continue” again to confirm.
### Delete specific local APFS snapshot
> Heads-up: use `tmutil listlocalsnapshotdates` to list local snapshot dates.
2021-04-05 16:48:41 -04:00
```console
$ tmutil deletelocalsnapshots 2021-04-05-162416
Deleted local snapshot '2021-04-05-162416'
2021-04-05 09:31:32 -04:00
```
2021-04-05 16:48:41 -04:00
Deleted local snapshot '2021-04-05-162416'
👍
2021-04-05 09:31:32 -04:00
### Delete all local APFS snapshot
2021-04-05 16:48:41 -04:00
```console
$ tmutil deletelocalsnapshots /
Deleted 1 Time Machine local snapshots for volume group containing disk '/'
com.apple.TimeMachine.2021-04-05-162425.local
2021-04-05 09:31:32 -04:00
```
2021-04-05 16:48:41 -04:00
Deleted 1 Time Machine local snapshots for volume group containing disk '/'
👍