ilteris kaplan blog

Synology and Timeshift

February 05, 2024

Problem

I would like to have a backup system similar to TimeMachine on Mac. Basically I would like to use my Synology NAS as a backup system. It looks like TimeShift is a nifty app that allows for taking incremental snapshots of the system at regular intervals which can be restored later.

Solution

In Synology DSM, go to the SanManager and create a new Lun. This should be Thin Provisioning and could allow all for access since we will use CHAP for authentication later. Copy IQN that’s created for the Synology. Now move to the Linux end. Make sure iscsiadm is installed through aptitude. run this command: sudo iscsiadm --mode discovery --type sendtargets --portal 192.168.50.196:3260 this should return a list of targets including our synology’s IQN. If it is not listed, you might want to edit /etc/iscsi/initiatorname.iscsi and add the IQN in there at the bottom. Now run discovery again and then login using sudo iscsiadm --mode node --targetname "iqn.2000-01.com.synology:lorimer.default-target.5966f892fc0" --portal "192.168.50.196:3260" --login this should return a successful login. Here’s the command to logout: sudo iscsiadm --mode node --targetname "iqn.2000-01.com.synology:lorimer.default-target.5966f892fc0" --portal "192.168.50.196:3260" --logout

Here’s the catch: Even though we are able to connect to target, our disk cannot be mounted to the system because we don’t use any authentication. The way I solved it, I used a global CHAP authentication on Synology and changed the username and password on the Linux end to match the Synology’s. sudo vim /etc/iscsi/iscsid.conf is where one can change the username and password and also authentication method.

# To manually startup the session, use "manual". The default is manual.
node.startup = manual

node.leading_login = Yes

# To enable CHAP authentication set node.session.auth.authmethod
# to CHAP. The default is None.
node.session.auth.authmethod = CHAP

# To set a CHAP username and password for initiator 
# authentication by the target(s), uncomment the following lines: 
node.session.auth.username = usernme  
node.session.auth.password = password
# To enable CHAP authentication for a discovery session to the target,
# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
discovery.sendtargets.auth.authmethod = CHAP

# To set a discovery session CHAP username and password for the initiator
# authentication by the target(s), uncomment the following lines:
discovery.sendtargets.auth.username = username 
discovery.sendtargets.auth.password = password

Once these changes are done, one change reload the service: sudo systemctl restart iscsid

References

https://wiki.debian.org/SAN/iSCSI/open-iscsi https://unixguru.me/using-timeshift-with-synology-nas.html


Written by Ilteris Kaplan who still lives and works in New York. Twitter