Hidden Linux : DIY File Server

Networked storage is becoming a must-have for many home users. It's great for doing backups and sharing files between a variety of machines, irrespective of their operating systems, so over the weekend I added an old 60GB hard disk to an even older 386 PC and built my own. It's surprisingly easy!
Server-side Setup
- Download and burn Ubuntu LTS Server Edition to a CD.
- Install it on your server. Near the end of the installation you'll be prompted for the server types to install. Choose Samba.
- Log in and note the IP address ("inet addr") that's been assigned to it by typing ifconfig. (In my case this was 192.168.1.101)
- Create directory to share the network. I typed mkdir shared_stuff to create the directory shared_stuff in my home directory, /home/geoff.
- Add these details to the bottom of Samba's configuration file, smb.conf. To edit it, enter sudo nano /etc/samba/smb.conf. Here's what I added...
path = /home/geoff/shared_stuff
guest ok = yes
read only = no
- Force Samba to reload the new details: sudo /etc/init.d/samba reload
Client-side Setup : Linux
(You can go all of the following using GUI tools but these vary depending on your distro and window manager. Console commands will work with all Linux flavours.)- Install smbfs, which includes the more up-to-date cifs: sudo apt-get install smbfs
- Create a folder to mount the remote directory: sudo mkdir /media/remotestuff
- Test you can connect to it. Here's my command. The coloured bits are the parts you'll need to set for yourself...
| sudo mount -t cifs //192.168.1.101/shared /media/remotestuff -o username=server_username,password=server_password,iocharset=utf8, file_mode=0777,dir_mode=0777 |
|
Common
Errors
mount error: can not change directory into mount target... You either didn't create the folder /media/remotestuff or entered it incorrectly in the mount command. mount error 13 = Permission denied Your server username and /or password are wrong. mount error 6 = No such device or address The share name specified in your mount command isn't being found on the server. |
You can continue mounting the share manually, but you'd have to do so every time you boot your PC. It's better to automate the process, so...
- Create and edit a .smbcredentials file: sudo nano /root/.smbcredentials. Add the following lines:
password=server_password
- Edit the File System Table: sudo nano /etc/fstab and add the necessary details. (If your folder names contain spaces, you must replace them with "\040". So folder name should become folder\040name.)
| //192.168.1.101/shared /media/remotestuff cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0 |
- Save and close /etc/fstab.
- Type sudo mount -a to mount the remote share and you're done.
Client-side Setup : Windows
- Open My Computer
- Click on Tools / Map Network Drive
- Choose a drive letter and click Browse.
- Under Microsoft Windows Network, browse to the appropriate server and folder.
- Click OK
- Ensure Reconnect at Logon is ticked and click finish.
Remote Server AdministrationBefore I buried my file server away in a cupboard without keyboard, mouse or monitor, I ran this command to install SSH: sudo apt-get install openssh-server Now I can log in to the server from my desktop and administer it remotely. To connect, enter ssh serveripaddress (so in my case I typed ssh 192.168.1.101) SSH needs a little configuration. (You can do this remotely!) Edit the configuration file /etc/ssh/sshd_config and...
|
<--Previous Hidden Linux Next Hidden Linux -->



Comments
I installed ssh for remote admin -- now how do I access the server through windows?
Posted by: Jeff | March 31, 2009 4:04 PM
I probably missed something, but the purpose of a file sever is that you can share your files or even better--backup you PCs' file to that server. A 386 are not such a problem as the CPU goes, but its hard drive space are greatly limited by its BIOS or IDE hard drive interface. In short, there are not much storage space for
a file server and it couldn't expend much as well. That is why I have a hard time to find a as cheap as disposable file server and I ended up buying a Celeron D one. It seems over kill, but it got SATA interface and lot of USB ports which could put some of my USB drive into use.
But once again, the idea of a old 386 could be used as a file sever and works well is really fantastic!
Despite I use both Ubuntu and Gentoo in my house, I am really looking forward to put
Debian 5.0 into it. Gentoo is lean and fully hand optimized, but compile on such a old machine is against my law:-)
Once again, as always, great article, and make me really want to build my server ASAP.
Posted by: Peng | March 17, 2009 3:24 PM
I'm surprised you managed to get the BIOS on an old 386 to even recognise a 60GB drive Geoff :)
I've been messing with a similar file server using the same ubuntu server and several hard drives. But a cant seem to get it to auto-mount the shared drives on bootup.
And I wish samba setup was as easy as windows client-side setup, instead its a nightmare of trial and error - in my case mostly error :)
When I regain some enthusiasm I will try your method..
Posted by: chris | September 10, 2008 5:51 PM
Very nice article. I've been using a similar setup for about a year now. I have one computer using Ubuntu Server Ed. (as you suggest) but I also have another one running Gentoo. As nice as Ubuntu is, imo, Gentoo makes the better server. Either way - good article, I liked it.
Posted by: Prime | September 10, 2008 12:05 AM
Minor typo: the instruction "cd shared_stuff" should be "mkdir shared_stuff" - sans the quotes of course.
:-)
----------------------------------------
Well spotted. Thanks, Adrian!
-Geoff
Posted by: Adrian | September 9, 2008 1:29 PM