USB Sync & Move2USB
Photobooth offers two ways to get your photos and videos onto a USB stick:
| Feature | Purpose | Trigger |
|---|---|---|
| USB Sync | Automatic background sync at a regular interval | Runs continuously while Photobooth is open |
| Move2USB | One-shot copy or move of all media | Manual — HTTP endpoint or socket.io command |
Both features share the same USB device identifier (Adminpanel → USB Sync → USB device identifier) and the same Linux mount permissions.
Prerequisites
- Linux only — Windows is not supported.
- rsync must be installed (
sudo apt install rsync). - A USB stick formatted as FAT32 or exFAT (recommended for cross-platform compatibility). The volume label should match the identifier configured in the admin panel (default:
photobooth). - Mount permissions for the
www-datauser (see Permissions setup below).
Permissions setup
The web-server user (www-data) needs permission to mount and unmount USB drives.
Photobooth ships two complementary mechanisms that are installed via the Photobooth Setup Wizard:
- Polkit rule — allows
www-datato calludisksctl mount/udisksctl unmountwithout a password. - sudoers rule (
/etc/sudoers.d/021_www-data-usb-sync) — passwordlesssudo mount /dev/* /media/*,sudo umount /dev/*andsudo mkdir -p /media/*as fallback when udisksctl is unavailable. Both/binand/usr/binpaths are covered for portability.
Installing via the Setup Wizard
Download and run the Setup Wizard:
wget -O install-photobooth.sh https://raw.githubusercontent.com/PhotoboothProject/photobooth/dev/install-photobooth.sh
sudo bash install-photobooth.sh
Then choose:
- 6 Permissions → 4 USB Sync policy
The wizard will:
- Install the Polkit rule for udisksctl.
- Install the sudoers rule for mount/umount/mkdir.
- Disable desktop auto-mount (pcmanfm
mount_on_startup,mount_removable,autorunin both the system default and user profile config) to avoid permission conflicts. - Remove any legacy
020_www-data-usbsudoers file and50-photobooth-udisks.rulespolkit file.
Note: USB mount permissions are also installed automatically when running 2 Fix general permissions or during a fresh Photobooth install. The dedicated "USB Sync policy" menu entry is only needed to re-apply or remove the rules individually.
Run the same menu entry again after OS upgrades to re-apply the rules.
Removing permissions
Run 6 Permissions → 4 USB Sync policy again and answer No when asked to set up the policy. The wizard removes Polkit rules, sudoers rules, and the legacy files.
USB Sync (automatic)
USB Sync runs as a background Node.js process (sync-to-drive.js) that is started automatically when Photobooth is opened in the browser (provided the feature is enabled).
How it works
- The process looks for a USB device matching the configured identifier (label, device path, or device name).
- It mounts the device if it is not already mounted:
- First via
udisksctl mount. - Fallback:
sudo mountto/media/<label>with automatic FAT32/exFAT uid/gid options. - It runs
rsyncto incrementally copy newjpg,gif,mp4files from the Photobooth data directory to the USB stick. - Deleted images are backed up into a
deleted/folder on the USB stick (rsync--backup-dir). - After sync completes, the process sleeps for the configured interval and starts over.
Device detection
The device is matched (case-insensitive) by:
- Volume label (recommended) — e.g.
photobooth - Block device path — e.g.
/dev/sda1 - Device short name — e.g.
sda1
If lsblk does not report the label (e.g. in LXC containers or after a USB reconnect), Photobooth falls back to blkid which reads the label directly from the block device.
Configuration
Open the Admin Panel → USB Sync:
| Setting | Description |
|---|---|
| Enable | Turn automatic USB Sync on or off. |
| Automated syncing interval | Seconds between sync attempts (default: 300). |
| USB device identifier | The value used to find the USB stick — typically the volume label (default: photobooth). |
File types synced
jpg, gif, mp4 (and the internal chk verification files).
Move2USB (manual copy / move)
Move2USB lets you copy — or move — all current photos and videos to the USB stick with a single action.
Modes
| Mode | Behaviour |
|---|---|
| copy | Copies all media to the USB stick. Originals remain on the Photobooth. |
| move | Copies all media to the USB stick and deletes the originals plus the Photobooth image database after a successful, verified sync. |
Enabling Move2USB
- Adminpanel → Hardware Button → Enable Hardware Buttons must be active.
- Adminpanel → Hardware Button → Move2USB mode — choose
copyormove(set todisabledto hide the feature). - The USB device identifier under USB Sync must point to a valid USB stick.
Triggering Move2USB
- HTTP endpoint:
http://<IP>:<Port>/commands/start-move2usb— requires Hardware Buttons enabled and Move2USB mode notdisabled. - Socket.io: emit
photobooth-socket→start-move2usb
Copy verification
Move2USB creates a copy.chk marker file in the Photobooth data folder before rsync and expects it to appear on the USB stick after sync. If the marker is missing on the USB stick after rsync, the sync is treated as failed and no files are deleted (even in move mode). After successful verification, both the local and USB-side copy.chk files are cleaned up automatically.
What gets deleted in "move" mode
Only after a verified successful sync:
- All
jpg,gif,mp4files in the Photobooth data directory. - The Photobooth image database file (
<dbname>.txt).
Mount strategy (both features)
Photobooth uses a layered approach to mount USB drives:
- udisksctl — preferred, works with the Polkit rule.
- findmnt check — if udisksctl output was ambiguous, verify via
findmnt. - sudo mount — fallback using the sudoers rule; mounts to
/media/<label>.
For FAT32 (vfat) and exFAT volumes the mount options umask=0000,uid=<uid>,gid=<gid> (using the numeric uid/gid of the running process, typically 33 for www-data) are set automatically so the web-server process can write to the stick.
If a drive is already mounted but not writable (e.g. auto-mounted by the desktop with different uid/gid), Photobooth unmounts and re-mounts it with the correct options.
Unmounting follows the same order: udisksctl first, sudo umount as fallback.
When does each feature unmount?
- USB Sync keeps the stick mounted between sync intervals and only unmounts on process termination (SIGTERM/SIGHUP/SIGINT).
- Move2USB unmounts the stick after every sync operation (before deleting local files in
movemode).
Preparing a USB stick
- Format the stick as FAT32 (for sticks ≤ 32 GB) or exFAT (for larger sticks).
- Set the volume label to
photobooth(or whatever you configure as the USB device identifier). - Linux:
sudo fatlabel /dev/sdX1 photobooth(FAT32) orsudo exfatlabel /dev/sdX1 photobooth(exFAT). - Windows: right-click the drive → Rename.
- macOS: Disk Utility → rename the volume.
- Plug the stick into the Photobooth host.
Troubleshooting
USB stick not detected
- Verify the label:
lsblk -o NAME,LABEL,FSTYPE,MOUNTPOINT— the label must match the configured identifier (case-insensitive). - If
lsblkshows no label, tryblkid— Photobooth uses this as a fallback. - Confirm the device is a USB device (
lsblk -o NAME,SUBSYSTEMSshould containusb).
Permission errors / mount failures
- Re-run the Setup Wizard → Permissions → USB Sync policy.
- Check that Polkit and sudoers are in place:
ls -l /etc/polkit-1/localauthority/50-local.d/photobooth.pklaor/etc/polkit-1/rules.d/photobooth.rulesls -l /etc/sudoers.d/021_www-data-usb-sync- Disable desktop auto-mount (e.g. pcmanfm volume handling) — it can race with Photobooth and mount with the wrong uid.
Sync not running / nothing copied
- Is USB Sync enabled in the Admin Panel?
- Check the server logs at the Debug panel: http://localhost/admin/debugpanel.
- Look for
[synctodrive]log lines — they show device detection, mount status, and rsync output.
Move2USB fails or does not delete files
- Check Debug panel for
[remotebuzzer]log lines mentioningmove2usb. - If the log says "sync verification failed (copy.chk missing)", the rsync did not complete successfully — check USB stick space and permissions.
- Files are only deleted in
movemode and only after verified sync.
FAT32 / exFAT write issues
- Ensure the stick is not write-protected (physical switch on some USB sticks).
- Re-format the stick and re-label it.
- If mounted by another process, Photobooth will unmount and re-mount with proper options — check the log for "not writable, unmounting" messages.