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 2008-04-19 01:01:55

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

fun_plug on USB-Stick?

Hi,

has anyone ever attempted to offload fun_plug and any additional modules to a USB Stick, so the hard drive doesn't spin up on Telnet/SSH logins or when someone accesses your lighttpd website?
I've been pondering with this for a while, and now that I have a 1GB stick, I want to try it.

I know that a small set of executables (mainly busybox) has to reside on the hard drive, since the USB-storage module must be loaded somehow.

I've modified the fun_plug script for fun_plug-0.5, but since my shell scripting skills are fairly basic, I wondered if some of the more experienced users could look over it and see if it would work (no, I haven't tried yet).

In the script I try to be as cautious as possible, with a fallback to the HDD-based fun_plug if something should go wrong.

Anyway, let me hear what you think.

Last edited by KyleK (2008-04-19 01:06:49)


Attachments:
Attachment Icon fun_plug_from_usb, Size: 2,477 bytes, Downloads: 803

Offline

 

#2 2008-04-19 09:05:33

jdoering
Member
Registered: 2008-04-10
Posts: 95

Re: fun_plug on USB-Stick?

I don't know if your script will work or not (easier to just try than to analyze); but the general concept definitely does. No need to use FFP_BB. Since the ramdisk-based root filesystem already has versions of insmod, mount, etc the only thing you HAVE to have on the hard disk are the usb storage module and the fun_plug script; neither file is accessed against once the script finishes.

So minus the fallback to harddrive support; the minimum requirements for stuff on the harddrive really are minimal. You can whittle the whole thing down to a single script to copy if you're 323 has Internet access; you can pick up the kernel module on first boot using wget and copy to the hard drive.

I prefer to move the harddrive stuff to a hidden directory so I don't see it the rest of the time (I used .bootstrap/ffp/ instead of just ffp/); since it's linked off of root anyway it doesn't matter where it comes from.

I also changed to using "mount --bind" instead of "ln -s" to create /ffp; I don't think it makes much functional difference but it keeps the shell from derefrencing (and displaying) the real directory when navigating /ffp and such.

There are lots of past threads on this kind of thing; I think you've seen them too based on the wait loops in your script...

-Jeff

Offline

 

#3 2008-04-19 16:02:58

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: fun_plug on USB-Stick?

Thanks for the reply.

I checked the NAS' busybox, unfortunately it does not have the insmod module (I'm operating on a Conceptronic CH3SNAS with 1.03b6 firmware; it runs BusyBox v1.00-pre1 (2007.12.10-08:03+0000)).

But that shouldn't be much of a problem I think.

EDIT: I was wrong, sorry. insmod actually is available in /usr/sbin (or rather /sys/crfs/sbin).

I did read several threads regarding attaching USB devices, but all were focused on just using the USB stick as additional space, or for a chrooted environment (Etch/Sarge). None attempted to move fun_plug + applications to the external memory.


I'll just try out my fun_plug and will report here of the results :)

Last edited by KyleK (2008-04-19 16:15:53)

Offline

 

#4 2008-04-19 19:07:36

oxygen
Member
Registered: 2008-03-01
Posts: 320
Website

Re: fun_plug on USB-Stick?

It works. I'm using fonz fun_plug and modified it a bit.

Offline

 

#5 2008-05-09 23:10:15

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

hey i just got the 1gb usb for this purpose.

did you use fun_plug from the first post or some other one?


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#6 2008-05-10 05:34:06

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: fun_plug on USB-Stick?

I combined the usbdisk.sh script from somewhere with the fun_plug script for ffp-0.5
I've attached the file to this post. Please note that it is made for fun_plug 0.5 and that you have to have the usb-storage.ko module in the correct directory (take a look at the fun_plug script before copying it to the device)

The script has a built-in fallback in case it can't find a USB stick or can't mount it, or if there's no fun_plug on the USB stick.


Attachments:
Attachment Icon fun_plug, Size: 2,713 bytes, Downloads: 872

