BeerTripper Off-Topic

Puppy Linux Tricks

02/13/2011

Turning my old laptop into Network Attached Storage

   First off, this example is using Puppy Linux 2.17 which is not the latest version of Puppy currently at 5.2 and I fully realize that other instances of Linux, like Ubuntu, would come with Samba preinstalled.  However, I already had a lot of experience with Puppy 2.17, and most other current versions of Linux, like Ubuntu, are way to big to work on this old computer that I pulled out for this task.  (In addition, I was unable to find the system requirements of the latest Puppy 5.2, but I knew 2.17 was capable of running on the old hardware as I had it currently running performing another task, now I just wanted to add NAS to its work load.)

So, how do you get an old computer, running Puppy Linux 2.17 to act as NAS (network attached storage)?

Step One was to download the following Pet file and install it...
samba-tng-rcrsn-0.5-rc1.pet

The above installs a Samba server onto Puppy.  Now to configure it,... so,... open /.usr/local/samba/etc/smb.conf

This is the samba configuration file.  The changes I made there were as follows...

I put it in my network's workgroup by changing the workgroup = line to...

workgroup = myworkgroup

Where myworkgroup is the name of my network's workgroup.

Then, I removed the ; in front of the line which reads...

map to guest = Bad Password

Then, under [pupshare] I changed the Path to match the one I wanted to use  (ie the folder I wanted to share)...

path = /mnt/hdc3/pupshare

Now, I wanted Samba to start every time my computer booted.  I think normally this would be done by editing /etc/rc.d/rc.local, however, I've found that things placed there in Puppy 2.17 don't always work, and I found that was even the case with Samba, so I placed it in... .xinitrc.

Before the commented lines #exec $CURRENTWM and #v2.11 I put the following....

sleep 5
samba-start

So that area of the .xinitrc file looks like....

sleep 5
samba-start

#exec $CURRENTWM
#v2.11 GuestToo suggested this improvement...

Now this may have been all that was needed, but in my case, hdc3 was not a drive that was already mounted upon every boot/reboot so I needed to make sure that hdc3 was mounted upon reboot, so I made some scripts that would mount and unmount hdc3.

For the mount script it was simply...

#!/bin/sh
mount -t vfat /dev/hdc3 /mnt/hdc3

I saved this as /root/my-applications/mntboot.sh giving it full executable permissions.  Obviously in your case this command would have to be customized to your situation.  I strongly suggest using the commands 'mount -v' and 'df -h' to acquire the partition Type and mount points.

For the unmount script I wrote two executable scripts.  One that simply unmounts, and one that unmounts and reboots.

For simply unmounting I made the following, saving it as,... /root/my-applications/umountonly.sh.

#!/bin/sh
samba-stop
sleep 5
umount /mnt/hdc3

Rebooting is tricking in Puppy 2.17, only because it uses a command that I haven't really seen before, at any rate, I made the following script for unmounting then rebooting and saved it as,... /root/my-applications/umountdown.sh.

#!/bin/sh
samba-stop
sleep 5
umount /mnt/hdc3
sleep 1
wmreboot
Now, since I wanted the drive to be mounted before Samba started on every reboot, I once again edited .xinitrc.  This time I added my reference line right before the CURRENTWM ="`cat /etc/windowmanager`" line so that area of .xinitrc now looks like this...
fi
/root/my-applications/mntboot.sh &
CURRENTWM="`cat /etc/windomanager`"


To test you may want to get in the terminal and manually start the different scripts...

To start samba...(obviously if your share folder is already mounted, you have no need for the mntboot.sh script)...

/root/my-applications/mntboot.sh

If you have say a Windows computer on your network you can then right click the desktop and choose new shortcut.  A window should pop up that says type location of the item.  You can type \\pupserver (or substitute the ip address of your Puppy Linux computer running your pupserver for the name pupserver) and click next.  It should then put in a name for the shortcut, click finish.  This will put the shortcut on your desktop.  Now to access it, simply double click the icon.  The first time you will be asked the username and password.  The username is... root and the password is... woofwoof.  You should then be able to see the files on your pupserver and transfer files to and from this server.

To stop Samba...

/root/my-applications/umountonly.sh

Assuming that went OK, you can now start it all back up then try the unmount with reboot script.

/root/my-applications/umountdown.sh

If all is well, your share drive should unmount, your Samba should shut down, then your computer reboot with Samba on and your Share Drive mounted and usable.  (Personally, I like to give my NAS puppy a Static IP to further reduce any connection problems.)

Puppy Linux little Logo

 

Back to Off Topic


Beer Review Index

BeerTripper

Off Topic