A script because Synology sucks.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jay 4259a7e58b effsyno 11 months ago
99effsyno.sh effsyno 11 months ago
LICENSE effsyno 11 months ago
README.md effsyno 11 months ago
smb.sh effsyno 11 months ago

README.md

99effsyno - a script for Synology

DSM sucks. I hate it. I absolutely hate what it does to the underlying operating system. I hate how idiotic it is regarding mounts. I hate how things are it's way. I mostly hate it because I didn't ask for pay for these features and they seemingly give you no way of telling them to GTFO.

99effsyno is just a couple of things that make the synology do the absolute minimum I expect to be able to do. It's name comes from the shell script used to achieve this; 99 is just an execution priority, effsyno is fuck synology.... because fuck DSM.

What sucks

I have a USB enclosure that holds a lot of disks. By default...Synology mounts any valid partition to /volumeUSB*n*/usbshare where n is the number assigned. It then automatically creates a samba share configuration that shares it as usbsharen...where n is once again the drive number.

This is all you're given. You cannot rename the share in DSM, you cannot move it.

To complicate this, while I can achieve exactly what I want to do through standard command line hacking, these changes don't persist between reboots. The two biggies are /etc/fstab and samba configurations are generated dynamically. So the idea of just adding the UUID to /etc/fstab and modding /etc/samba/smb.share.conf the usual way are out.

Other Oddities

They seem to have a lof of abstraction between you and the hardware. My internal RAID1 is actually LVM2 on /dev/md2. This sucks because it adds another layer of useless complexity if I want to remount this later. I mean it can be done...I just have to look all that up. It's going to happen...I'm not sticking with this hardware for long.

I also noticed that even manual mounts from command line have a systemd service created for them. No...I want out.

The Hack

While it generates a lot of configs and wipes directories out on boot, I did find one little trick that still worked: /usr/local/etc/rc.d - We can stick shell scripts here, they'll run at boot, and they'll persist between reboots.

There are two files: 99effsyno.sh and smb.sh. The smb.sh file is not actually a script. I only gave it the .sh filename to ensure it didn't get deleted. This is actually our replacement samba configuration. This file should not be +x! The original varient had a simple exit routine and tail command to output just the .conf; this is easier.

99effsyno.sh is the executable script that does the following:

* mounts the external drives by UUID to points I specify
* replaces the samba share configuration
* reboots samba

At Your Own Risk

Don't do this. I'm not taking responsibility and Synology will tell you to GTFO and never give you support again.