A tool to take control of backing up your iOS device to your own server via Wi-Fi or USB.
- Run this to start the avahi daemon:
systemctl start avahi-daemon.service# TODO: install how to - Initialize:
- Add a destination backup drive to a new file in the repo root,
config.sh, by basing the file off a copy of the one intemplatefolder made with:cp template/config.sh ./and then editing the copy. You should enter in something like/mnt/yourDriveMountPointHere/home, where the/mnt/yourDriveMountPointHerepart can be anything as long as it is a valid mountpoint (mountpoint /mnt/yourDriveMountPointHereshould return an exit code of 0). - In the destination backup drive mentioned above, make a new folder called
home. sudo groupadd iosbackupto make theiosbackupgroup- Make a user just for usbmuxd in the
iosbackupgroup:sudo useradd iosbackup_usbmuxdsudo usermod -a -G iosbackup iosbackup_usbmuxd- Give the users in the
iosbackupgroup permission to runusbmuxdunder the account created above by editing/etc/sudoersif you're not on NixOS, or by addingsecurity.sudo.configFile = '' Config strings go here ''to your NixOS config at/etc/nixos/configuration.nixif you are on NixOS, to add the following line:%iosbackup ALL=(iosbackup_usbmuxd)NOPASSWD:ALL USBMUXD_FILEPATHwhereUSBMUXD_FILEPATHis something like/nix/store/zsmdrh44nl59v6db340j7w81cg77ys8v-usbmuxd2-753b79eaf317c56df6c8b1fb6da5847cc54a0bb0/bin/usbmuxdwhich you get from doingwhich usbmuxdwhen in thenix-shellpresent in this repo root. This limits the groupiosbackupto, when running sudo, only be able to run theusbmuxdcommand as the useriosbackup_usbmuxd. - If on NixOS, reload your config using
sudo nixos-rebuild switchto apply the sudoers change above.
sudo useradd UserNameHereto create userUserNameHere(replace this with a new user name to make backups under). Make as many users as desired.sudo usermod -a -G iosbackup UserNameHereto addUserNameHereto theiosbackupgroup. Do this for all the users added in the previous step.- First-time setup
- Plug the device in to the computer via USB
sudo ./backupMyIPhone.sh '' 1 1 0, note the UDID from the output- Enter passcode and "Trust this computer" on the device
- Add your device UDID (shows in the output from the above
./backupMyIPhone.shcommand) to a new file in the repo root,udidToFolderLookupTable.py, by basing the file off a copy of the one intemplatefolder made with:cp template/udidToFolderLookupTable.py ./and then editing the copy. sudo ./backupMyIPhone.sh '' 1 1 0 YourDeviceUDIDHere(whereYourDeviceUDIDHereis the UDID you saw) to perform first-time setup. This requires the device to be connected via USB.sudo pkill usbmuxdat the end.
- Add a destination backup drive to a new file in the repo root,
sudo -E su --preserve-environment UserNameHere(whereUserNameHereis a user created above) and then run one of the following in this shell to make a backup. The following commands don't require the device to be connected to the computer via USB, only to be plugged in and charging somewhere on the same local WiFi network.- Run these as sudo the first time (as any user), then run them in the shell created above afterwards if needed:
- To backup immediately once if it can connect and also repeating every day -- not dry run:
./backupMyIPhone.sh '' 1 0 0 'YourDeviceUDIDHere'
- Or: to backup immediately once if it can connect and also repeating every day -- dry run:
./backupMyIPhone.sh '' 1 0 1 'YourDeviceUDIDHere'
- Or: to backup via USB instead (it will start usbmuxd as root with sudo):
- Run without the
sudo -E su --preserve-environment UserNameHereshell mentioned above:./backupMyIPhone.sh "" 1 0 0 'YourDeviceUDIDHere' 0 1 ./shell_new_libimobiledevice.nix(last argument is optional; it provides a Nix shell that has a newer libusbmuxd version of your choice)
- Run without the
- To backup immediately once if it can connect and also repeating every day -- not dry run:
- Run these as sudo the first time (as any user), then run them in the shell created above afterwards if needed:
- Run
./ibackup.sh(with additional arguments like the above) for as many users as needed to make the backup daemons for each user. (They should all end up sharing the same usbmuxd instance.)
- Debug how usb/WiFi connections are doing:
nix-shell, thensudo usbmuxd -vv --debug --debug
Nvm:
- Internal:
sudo ./ibackup.sh '' 1 0 8089 UserNameHereto perform first-time setup. This requires the device to be connected via USB. - Internal: to backup as a daemon running now, which will additionally run at 12:01 AM or 24 hours from now, whichever is closest, repeatedly:
./ibackup.sh YourDeviceUDIDHere 0 0 8089 UserNameHerewhereYourDeviceUDIDHereis the device UDID from the output of the first-time setup above, andUserNameHereis a user created above.
- Run a backup "daemon":
sudo su YourBackupUserHere -c "./backupMyIPhone.sh '' 1 0 1 'YourDeviceUDIDHere'"whereYourBackupUserHereis in theiosbackupgroup.