DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2013-02-15 11:36:09

Schnaaa
New member
Registered: 2013-02-15
Posts: 1

Guide: Running fun_plug off usb stick DNS-320L

I also posted this on the D-Link forums but it probably fits in here much better.

I spend a few hours to figure this one out i decided to write up this little tutorial on how to get fun_plug running off an usb stick. Please excuse any mistakes i made. i am no expert and maybe this is trivial but i still hope that this guide will save some of you some time. I will probably not be able to help you out if you encounter any problems during the process. i tested this guide with a friend and they worked for him.

First of all i followed a fun_plug to hdd installation guide which can be found here: http://nas-tweaks.net/371/hdd-installat … s-devices/

On the DNS-320L the ssh server needed a fix.
you will have to add these lines in /ffp/start/sshd.sh just before the line “proc_start $command”:

chmod 700 /ffp/var/lib/sshd/
chmod 700 /ffp/etc/ssh/ssh_*

->(this is probably not the best sshd practice but it works)


Make sure you have everything working properly before proceeding because you will just clone your installation to the usb stick.
The good thing ist that you will still have a working fun_plug installation on your harddrive in case your usb drive fails or your sneaky cat steals it.


From now on i mostly copied and pasted a guide i found on the internet and made changes to make it work on the DNS-320L.
So the main credit goes to this step by step tutorial: http://bernaerts.dyndns.org/dns325/242- … ve-usb-key

IMPORTANT: Depending on your harddrive configuration the location of your usb stick and harddisk can be different.
This guide uses my setup with one harddrive installed.

The main differences i found are:
- location of the usb device is different on the DNS-320L
- used file system (ext3)
- result: different location and filesystem in the bootstrapping script

commands to be entered in the terminal start with a "#" the other lines are output from the terminal for better orientation.

to start log in via ssh to your nas

1.1 Texteditor
First of all i installed the nano texteditor via slacker


1.2. FORMAT THE USB KEY
# df
Filesystem 1K-blocks Used Available Use% Mounted on
%root% 9911 4490 4909 48% /
/dev/ram0 9911 4490 4909 48% /
...
/dev/sdb1 982096 926308 55788 95% /mnt/USB/USB1_b1

# umount /dev/sdb
# fdisk /dev/sdb

show commands: m
show partitions: p
delete partitions: d
make new partition: n
3x Enter
partion ID: t
partion ID: 83 for Linux
write table: w
.
.
# mke2fs –j /dev/sdb1 (creates ext 3 partition)
# reboot

check if usb gets automounted:
# df
/dev/sdb1 982096 926308 55788 95% /mnt/USB/USB1_b1


copy ffp directory:
# cp -a /mnt/HD/HD_a2/ffp /mnt/USB/USB1_b1

2.2. BOOTSTRAP /MNT/HD/HD_A2/.BOOTSTRAP/SETUP.SH
# mkdir /mnt/HD/HD_a2/.bootstrap
# chmod 777 /mnt/HD/HD_a2/.bootstrap
# nano -e /mnt/HD/HD_a2/.bootstrap/setup.sh
# chmod +x /mnt/HD/HD_a2/.bootstrap/setup.sh
# nano /mnt/HD/HD_a2/.bootstrap/setup.sh


the stuff below has to be copied inside -> /mnt/HD/HD_a2/.bootstrap/setup.sh:

Code:

#!/bin/sh
#
# Script .bootstrap/setup.sh
#
# Called by fun_plug to prepare USB key execution environment
# If everything is ok, fun_plug will run from the USB key
#
# 08/09/2012 - V1.0 by Nicolas Bernaerts

# Set default path
PATH=/usr/sbin:/sbin:/usr/bin:/bin
CONTINUE=1

# Environment variables. You may adjust them
FFP_HD="/mnt/HD/HD_a2"
FFP_USB="/mnt/USB/USB1_b1"
BCK_FLAG=${FFP_USB}/ffp/home/root/backup.do

# Check if a USB removable disk has been detected. If not, exit
if [ "$CONTINUE" -eq 1 ]; then
  # get the USB key partition
  USB_PARTITION=`df | grep "${FFP_USB}" | sed 's/^\([a-z0-9\/]*\).*$/\1/g'`

  # if partition has been mounted, remount it with noatime, else exit
  if [ -z "${USB_PARTITION}" ]; then
    CONTINUE=0
    echo "ERROR - USB device has not been detected as Mass Storage"
  else
    umount ${USB_PARTITION}
    mount ${USB_PARTITION} -t ext3 ${FFP_USB} -o noatime 2>/dev/null
    echo "USB - USB disk mounted under ${FFP_USB}"
  fi
fi

# Check presence of ffp directory at the USB key root. If not present, exit
if [ "$CONTINUE" -eq 1 ]; then
  if [ ! -d "${FFP_USB}/ffp" ] ; then
    CONTINUE=0
    echo "ERROR - Directory ${FFP_PATH} doesn't exist"
  else
    echo "USB - Directory ${FFP_PATH} present"
  fi
fi

# Check if a backup of USB key ffp directory is needed
if [ "$CONTINUE" -eq 1 ]; then
  if [ -f ${BCK_FLAG} ] ; then
    echo "USB - Backup of ${FFP_USB}/ffp needed. Target is ${FFP_HD}/ffp"
    rm -r ${FFP_HD}/ffp
    cp -a ${FFP_USB}/ffp ${FFP_HD}/ffp
    rm ${BCK_FLAG}
    echo "USB - Backup of ${FFP_USB}/ffp done. Backup flag deleted"
  fi
fi

# Declare USB key ffp directory as ffp root
if [ "$CONTINUE" -eq 1 ]; then
  FFP_PATH=${FFP_USB}/ffp
  echo "USB - Fun_Plug is running from USB key under ${FFP_PATH}, accessible thru /ffp"
else
  echo "ERROR - Fun_Plug root can't be moved to USB Key"
fi

---------------

ctrl + x and save the file

#reboot


# ls -la /ffp
lrwxrwxrwx 1 root root 16 Sep 6 22:36 /ffp -> /mnt/USB/USB1_b1/ffp (fun_plug is running off the usb key)
Every package you install will also be installed on the usb stick

If you want to keep your fun_plug on usb and the one on the harddrive synced create the file backup.do in root folder

# touch /ffp/home/root/backup.do
# reboot


booting will take a bit longer because the usb installation is copied back to your harddrive

Done!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB