# Time Machine



https://www.macworld.com/article/220774/control-time-machine-from-the-command-line.html



Activer Time Machine:

```bash
$ tmutil enable
```

Désactiver Time Machine:

```bash
$ tmutil disable
```

Démarrer une sauvegarde:

```bash
$ tmutil startbackup
```

Stopper une sauvegarde:

```bash
$ tmutil stopbackup
```

Connaitre le répertoire de stockage de Time Machine:

```bash
$ tmutil machinedirectory
/Volumes/Karadoc
```

Liste des backups locaux:

```bash
$ tmutil listlocalsnapshots /
Snapshots for disk /:
com.apple.TimeMachine.2023-08-06-183708.local
com.apple.TimeMachine.2023-08-06-224319.local
com.apple.TimeMachine.2023-08-06-234317.local
com.apple.TimeMachine.2023-08-07-004401.local
com.apple.TimeMachine.2023-08-07-014414.local
com.apple.TimeMachine.2023-08-07-024419.local
com.apple.TimeMachine.2023-08-07-034434.local
com.apple.TimeMachine.2023-08-07-044445.local
com.apple.TimeMachine.2023-08-07-054449.local
com.apple.TimeMachine.2023-08-07-074454.local
com.apple.TimeMachine.2023-08-07-084455.local
com.apple.TimeMachine.2023-08-07-094541.local
com.apple.TimeMachine.2023-08-07-104623.local
com.apple.TimeMachine.2023-08-07-122033.local
```

Date des backup locaux:

```bash
$ tmutil listlocalsnapshotdates /
Snapshot dates for disk /:
2023-08-06-183708
2023-08-06-224319
2023-08-06-234317
2023-08-07-004401
2023-08-07-014414
2023-08-07-024419
2023-08-07-034434
2023-08-07-044445
2023-08-07-054449
2023-08-07-074454
2023-08-07-084455
2023-08-07-094541
2023-08-07-104623
2023-08-07-122033
```

Supprimer un backup local:

```bash
$ sudo tmutil deletelocalsnapshots <snapshot_date>

$ sudo tmutil deletelocalsnapshots 2023-08-07-084455
```



```bash
$ tmutil calculatedrift "/Volumes/Karadoc"

Drift Averages
-------------------------------------
Added:         0B
Removed:       0B
Changed:       0B
```









```bash
$ tmutil --help
Usage: tmutil version

Usage: tmutil enable

Usage: tmutil disable

Usage: tmutil startbackup [-a | --auto] [-b | --block] [-r | --rotation] [-d | --destination dest_id]

Usage: tmutil stopbackup

Usage: tmutil delete [-d backup_mount_point -t timestamp] [-p path]

Usage: tmutil deleteinprogress machine_directory

Usage: tmutil restore [-v] src ... dst

Usage: tmutil compare [-@acdefghlmnstuEX] [-D depth] [-I name]
       tmutil compare [-@acdefghlmnstuEX] [-D depth] [-I name] snapshot_path
       tmutil compare [-@acdefghlmnstuEUX] [-D depth] [-I name] path1 path2

Usage: tmutil setdestination [-a]  mount_point
       tmutil setdestination [-ap] afp://user[:pass]@host/share

Usage: tmutil setdestination destination_id quota_in_gigabytes

Usage: tmutil removedestination destination_id

Usage: tmutil destinationinfo [-X]

Usage: tmutil addexclusion [-p|-v] item ...

Usage: tmutil removeexclusion [-p|-v] item ...

Usage: tmutil isexcluded item ...

Usage: tmutil inheritbackup machine_directory
       tmutil inheritbackup sparse_bundle

Usage: tmutil associatedisk [-a] mount_point volume_backup_directory

Usage: tmutil latestbackup [-m] [-t] [-d mount_point]

Usage: tmutil listbackups [-m] [-t] [-d mount_point]

Usage: tmutil machinedirectory

Usage: tmutil calculatedrift machine_directory

Usage: tmutil uniquesize path ...

Usage: tmutil verifychecksums path ...

Usage: tmutil localsnapshot

Usage: tmutil listlocalsnapshots <mount_point>

Usage: tmutil listlocalsnapshotdates [<mount_point>]

Usage: tmutil deletelocalsnapshots [<mount_point> | <snapshot_date>]

Usage: tmutil thinlocalsnapshots <mount_point> [purgeamount] [urgency]
```