Offline

 

#7 2008-05-11 03:47:01

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

thanks. i did something similar using your first script as a template..

then, with help from uf0un from irc channel i modified fun_plug that mounts the usb partition using UUID instead of fixed device name.

attached is my current fun_plug


Attachments:
Attachment Icon fun_plug, Size: 3,708 bytes, Downloads: 1,957

D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#8 2008-05-15 02:49:22

grmek
Member
Registered: 2008-05-14
Posts: 11

Re: fun_plug on USB-Stick?

KyleK wrote:

I combined the usbdisk.sh script from somewhere with the fun_plug script for ffp-0.5
I've attached the file to this post. Please note that it is made for fun_plug 0.5 and that you have to have the usb-storage.ko module in the correct directory (take a look at the fun_plug script before copying it to the device)

Tried it and it doesnt seem to be working. I've altered the script to reflect situation (sdb1 -> sdc1) and added .ko file to the correct directory on HD_a2.
CH3SNAS boots, finds the usb thumb drive, but later it cannot be accessed via telnet.

If I remove usb key and reboot, everything is fine (another copy of ffp on HD_a2 - fallback function works).

Perhaps I'm missing something here?

Thanks.

Offline

 

#9 2008-05-15 03:54:16

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: fun_plug on USB-Stick?

The scripts writes status information to its log file: Initially it logs to /mnt/HD_a2/ffp.log, but as soon as it has found fun_plug on the USB stick it will log to /mnt/USB/ffp/ffp.log
Check these to see where the problem might be.

Offline

 

#10 2008-05-15 10:58:45

greg1977
Member
Registered: 2008-04-28
Posts: 19

Re: fun_plug on USB-Stick?

Hello,

I found another topic which seems to do the same thing :
http://dns323.kood.org/forum/p14578-200 … tml#p14578

Offline

 

#11 2008-05-15 11:20:31

grmek
Member
Registered: 2008-05-14
Posts: 11

Re: fun_plug on USB-Stick?

KyleK wrote:

The scripts writes status information to its log file: Initially it logs to /mnt/HD_a2/ffp.log, but as soon as it has found fun_plug on the USB stick it will log to /mnt/USB/ffp/ffp.log
Check these to see where the problem might be.

I had to alter logging settings in fun_plug so that it writes all log messaging to HD, otherwise nothing would show up on neither the HD or the usb stick.

Here's what log says now:

**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****
Thu May 15 11:17:31 GMT 2008
Found usb-storage.ko module. Copying...
insmod usb-storage.ko
Waiting for sdc1 (up to 25 seconds) ...
Found sdc1 in /proc/partitions
Mounting /dev/sdc1 on /mnt/USB ...Success
* Found FFP on USB device
ln -snf /mnt/USB/ffp /ffp
chmod: /ffp/bin/busybox: Operation not permitted
* Running /ffp/etc/rc ...
./fun_plug: /ffp/etc/rc: No such file or directory
*  OK
________________

Looking at the fun_plug source, it seems that problem lies in this command:

ln -snf $FFP_PATH $FFP_PREFIX

Any ideas what's going on here?

Cheers!

Offline

 

#12 2008-05-15 12:15:10

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

i had the similar problem. take a look at my script above. i've added sym link creation to HDD on line 58 (before mounting). then after mounting, if USB FFP is found i recreate linking to USB this time. that fixed it for me. also, in my script, # suid busybox (line 111) is executed before the symlink creation (line 118).

Last edited by SilentException (2008-05-15 12:15:43)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#13 2008-05-15 13:27:53

grmek
Member
Registered: 2008-05-14
Posts: 11

Re: fun_plug on USB-Stick?

Okay, I've tried SilentException's script now, of course changing the UUID to the proper value, but still:

**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****
Thu May 15 13:10:02 GMT 2008
Found usb-storage.ko module. Copying...
insmod usb-storage.ko
ln -snf /mnt/HD_a2/ffp /ffp
Waiting for F486-21D2 (up to 30 seconds) ...
/dev/sdc1: LABEL="JUMPDRIVE" UUID="F486-21D2" TYPE="vfat"
/dev/sdc1: LABEL="JUMPDRIVE" UUID="F486-21D2" TYPE="vfat"
Success. Found F486-21D2.
Mounting /dev/sdc1 on /mnt/USB
USB stick mounted
* Found FFP on USB device
ln -snf /mnt/USB/ffp /ffp
* Running /ffp/etc/rc ...
./fun_plug: /ffp/etc/rc: No such file or directory
*  OK

That's it... rc doesnt get run and ffp is not started..

Offline

 

#14 2008-05-15 14:10:19

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

i guess you have COMPLETE ffp directory on usb stick (exact copy of the hdd one (the one that works))? if yes, maybe it has to do with fat? chk /ffp/etc/rc file, you can always start telnetd manually from fun_plug and after reboot connect and chk the sym links and everything...


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#15 2008-05-15 14:32:48

grmek
Member
Registered: 2008-05-14
Posts: 11

Re: fun_plug on USB-Stick?

Yeah, I've tried both fresh install from tarball, as well as copying working ffp directory to usb stick - to no avail.

Offline

 

#16 2008-05-16 00:58:18

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: fun_plug on USB-Stick?

Put an echo command in right before attempting to run the rc script with:

Code:

ls -all /ffp/etc/ > /mnt/HD_a2/ls.txt

See what the log returns.  This will let you know if the shell can even find the directory.

Last edited by bq041 (2008-05-16 01:03:01)


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#17 2008-05-16 04:33:46

bspvette86
Member
Registered: 2008-05-09
Posts: 81

Re: fun_plug on USB-Stick?

You might try reformatting your USB drive to use EXT2 with the DNS-323 instead of using vfat.  I ran into problems with symbolic links etc... not working on FAT and do not have those problems using EXT2.

Cheers!
K





PS:  What quekky said!
|                         |
|                         |
|                         |
|                         |
V                        V

Last edited by bspvette86 (2008-05-16 15:05:43)

Offline

 

#18 2008-05-16 12:52:51

quekky
Member
Registered: 2008-03-30
Posts: 20

Re: fun_plug on USB-Stick?

FAT does not have attributes and by default FAT drives are mounted without the execute-flag. It is best to use ext2 for your usb drive.

Offline

 

#19 2008-05-16 18:12:28

grmek
Member
Registered: 2008-05-14
Posts: 11

Re: fun_plug on USB-Stick?

Thank you both bspvette86 and quekky for the tip, that took care of the problem!
It wasn't obvious to me that ext2 has to be used; perhaps it should be stated in the first post or in the wiki along with the manuals how to format usb stick to ext2 under linux?

Cheers!

Offline

 

#20 2008-05-17 08:12:41

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

For ya'll that have successfully formatted your USB stick and moved fun_plug & logs to it... can you please help me out?  I'm still learning Linux, so please forgive me if I'm missing something obvious.

First, a little background:
Since I'm not very experienced, I have been using blbrown's guide to putting fun_plug and the logs on the USB drive.  Here's the link:
http://backupnetclone.sourceforge.net/i … on01a.html

The DNS-323 recognized the memory stick and appropriate size; I can successfully create the partition, but my problem is that whenever I try to format the drive it gets hung up during the "Writing superblocks and filesystem accounting information: " stage.  Here's a screencap (attached).

Any ideas on what's going on?  It's been like this for a good 3 hours, and I'm pretty sure it shouldn't take that long to format a 1GB memory stick.  Thanks in advance...


Attachments:
Attachment Icon stuck.PNG, Size: 31,005 bytes, Downloads: 278

Offline

 

#21 2008-05-17 22:53:04

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

OK, so I let it sit all night, and it did eventually finish the format.  So I continued on with the directions, but after rebooting it did not create the fun_plug.d directory on usb_1.  Here is what my dmesg had to say:

