Moving fonz’s fun_plug (ffp) to USB

After running the D-Link DNS-320 for a while, I decided to shift fonz’s fun_plug (ffp) to run off the USB drive instead of the hard disk. Some benefits of doing so are:

  • Reduce mechanical wear and tear – I frequently access the DNS-320 via ssh and by doing so, the disk spins up. By shifting the ffp onto the USB drive, the disks do not spin up as much and hence lesser mechanical wear and  tear
  • Power saving – I assume lesser disk spinups translate to marginal power savings in the long run

Shifting ffp to run off the USB drive for the D-Link DNS-320 is quite straight forward as the DNS-320 support USB drives out of the box. There is not a need to install kernel module (usb-storage.ko) like the D-Link DNS-323 days. However, the DNS-320, besides auto-mounting the USB drive, it also change the permission of all the files to 777 (chmod 777). This is undesirable as it will mess up the auto-start scripts (/ffp/start/*). Fortunately, KyleK came up with a package to intercept the chmod command for DNS-325 so we will make use of the package and modify it a little for D-Link DNS-320 usage.

 

Prerequisites

  • D-Link DNS-320
  • USB drive of at least 512MB
  • Some Linux knowledge (using vi to edit files)

 

The procedure of shifting ffp onto USB drive is:

  1. Make sure the DNS-320 is running ffp off its disk
  2. Install KyleK’s dns325-chmod-fix package and modify it for DNS-320 usage
  3. Format the USB drive to Ext2 File System
  4. Copy the current ffp folder to USB
  5. Download the updated fun_plug file and modifying the contents
  6. Reboot and enjoy running ffp off USB drive

 

Make sure the DNS-320 is running ffp off its disk

We will be using the DNS-320 to do some of the preparation work so make sure your DNS-320 is running fun_plug. If it is not running fun_plug, check the post on DNS-320 – making fun_plug and old packages work to set it up.

 

Install Kylek’s dns325-chmod-fix package and modify it for DNS-320 usage

Kylek has put together a package to address the chmod 777 issue on the DNS-325. It happens to address the issue we face in the DNS-320, a little script changing is what is required for it to work on the DNS-320.

So telnet to your DNS-320 and do the following:

  1. Navigate to Volume_1 by typing “cd /mnt/HD/HD_a2
  2. Download Kylek’s package by typing “wget http://kylek.is-a-geek.org:31337/files/ffp/0.5/dns325-chmod-fix-0.1-1.tgz
  3. Install the package by typing “funpkg -i dns325-chmod-fix-0.1-1.tgz
  4. Check that suppress_args is applied for /mnt/USB/HD_c1 by typing “cat /usr/local/config/chmod_usb.sh | grep 777
  5. Update it to suppress HD_c instead of HD_c1 by typing “cat /usr/local/config/chmod_usb.sh | sed -e ‘s/\/HD_c1\”/\/HD_c\”/’ >> /usr/local/config/chmod_usb.sh
  6. Ensure that suppress_args is now applied for /mnt/USB/HD_c by typing “cat /usr/local/config/chmod_usb.sh | grep 777

 

Format the USB drive to Ext2 File System
WARNING: We will be formatting the USB drive so make sure you have backed up the things you need on the USB drive.

Plug in your USB drive to the D-Link DNS-320 and wait 30 seconds, it should be mounted. You can check if it is mounted by using the command “mount | grep /dev/sdc“. It should return that there is something mounted (e.g. /dev/sdc on /mnt/USB/HD_c type ext2 (rw)). Once it is mounted proceed with the following commands:

  1. Unmount the USB drive by typing “umount /dev/sdc
  2. Format the USB drive by typing “mke2fs /dev/sdc
  3. After formatting, remount the USB drive by typing “mount /dev/sdc /mnt/USB/HD_c

 

Copy the current ffp folder to USB

We will be shifting the current ffp installation on your disk to the USB drive and it will take a while before the copy completes so sit back and enjoy a can of coke or a cup of Starbucks.

  1. Copy the current ffp installation to USB by typing “cp -a /mnt/HD/HD_a2/ffp /mnt/USB/HD_c/

 

Download the updated fun_plug file and modifying its contents

I modified an old copy of fun_plug script I dug out from my old DNS-323, modified it a little and it appears to work. Basically it will run fun_plug from USB drive if it is correct USB drive. It does this by matching the USB drive’s UUID.

  1. Back up the current fun_plug by typing “mv /mnt/HD/HD_a2/fun_plug /mnt/HD/HD_a2/fun_plug.hdd
  2. Download the new fun_plug file by typing “wget -O /mnt/HD/HD_a2/fun_plug http://www.shadowandy.net/wp/wp-content/uploads/fun_plug.dns320.usb
  3. Locate your USB drive UUID by typing “blkid /dev/sdc
  4. Replace the value of variable USB_DEV_UUID in /mnt/HD/HD_a2/fun_plug with the UUID you got in Step 3. You can use vi to do this.
  5. Once this is done, reboot the DNS-320 via web admin

 

How do I know if fun_plug is running off the USB drive?

You can check the ffp.log file in Volume_1 and see if says “* Found FFP on USB device”. If it does, it is running off the USB drive.

 

Treat shadowandy!

If these step-by-step guides have been very helpful to you and saved you a lot of time, please consider treating shadowandy to a cup of Starbucks.  

This site contains links to Amazon. These links will take you to some of the products mentioned in today’s article. As an Amazon Associate, I earn from qualifying purchases.
11 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments