On startup DSM-G600 will run /etc/rc.sh which will mount the various filesystems and initialize the drive.
... touch /tmp/boot_finished /usr/sbin/chk_fun_plug &
/usr/sbin/chk_fun_plug will check for file called fun_plug on the disks root and then execute it.
#!/bin/sh sleep 30 Dir_Len=28 Filename_Len=26 CUSTOMIZEHDPATH=/sys/custom/shared_name/HD file=$(find "$CUSTOMIZEHDPATH"/*) HD_Path=`expr substr "$file" "$Dir_Len" "$Filename_Len"` HD_Path=$HD_Path"a2" if [ -e /mnt/$HD_Path/fun_plug ]; then echo "function plug enable" /mnt/$HD_Path/fun_plug fi
Warning: This was just background information about how DSM-G600 finds and executes fun_plug. All scripts above this warning should not be entered into your fun_plug or any other scripts.
There are 5 ways to setup a working fun_plug file:
fdisk /dev/hdx
or fdisk /dev/sdx
if you have a SATA or USB hard drive. The x is your hard drive position, for example Primary Master is a, Primary Slave is b, Secondary Master is c and Secondary Slave is d. SATA and USB hard drives are usually a.n
p
1
Enter key
+512M
n
p
2
Enter key
Enter key
if you want to make only one ext3 partition. If you are not sure what to do then you should press the Enter key
. But if you want to make one or more extra partitions then you must figure out how you are going to allocate your drive space among all those partitions you are going to make. For example if you want to store most of your files to a FAT32 partition then you should enter +100M
to make a 100MB ext3 partition.n
then p
after that 3
and now Enter key
and Enter key
once more.swap
.T
1
82
T
then 3
and then c
p
, if it looks good then press w
to write changes to hard disk. If you think something went wrong then press q
and start again, starting with step 3.mkswap /dev/hdx1
mke2fs -I 128 -j /dev/hdx2
mkdosfs /dev/hdx3
mkdir /mnt/dsmg600disk || mount /dev/hdx2 /mnt/dsmg600disk
touch /mnt/dsmg600disk/fun_plug
chmod 777 /mnt/dsmg600disk/fun_plug
ls -la /mnt/dsmg600disk/fun_plug
to make sure that we did it correctly. You should see -rwxrwxrwx 1 root root 0 some-date-and-time /mnt/dsmg600disk/fun_plug
umount /mnt/dsmg600disk
command.mkdir /mnt/dsmg600disk || mount /dev/hdx2 /mnt/dsmg600disk
. The x is your hard drive position, for example Primary Master is a, Primary Slave is b, Secondary Master is c and Secondary Slave is d. SATA and USB hard drives are most cases a.touch /mnt/dsmg600disk/fun_plug
chmod 777 /mnt/dsmg600disk/fun_plug
ls -la /mnt/dsmg600disk/fun_plug
to make sure that we made it correctly. You should see -rwxrwxrwx 1 root root 0 some-date-and-time /mnt/dsmg600disk/fun_plug
umount /mnt/dsmg600disk
command.mount -t smbfs -o username=admin //<insert dsmg IP here>/HDD_a /mnt/somedir
touch /mnt/somedir/fun_plug
and chmod 777 /mnt/somedir/fun_plug
umount /mnt/somedir
and reboot your DSM-G600.
To do this, you have to have at least the 1.01 firmware. Please update if you have an older version.
and you're done. You may edit the fun_plug via samba (windows share) from now on, the permissions will stick.
Windows users should note that the fun_plug file must be in unix file format (LF for newline) and not in Windows (CR LF for newline). One suggested editor for Windows is UltraEdit which let you save the file in both formats. To test out if fun_plug works, you can simply add following lines to your fun_plug and reboot.
#!/bin/sh
dmesg > /mnt/HD_a2/dmesg.out
After boot up you should see dmesg.out file at the root of your DSM-G600 hard disk.
If you have not familiar with Unix shell scripting then I suggest you to read some docs about it.