Code:

Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
  Vendor: Memorex   Model: Poker Chip 701B   Rev: PMAP
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sdc: 2004992 512-byte hdwr sectors (1027 MB)
sdc: Write Protect is off
sdc: Mode Sense: 23 00 00 00
sdc: assuming drive cache: write through
SCSI device sdc: 2004992 512-byte hdwr sectors (1027 MB)
sdc: Write Protect is off
sdc: Mode Sense: 23 00 00 00
sdc: assuming drive cache: write through
 sdc: sdc1
Attached scsi removable disk sdc at scsi2, channel 0, id 0, lun 0
Attached scsi generic sg2 at scsi2, channel 0, id 0, lun 0,  type 0
usb-storage: device scan complete
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdc1.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdc1.

What does bogus number of reserved sectors mean?  Is there some sort of command I can issue to check the integrity of the usb drive?

Thanks

Offline

 

#22 2008-05-17 23:21:34

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

i'm not really sure why you're trying to mount FAT system and yet you formated the usb stick with e2fs? smile


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#23 2008-05-18 05:14:12

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

That confuses me as well.  I was kind of hoping blbrown would drop in and offer some assistance, since he's the one that provided the files; or maybe someone else who has gotten this to work knows of some sort of fix?

I don't see anything in the script that specifies FAT vs EXT2, but then again I'm not too familiar with it (attached).


Attachments:
Attachment Icon fun_plug.usb_1, Size: 1,863 bytes, Downloads: 623

Offline

 

#24 2008-05-18 05:21:10

bq041
Member
From: USA
Registered: 2008-03-19
Posts: 709

Re: fun_plug on USB-Stick?

Did you partition you USB stick to Linux first, or just format it to ext2?


DNS-323     F/W: 1.04b84  H/W: A1  ffp: 0.5  Drives: 2X 400 GB Seagate SATA-300
DNS-323     F/W: 1.05b28  H/W: B1  ffp: 0.5  Drives: 2X 1 TB  WD SATA-300
DSM-G600   F/W: 1.02       H/W: B                Drive:  500 GB WD ATA

Offline

 

#25 2008-05-18 06:21:22

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

EDIT: I think I have my problem fixed.  It seems as though it was the classic USB-stick-needs-a-powered-hub routine.  I thought that since it was recognized and partitionable that I wouldn't need independant power.  Alas, 'twas not true.  After hooking up a powered hub, I discovered that the usb stick does indeed have an activity LED, and only takes a few seconds to format.  I believe that I have fonz' fun_plug 0.3 running on the USB stick now.  Once 0.5 is finalized, I will see if I can get that going instead.

Also, for archival purposed (and since I typed it up already), here is my PRE-FIX dilemma:

@bq041: I first used fdisk to partition the drive, and verified that the partition details showed as 83 Linux before formatting.

Also, I tried modifying the script the mount the drive explicitly as ext2, and this is what I got:

Code:

VFS: Can't find an ext2 filesystem on dev sdc1.

It seems pretty clear that I am still having problems either partitioning or formatting the usb stick.  I will re-do and post here with my actions so anyone/everyone can critique.  First, the fdisk partition:

Code:

/ # fdisk /dev/sdc

The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

By the way, should this warning concern me?

Then here's the rest of my partition:

Code:

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3916, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916): Using default value 3916

Command (m for help): p

Disk /dev/sdc: 1026 MB, 1026555904 bytes
16 heads, 32 sectors/track, 3916 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdc1               1        3916     1002480  83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table
/ #

And now I will attempt to re-format:

Code:

/ # mke2fs /dev/sdc1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125440 inodes, 250620 blocks
12531 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
15680 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Writing superblocks and filesystem accounting information:

Now if it behaves anything like last time, this will take many hours to complete.  When it's finished, I will re-post here with a dmesg if there's anything useful.

Last edited by halfsoul (2008-05-18 06:41:34)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB