Samba Autostart

Here is a complete guide by danwood76 Some of this has been directly copied from the blogspot page

Download the debian environment from this link

unzip it to the fat32 partition on the ME1 when connected through USB. (the fat32 partition is the one you put the videos on)

Start a telnet session

cd /usr/local/etc/hdd/volumes/HDD1/
mkdir chroot
mount -o loop -w ./debin-4g.ext2 ./chroot
chroot ./chroot
mount -t proc proc /proc

now you need to find out what your hard disk is assigned to:
fdisk -l

should give you something like this:
Disk /dev/hdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               2       34049   273490560    b  W95 FAT32
/dev/hdb2           34050       35097     8418060   83  Linux
/dev/hdb3           35098       38857    30202200   83  Linux
/dev/hdb4           38858       38909      417690    5  Extended
/dev/hdb5           38859       38878      160650   82  Linux swap / Solaris
/dev/hdb6           38880       38899      160650   83  Linux

so my fat32 partiton is /dev/hdb1, on the blogspot his was hda1, whatever yours is whenever /dev/hdb1 is mentioned replace it with the appropriate letter.

mkdir /mnt/hdb
mount -t vfat /dev/hdb1 /mnt/hdb
apt-get update
apt-get install samba

Answer all the defaults to the questions samba asks, it doesnt matter as I have my own config file.
Which we will setup now:

rm /etc/samba/smb.conf
nano /etc/samba/smb.conf

Paste the following into that nano window, nano is a nice standard text editor.

workgroup = workgroup
netbios name = ME1
server string = video-server
include = /etc/samba/dhcp.conf
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 50 syslog = 0
guest account = root
security = share
encrypt passwords = false
hide unreadable = yes

comment = NAS Video Share
path = /mnt/hdb
read only = no
public = yes
veto files = /chroot/debin-4g.ext2/

Change the workgroup above to be whatever your windows workgroup is
Then press ctrl+o and ctrl+x to save and exit.
Now to restart the samba daemon and see if the share works:
/etc/init.d/samba restart

What a few minutes and with a bit of a luck you should see the ME1 on your windows network and within that you should see your Video share folder
Now its time to setup the auto boot script.
First we need to add the drive info to the fstab to make it easier to mount:

nano /etc/fstab

and paste the following line at the end of the file:

/dev/hdb1       /mnt/hdb        vfat    defaults                0 0

obviously changing to /dev/hdx1 if yours is different.
Now thats all setup its time to make the init script.

heres my script:


sleep 60
mount -o loop -w /usr/local/etc/hdd/volumes/HDD1/debin-4g.ext2 /usr/local/etc/hdd/volumes/HDD1/chroot
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount -t proc proc /proc
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount /mnt/hda
chroot /usr/local/etc/hdd/volumes/HDD1/chroot /etc/init.d/samba start

Save this to the root of the samba share (same place we saved the debian system to) and we will manipulate it from within the telnet session.

So we need to exit the debian session and back into the plain ME1 system


That should leave us with the prompt like so:

/usr/local/etc/hdd/volumes/HDD1 #

Then we need to move the script to the /usr/local/etc directory

mv /usr/local/etc/

and we need to make it executable

cd /usr/local/etc
chmod aog+x

and finally add that to the initialisation script (rcS)
vi rcS

vi is quite a hard to learn text editor but is the only one available on the ME1 system, luckily you dont have to do a lot.

first press 'i' on your keyboard to enter insert mode
then scroll to the bottom with the down arrow key and paste the following line:

sh /usr/local/etc/ &

then press escape to exit insert mode and type :wq and press enter to save and quit.
Now the setup is complete, time to test it out so type:


To reboot the system, in a few minutes the samba server will be running and you should be able to see all your videos as if it were a NAS drive.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License