# usync
Sync any two paths with each other & cloud backup.
Uses `unison` to sync the paths, rclone to sync to a cloud provider.
## Setup
```bash
git clone && cd usync
just install-deps
rclone config
# Edit justfile: set SOURCE, TARGET, and CLOUD_REMOTE variables
just setup
```
## Use
```bash
just sync-paths # Between paths (SOURCE and TARGET in justfile)
just sync-cloud # To cloud
just status # Check
```
## Commands
- `setup` - Create directories
- `check` - Verify paths
- `sync-paths` - Fast sync (unison)
- `sync-cloud` - Cloud backup (rclone)
- `status` - Show state
## Windows (WSL) with usbipd-win
```bash
# 1. Install usbipd-win (Admin PowerShell)
# Download from https://github.com/dorssel/usbipd-win/releases/latest
# 2. List devices
usbipd list
# Note BUSID (e.g., 1-20)
# 3. Attach (Admin PowerShell)
usbipd bind --busid 1-20
usbipd attach --wsl --busid 1-20
wsl # Start admin WSL
# 4. In admin WSL
sudo mkdir /mnt/drive1
sudo mount /dev/sdb1 /mnt/drive1 # Replace sdb1
# 5. Configure & run
# Edit justfile: SOURCE="/mnt/drive1"
just sync-cloud
# Cleanup (optional)
sudo umount /mnt/drive1
# sudo umount /mnt/drive2 # If using second drive
# Detach & unbind (required before removing drive)
usbipd detach --busid 1-20
usbipd unbind --busid 1-20
```
## Configure
Edit justfile:
- SOURCE/TARGET - paths to sync (e.g. /mnt/drive1)
- CLOUD_REMOTE - rclone remote name (e.g. cloud_remote:)
- CLOUD_PATH - cloud folder (default: /usync)
- CLOUD_MOUNT_PATH - local mount (e.g. /home/user/cloud-mount)