NSLU2-Linux
view · edit · print · history

HowTo Use shares with two native formatted drives with Unslung 6.8

In Unslung 6.8 I got a problem with the firmware creating unwanted shares. The known errors page for Unslung 6.8 states:

Creating a share, or adding a user with a private share, via the Linksys Web GUI can create two shares: one with the original name, the other with the original name with "~1" appended -- each is associated with a different drive in a two-drive NSLU2 configuration. Since the share directory only actually exists on one of the two drives, only one of the two shares will work. This is not an Unslung 6.x bug -- this is actually completely consistent with the (strange) behavior of the native Linksys R63 firmware. Since the shares are managed by Linksys code for which we have no source code, this is not something that can be changed in Unslung.

I found the following bypass for this problem:

  • Just install and unsling Unslung 6.8 the normal way (I use a 1GB stick on port 1 and a 320GB WD on port 2)
  • Create users with private shares and/or other shares the way you want it. Be careful NOT to reboot yet.
  • telnet into the slug and execute the following copy statements:
    • cp /share/hdd/conf/share/share.info /share/hdd/conf/share/share.info.ok
    • cp /share/hdd/conf/share/smb.conf /share/hdd/conf/share/smb.conf.ok
Now you've saved the definitions of the just created shares to the files ending on .ok. The share.info is used by the linksys firmware to present the shares and users on the web interface, the smb.conf is used by Samba.
  • Now create /unslung/rc.samba with the following content:
#! /bin/sh
# Diversion script: customize Samba config before starting Samba
#
# Reason: alter samba to use original configs instead of the bootup-rebuilds
#
cp -p -f /share/hdd/conf/share/smb.conf.ok /share/hdd/conf/share/smb.conf
cp -p -f /share/hdd/conf/share/share.info.ok /share/hdd/conf/share/share.info
#
# Continue to start samba
#
return 1 
This script will copy your saved configs to the active files just before starting Samba and will overwrite the erroneous files created by the Linksys firmware when booting.
  • Reboot the slug

If you did it right you will now still only see the shares you created, instead of every share duplicated with one with the same name on the other disk and with ~1 appended. Advantage of this method is that you can still use the linksys interface to create shares and users.

Of course you'll have to be careful to do the copy to the *.ok files again after changing anything in the shares and users definitions in the linksys webinterface!

Adriaan

I've tried this workaround and now get strange behaviour. After a reboot the Linksys management GUI shows the shares as I want them, as per this file. But in reality they stay as before with the 'tilde' versions in place. Unless I hit SAVE in the linksys GUI, when they take effect.... for a while.... then they appear to revert again


I've got the same problem and the reason for it seems to be (at least in my case), that the conf partition of disk 1 (/dev/sdb2) on startup is mounted to both conf shares, to /share/hdd/conf as well as to /share/flash/conf, as you can see below:

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
rootfs               153660192 149967244   2131832  99% /
/dev/sdb1                 6528      6332       196  97% /initrd
/dev/sdb1            153660192 149967244   2131832  99% /
/dev/sda1            157393964 155564908    230028 100% /share/flash/data
/dev/sdb1            153660192 149967244   2131832  99% /share/hdd/data
/dev/sdb2               116661     27009     88448  23% /share/hdd/conf
/dev/sdb2               116661     27009     88448  23% /share/flash/conf
return 1 

So anyway on which disk (share.info in the conf dir) you create a share, it is always written to the share.info on disk 1. On reading the shares for each disc the web interface in fact is directed to exactly the same file, assuming, that identical shares have been created on both disks and adding the ~1 thing to the secondly found (non existent) shares of disk 2. After manually mounting sda2 to /share/flash/conf everything is working fine - until the next reboot.

Keks


I have been puzzled by the line:

/dev/sdb2               116661     27009     88448  23% /share/flash/conf

for a while, happy to see I'm not the only one. My suspicion is that this also leads to the system writing to my HDD every once in a while, thereby frustrating my spin down proces which attempts to spin down the HDD after one hour of inactivity.

 BenMcDui

I'm glad that others seem to suffer from the same thing: assigning /dev/sdb2 to both /conf directories of both drives.

# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs               307426936 174358716 129944944  58% /
/dev/root                 6528      6344       184  98% /initrd
/dev/sda1            307426936 174358716 129944944  58% /
/dev/sda1            307426936 174358716 129944944  58% /share/flash/data
/dev/sdb1            480482192  96632024 378968740  21% /share/hdd/data
/dev/sdb2               116661      4144    111313   4% /share/hdd/conf
/dev/sdb2               116661      4144    111313   4% /share/flash/conf
#

How would we be able to modify this behaviour and making it to mount the flash/conf and hdd/conf to sda2 and sdb2 ?? Any suggestions that would survive a reboot or disk hot plug? -- Paul


My suggestion, which I will test shortly, is to write a startup script /opt/etc/init.d/SnnRemount, which unmounts /share/flash/conf and mounts sda2 on /share/flas/conf. Details will follow soon!

BenMcDui on 20080417


BenMcDui on 20080508: This is my recipe: Take your HDD to an other machine to remove partition sdb1. I did it on a PC with Knoppix, and also on a PC with PartitionMagic?. The latter gives me a better feeling of control; it can delete, extend, format partitions even in ext2 and ext3. So I got rid of sdb2 and added its space to sdb1. I then went back to the slug and connected the HDD. It doesn't mount automatically anymore so you need a script in /opt/etc/init.d like Snnmount_sdb1, containing the command

mount /dev/sdb1 /share/hdd/data

Maisondouf on 20080512 Firmware Version: V2.3R63-uNSLUng-6.10-beta

Take a look at an other kind of solution: CorrectBadSharingWithTwoDrives

Alain.

view · edit · print · history · Last edited by MarkHu.
Based on work by maisondouf, BenMcDui, paul, Keks, NickLe, and adriaan.
Originally by adriaan.
Page last modified on September 20, 2008, at 10:15 AM