On this post I will explain howto install samba on Voyage Linux 0.5 version. Voyage Linux is the distribution I have installed on the minimotherboard Alix.
As you should know the systme doesn’t use a hard disk, It uses a Compact Flash memory card, that makes the hard disk functionality, I have a 8Gb compact Flash memory card where I have all teh space that I need.
the main disavantage of Compact Flash media, is that they are not writable every times you need, They have a nunmber of times you can rewrite, this number is high, between 300 thousand to million, that is the reason taht all the system, the voyage Linux distribution, is mounted read-only. you have two scripts, “remountrw”, to mount the filesystem with write permissions, and “remountro” to remount read only.
Moreover we have to take this into account on all the applications that need to write on disk.
RAM writable directories
Due that a lot of apps need to write in order to run, Voyage Linux, have a memory mounted partition where you can write, that is space is small (memory space), and is not permanent, you lost it where the system is rebooted.
The trick is that exists a directory called /ro where is all the information that will be copied to teh volatile directory on boot-time, the script taht makes that copy is on
/etc/init.d/mountall the last line makes the copy using tar ,
tar -C /ro -cf - . | tar -C /rw -xf - > /dev/null 2>&1
And then when you need a writable directory yo make a link to the /rw directory, we can see an example with the var directory.
/var# ls -l
drwxr-xr-x 2 root root 4096 Jul 3 06:25 backups
drwxr-xr-x 6 root root 4096 Jun 26 16:34 cache
drwxr-xr-x 2 root root 4096 Jun 26 23:20 ccxstream
drwxr-xr-x 14 root root 4096 Jun 28 18:57 lib
drwxrwsr-x 2 root staff 4096 Oct 28 2006 local
lrwxrwxrwx 1 root root 12 Apr 15 00:28 lock -> /rw/var/lock
lrwxrwxrwx 1 root root 11 Apr 15 00:28 log -> /rw/var/log
lrwxrwxrwx 1 root root 12 Apr 15 00:28 mail -> /rw/var/mail
drwxr-xr-x 2 root root 4096 Feb 17 01:22 opt
lrwxrwxrwx 1 root root 11 Apr 15 00:28 run -> /rw/var/run
lrwxrwxrwx 1 root root 13 Apr 15 00:28 spool -> /rw/var/spool
lrwxrwxrwx 1 root root 11 Apr 15 00:28 tmp -> /rw/var/tmp
drwxr-xr-x 3 root root 4096 Jun 30 23:27 www
howo to install Samba
One interesting function our embedded is file sharing, we can share flash contents and contects mounted on usb ports.
This are the way to have it working:
#apt-get install samba
since this point, It would be a normal samba installation on Debian, but if you try to boot samba it complans about file write permissions on the files located on /var/lib/samba, however samba works perfectly with remountrw, moreover we have to “convert” that files in writable ones.
INSTRUCCTIONS to make a writeble directory and make Samba works.
0.- We enable write permission ans install samba
apt-get install samba
1.- Copy the directory /var/lib/samba to /ro/var/lib/samba
tar -C /var/lib/samba -cf - . | tar -C /ro/var/lib/samba -xf -
2.- create a symbolic link from /rw/var/lib/samba to /var/lib/samba
mv /var/lib/samba /var/lib/samba.ori
ln -s /rw/var/lib/samba a /var/lib/samba
3.- Create a script to rewrite the files in case we made a modification we want persistent.
echo "tar -C /rw/var/lib/samba -cf - . | tar -C /ro/var/lib/samba -xf -" >/usr/local/bin/recopysambafiles
chmod +x /usr/local/bin/recopysambafile
4.- Reboot the server
smbpasswd -a nasuser
We can check, It should work!! 🙂 The user could imagine with that example how to make work other apps like emule.