NSLU2-Linux
view · edit · print · history

Due to problems when two native formated drives are connected to the nslu2, I have tried to understand along the forums and the HowTo, how my slug can have this curious behaviour when rebooting.

In fact, two problems are distinct :

1- the 'conf' partition of the first disk on USB 1 is mounted two times :

   /dev/sdb2 on /share/hdd/conf
   /dev/sdb2 on /share/flash/conf

2- the samba server, due to the first problem, find two times the same file 'share.info' in the two mounted directories.

The result of that is to have duplicated shares with '~1' at the end for disk1 and no more shares for disk2...

I have found the begining of an answer here : HowTo.UseSharesOnTwoNativeDisksInUnslung68

But the mis-mounted partitions are already there and the risk to forget updating the backup file is important.

So, I have tried to create a little script to dismount and remount the 'conf' partitions in the good place.

I have wrote this and it make exactly what I want it make, but I do'nt know really where I have to put it to be executed at startup before samba begin to run.

#! /bin/sh
# Essai de rebricolage automatique des partitions mal montées
# try to automaticly repair mis-mounted partitions

# mount result after boot
#/dev/root on /initrd type jffs2 (rw)
#/dev/sdb1 on / type ext3 (rw)
#proc on /proc type proc (rw)
#usbdevfs on /proc/bus/usb type usbdevfs (rw)
#/dev/sda1 on /share/flash/data type ext3 (rw)
#/dev/sdb1 on /share/hdd/data type ext3 (rw)
#/dev/sdb2 on /share/hdd/conf type ext3 (rw,sync)          ]  2 times the same partition -> sharing errors
#/dev/sdb2 on /share/flash/conf type ext3 (rw,sync)        ]  2 fois la même partition -> erreurs de partage

#
# d'abord demonter tout à la barbare
# first all unmounting like Mc GYVER

umount -f /dev/sdb2
umount -f /dev/sdb2


#
# puis remonter ce que l'on a besoin et dans l'ordre
# and remount only what we need and in the good order

mount -t ext3 /dev/sda2 /share/flash/conf
mount -t ext3 /dev/sdb2 /share/hdd/conf

# résultat après lancement de /etc/my_mount
# result after running /etc/my_mount

## /etc/my_mount
#umount: forced umount of /dev/sdb2 failed!
#umount: cannot umount /dev/sdb2: Invalid argument

## mount
#/dev/root on /initrd type jffs2 (rw)
#/dev/sdb1 on / type ext3 (rw)
#proc on /proc type proc (rw)
#usbdevfs on /proc/bus/usb type usbdevfs (rw)
#/dev/sda1 on /share/flash/data type ext3 (rw)
#/dev/sdb1 on /share/hdd/data type ext3 (rw)
#/dev/sda2 on /share/flash/conf type ext3 (rw)   } each partition have its own mounting point
#/dev/sdb2 on /share/hdd/conf type ext3 (rw)     } chaque partition a son propre point de montage

return 1

If a nslu2-linux senior can spend some of his time to implement this in the startup of unslung, this will be wonderfull for everybody...

Alain

Last minute : I've found the good place to include my script ! ! !

It's in '/etc/rc.d/rc.1' just before this line

/bin/echo  "Restore usrgrpshares:"; /etc/rc.d/rc.reset_usrgrpshare; check_status

You put only this :

. /etc/my_mount

So just before '/share/hdd/conf/share.info' and '/share/flash/conf/share.info' are concatened into '/share/hdd/conf/samba/share.info', the mounting points will be OK...

Alain.

view · edit · print · history · Last edited by maisondouf.
Originally by maisondouf.
Page last modified on May 18, 2008, at 10:20 AM