RSS Amplifier

Rida Ayed · Mar 21, 2020

Backup an iPhone with Linux

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Table of Contents Install the necessary packages Find the event iPhone connected Catch the event iPhone connected Create the trigger iPhone connected Create the action Backup iPhone Restart and reload all actors (not the iPhone though) Monitor the backup process This is a follow-up on Connect an iPhone to a Raspi . Install the necessary packages Find the event iPhone connected Connect your iPhone:…

Table of Contents

This is a follow-up on Connect an iPhone to a Raspi.

Install the necessary packages

Find the event iPhone connected

  1. Connect your iPhone:
  2. Run this script:
lsusb | grep iPhone
Bus 001 Device 007: ID 05ac:12a8 Apple, Inc. iPhone5/5C/5S/6

Catch the event iPhone connected

# Content of /etc/udev/rules.d/99-iphone.rules
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ACTION=="add", ENV{SYSTEMD_WANTS}="iphone-connect.service"

Create the trigger iPhone connected

#Content of /etc/systemd/system/iphone-connect.service
[Service]
Type=oneshot
ExecStart=/bin/sh /home/pi/scripts/backup_iphone.sh

Create the action Backup iPhone

# Content of ~/scripts/backup_iphone.sh
src=/mnt/iphone/ #Must exist in prior
dst=/media/pi/usb500gb #Must exist in prior
log=/home/pi/backup_iphone.log
sleep 5
ifuse $src &&
    rsync --verbose --archive --compress --update --log-file=$log $src $dst

Restart and reload all actors (not the iPhone though)

sudo udevadm control --reload-rules && udevadm trigger
service udev restart
systemctl daemon-reload #THIS one is crucial

Monitor the backup process

journalctl -f --unit=iphone-connect.service --output=cat

Read on /posts/backup_iphone_linux/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.