Reconnecting an Ejected USB Disk on Synology

You might want to reconnect an ejected USB backup drive prior to a new backup. This is helpful if you have staff swapping out disks, as it ejects on job completion and reconnects prior to your backup task running with HyperBackup.

First in the SSH cli run lsusb and find the device you wish to reconnect.

Then create a scheduled task prior to your backup running with the following commands. You'll need to replace the account-password-here with the admin account you are using to schedule the task and the USB device as well.

The first command is a safe ejection of the device in case it is connected at the time of the reconnection attempt. This prevents the NAS from complaining that the disk wasn't ejected safely.

sudo -S <<< "account-password-here"  sh -c "synousbdisk -umount usb2"
sudo -S <<< "account-password-here" sh -c "echo 0 > /sys/bus/usb/devices/usb2/authorized"
sudo -S <<< "account-password-here" sh -c "echo 1 > /sys/bus/usb/devices/usb2/authorized"