This is an old revision of the document!
How to fun_plug
Background info
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 executes 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
Installing fun_plug
There are 3 ways to setup a working fun_plug file:
- To a new hard drive using Linux
- To a already partitioned hard drive using Linux
- To a already partitioned hard drive using Windows and cygwin
1. To a new hard drive using Linux
- Connect your new hard drive to a Linux (ext3 supported) PC.
- Run terminal as root user.
- Fire up fdisk using following command
fdisk /dev/hd<hi cyan>x</hi>
orfdisk /dev/sd<hi cyan>x</hi>
if you have SATA or USB hard drive. The <hi cyan>x</hi> is your hard drive position, for example Primary Master is <hi cyan>a</hi>, Primary Slave is <hi cyan>b</hi>, Secondary Master is <hi cyan>c</hi> and Secondary Slave is <hi cyan>d</hi>. SATA and USB hard drives are most cases <hi cyan>a</hi>. - Now we are going to make a swap partition.
- If you have inside fdisk then press
n
- Then
p
- And then
1
- And then
Enter key
- And finally
+512M
- Now we are going to make a ext3 partition for your files. You can also make more than one partition for your files. For example if you do not want to store your files to ext3 partition and you want to use fat32 instead, or if you want to use chroot environment and want to avoid long boot up bug.
- Press
n
- Then
p
- Then
2
- Then press
Enter key
- And now press
Enter key
if want to make only one ext3 partition. If you are not sure what to do then you should pressEnter key
. But if you want to make one or more extra partitions then you must figure out how you are going to spread your drive space between all those partitions you are going to make. For example if you want to store most of your files to fat32 partition then you should press+100M
to make 100MB ext3 partition. - If you did choose to make more than one partition to your files then proceed with setp 17, otherwise go to step 18.
- Now press
n
thenp
after that3
and nowEnter key
andEnter key
to one more time. - Now we are going to set a file system type to swap partition.
- Press
T
- Then
1
- And then
82
- If you did choose to make more than one partition to your files then proceed with setp 23, otherwise go to step 24.
- Now you have to choose a file system to your extra partition. You can leave it to ext3 or change it to fat32. To make it fat32 then press
T
then3
and thenc
- Now you can review your partition table by pressing
p
, if it looks good then pressw
to write changes to hard disk. If you think something went wrong then pressq
and start again starting with step 3. - Now we are going to format newly created partitions.
- To format swap partition run
mkswap /dev/hd<hi cyan>x</hi>1
- Next we are going to format ext3 partition with following command line
mke2fs -j /dev/hd<hi cyan>x</hi>2
- And if you did choose to make a second partition to your files then we must format this one also. If you did choose it to be fat32 before then you must run
mkdosfs /dev/hd<hi cyan>x</hi>3
- And finally we are going to make fun_plug file to your ext3 partition.
- We need first mount ext3 partition with this command line
mkdir /mnt/dsmg600disk && mount /dev/hd<hi cyan>x</hi>2 /mnt/dsmg600disk
- Now create empty fun_plug file with this command
touch /mnt/dsmg600disk/fun_plug
- And now we are going to make it an a executable with this command
chmod 777 /mnt/dsmg600disk/fun_plug
- Now run
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
- Optionally if you like you can also install telnet here.
- Now we are almost dome, just need to unmount ext3 partition with
umount /dev/hd<hi cyan>x</hi>2
command. - And now you can take out your hard drive from your computer and install it to in your DSM-G600.
2. To a already partitioned hard drive using Linux
- Take your hard disk out of your DSM-G600.
- Connect your already partitioned hard drive to a Linux (ext3 supported) PC.
- Run terminal as root user.
- We need first mount ext3 partition with this command line
mkdir /mnt/dsmg600disk && mount /dev/hd<hi cyan>x</hi>2 /mnt/dsmg600disk
. The <hi cyan>x</hi> is your hard drive position, for example Primary Master is <hi cyan>a</hi>, Primary Slave is <hi cyan>b</hi>, Secondary Master is <hi cyan>c</hi> and Secondary Slave is <hi cyan>d</hi>. SATA and USB hard drives are most cases <hi cyan>a</hi>. - Now create empty fun_plug file with this command
touch /mnt/dsmg600disk/fun_plug
- And now we are going to make it an a executable with this command
chmod 777 /mnt/dsmg600disk/fun_plug
- Now run
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
- Optionally if you like you can also install telnet here.
- Now we are almost dome, just need to unmount ext3 partition with
umount /dev/hd<hi cyan>x</hi>2
command. - And now you can take out your hard drive from your computer and install it to in your DSM-G600.
3. To a already partitioned hard drive using Windows and cygwin
- …