Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Create Incremental Backups on macOS

Backing up data is a critical task for any computer user, and macOS provides several tools to ensure your data is safe. Incremental backups are particularly efficient because they only back up the changes made since the last backup, saving both time and storage space. This article will guide you through the process of creating incremental backups on macOS, using tools like Time Machine and rsync.


Examples:


Using Time Machine for Incremental Backups


Time Machine is the built-in backup solution for macOS. It automatically performs incremental backups, making it a convenient choice for most users.


1. Set Up Time Machine:



  • Connect an external hard drive to your Mac.

  • Open "System Preferences" and select "Time Machine."

  • Click "Select Backup Disk" and choose your external hard drive.

  • Toggle the switch to "On" to enable Time Machine.


2. Configure Time Machine:



  • Click "Options" to exclude specific files or folders from the backup.

  • Time Machine will now automatically perform incremental backups every hour.


Using rsync for Incremental Backups via Terminal


For users who prefer command-line tools, rsync is a powerful utility that can be used to create incremental backups.


1. Open Terminal:



  • You can find Terminal in the "Utilities" folder within the "Applications" directory.


2. Run rsync Command:



  • Use the following command to create an incremental backup:
     rsync -av --delete --link-dest=/path/to/previous/backup /path/to/source /path/to/destination

  • Replace /path/to/previous/backup with the path to your last backup, /path/to/source with the directory you want to back up, and /path/to/destination with the backup location.


3. Automate with a Script:




  • Create a shell script to automate the backup process:


     #!/bin/bash
    SRC="/path/to/source"
    DEST="/path/to/destination/$(date +%Y-%m-%d)"
    PREV="/path/to/destination/$(ls -t /path/to/destination | head -n 1)"

    rsync -av --delete --link-dest=$PREV $SRC $DEST


  • Save the script and make it executable:
     chmod +x /path/to/your/script.sh

  • Schedule the script using cron or launchd to run at desired intervals.


To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.