Skip to main content

Restore Only A Specific Folder

Let's restore the /home/mac directory

1) Restore /home/mac into a staging folder (safe)

Create a clean staging directory:

sudo mkdir -p /root/restore-home sudo rm -rf /root/restore-home/*

Restore only /home/mac from the backend (example backend: b2):

sudo autorestic -c /home/mac/.autorestic.yml exec -b b2 -v -- \ restore latest \ --target /root/restore-home \ --include /home/mac

Verify the restored files exist (restic recreates the absolute path under the target):

sudo ls -la /root/restore-home/home/mac

Expected restore path:

  • /root/restore-home/home/mac


2) Copy restored data back into /home/mac

Make a safety backup of the current home:

sudo mkdir -p /home.pre-restore sudo rsync -aHAX --numeric-ids /home/mac/ /home.pre-restore/

Copy the restored home back into place:

sudo rsync -aHAX --numeric-ids /root/restore-home/home/mac/ /home/mac/ sudo chown -R mac:mac /home/mac

Fix SSH permissions (recommended):

sudo chmod 700 /home/mac/.ssh 2>/dev/null || true sudo chmod 600 /home/mac/.ssh/authorized_keys 2>/dev/null || true

Notes

  • --include /home/mac restores only that path (does not restore /etc, /var, etc.).

  • If your backend name differs, replace -b b2 with your backend (check under backends: in /home/mac/.autorestic.yml).