Following my previous article on setting up the Futro S400 and installing Debian 7 "Wheezy," I now want to share how I turned this small, energy-efficient system into a sort of Mini-NAS (Network Attached Storage). This NAS acts as a network drive for media, backup, or other storage purposes, allowing access to files across the network – from your computer to your TV via a PlayStation 3, for example. In my case, I used a local 2 TB Western Digital hard drive as a backup drive, also serving for streaming to the TV or for accessing important data remotely via VPN.
1. The Concept
The Futro S400, with only an internal IDE connection, isn't quite cut out to be a true NAS system. But that's not a big issue, as those needing a real NAS solution would typically go for dedicated NAS hardware or an ITX PC with a suitable case for hot-swappable drives. However, since I had an external hard drive lying around, I decided it would suffice for backup and access purposes. By connecting the hard drive to the Futro S400 via USB and configuring it to share over the network, anyone on the network can access it. I also password-protected this network share for added security when friends connect to the WLAN. Here’s how it's done.
2. Setting Up the Hard Drive
Since our Debian has no graphical interface, we use terminal tools for this process. I perform all commands as root (logging in with "su"). The dollar sign ($) indicates the input prompt where I enter commands, while the rest is output. When you connect a drive, nothing apparent happens. All detected drives (and other hardware) appear in the /dev/ directory. Hard drives (S-ATA, the standard these days) will show up as /dev/sda1, /dev/sdb, /dev/sdc5, etc. The challenge is identifying which one corresponds to the external hard drive. The simplest way is to check the system's recent activities as root:
$ dmesg
[...]
[ 4392.852068] usb 1-3: new high-speed USB device number 2 using ehci_hcd
[ 4392.985446] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4392.985467] usb 1-3: Manufacturer: Western Digital
[ 4393.082281] Initializing USB Mass Storage driver...
[ 4393.083046] usbcore: registered new interface driver usb-storage
[ 4393.083057] USB Mass Storage support registered.
[ 4394.088746] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 4394.089541] sd 2:0:0:0: [sdb] Write Protect is off
[ 4394.090501] sd 2:0:0:0: [sdb] No Caching mode page present
[ 4394.090537] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 4394.095370] sd 2:0:0:0: [sdb] No Caching mode page present
[ 4394.095412] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 4394.139209] sdb: sdb1 sdb2
[ 4394.146856] sd 2:0:0:0: [sdb] No Caching mode page present
[ 4394.146895] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 4394.146925] sd 2:0:0:0: [sdb] Attached SCSI disk
After connecting the drive and waiting a moment, run dmesg again. You should see a new entry indicating a Western Digital device detected at USB port 1-3. This means the hard drive has been recognized (as "sdb" in this case) but not yet mounted. We then display all partitions of the drive:
$ ls /dev/sdb*
/dev/sdb
/dev/sdb1
/dev/sdb2
The drive (sdb) has two partitions (sdb1 and sdb2). Since it was previously connected to a Windows machine and formatted with NTFS, we’ll mount it using the NTFS driver. Debian Wheezy doesn’t come with an NTFS driver suitable for read/write operations, so we need to install it first and then mount the drive under /media/exthdd.
$ apt-get install ntfs-3g
$ mkdir /media/exthdd
$ mount -t ntfs-3g /dev/sdb1 /media/exthdd
# Error message appears, indicating sdb1 is not NTFS-formatted, so we try sdb2
$ mount -t ntfs-3g /dev/sdb2 /media/exthdd
With sdb2, the drive mounts successfully. Now, we can share the "/media/exthdd" directory over the network.
3. Installing Samba and Creating a User
If, like me, you selected "File Server" during the Debian installation, you've saved yourself a step, as Samba is already installed. Samba is a software for Linux that enables folder sharing in a mixed (Windows + Linux (+Mac)) network. We install Samba and then create a user who will be used to access the share from Windows. This user is also assigned a password.
# If not already installed, then install samba
$ apt-get install samba
# Create a user and set a password
$ adduser jose
$ smbpasswd -a jose
4. Configuring Samba
Next, we configure Samba to share our hard drive, but only accessible with José’s credentials. We find Samba's configuration file at "/etc/samba/smb.conf". We rename the original and create a new smb.conf file:
# Rename smb.conf to smb.conf.orig and create a new smb.conf
$ mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
$ touch /etc/samba/smb.conf
# Edit smb.conf, for example with vim or emacs
$ vim /etc/samba/smb.conf
In vim, press "i" to insert content, which looks like this:
[global]
workgroup = LOCAL
security = user
encrypt passwords = yes
[homes]
comment = Home Directories
browsable = no
read only = no
create mode = 0750
[festplatte]
path = /media/exthdd
available = yes
writable = yes
comment = smb share
guest ok = no
valid users = jose
create mask = 0644
directory mask = 2777
Exit Insert Mode with ESC, then type ":wq" to write and quit. Test the smb.conf file:
$ testparm
If no errors, restart Samba:
$ /etc/init.d samba restart
5. Automounting the Hard Drive at Startup
We previously mounted the drive with "mount -t," but we want it to mount automatically at "/media/exthdd" at every system start. For this, we add an entry in "/etc/fstab":
$ vim /etc/fstab
# add the following at the end:
#external hard drive
UUID=12345678912345E6 /media/exthdd ntfs-3g rw,uid=1001,gid=1001,dmask=0002,fmask=0003 0 0
Save and exit vim. The drive will now automatically mount at each startup.
6. Accessing from Windows (or Mac)
The system is ready. Access the network share from Windows by entering the server's IP address in the address bar, e.g.,
192.168.0.5
Log in with José's credentials to access the "festplatte" folder. The drive may take a moment to spin up.
Our Fujitsu Futro S400 with Debian 7 "Wheezy" is now a functional Mini-NAS with restricted network access. While not as fast as a dedicated NAS (due to USB 2.0) and lacking in aesthetics, it’s a great start and excellent for network backups, thanks to the Futro S400's Gigabit Ethernet.
Do you have a similar setup at home or use a dedicated NAS? I hope this guide has been helpful. If you encounter any issues following these steps, please leave a comment, and I'll see what I can do to help!
2 Kommentare
Kommentar hinzufügen
28. Juni 2014, 19:07 Uhr
Peterhi sven, habe bisher puppy linux oder tinycorelinux benutzt, bei denen das mounten anderer partitionen der festplatte eingebaut war. habe gerade debian wheezy + lxde (live) runtergeladen und auf freier partition installiert, konnte allerdings keine andere partition mounten. habe deine beschreibung nach viel lesen in docs und manuals angewendet: SUPER !!! alles mountet beim start. ganz herzlichen dank. peter
02. Dezember 2013, 16:07 Uhr
RolandHi Sven, habe soeben anhand Deiner Super-Beschreibung mein RaspberryPi zum NAS gemacht. Bin ein Linux_Neuling, aber dank Deiner Hilfe hat alles wunderbar geklappt. Was würden wir ohne Menschen wie Dich machen????
Frohe Weihnachten und einen guten Rutsch
Roland