Setup a simple NAS device?


Recommended Posts

I've aquired an old PC from a mate at work. It's fairly old and under-spec'd (by today's standards), but I think it might be ideal for use as a NAS device. Specs are:

Celeron 900mhz

128Mb

Onboard graphics

80Gb HD (the "jewel" in this system)

In addition, I've got a spare 40Gb HD, which I'll probably put in it as well.

First things first, I have to admit that I don't know much about Linux and how it really works, but I've been using Ubuntu exclusively for the last 6 weeks or so and I'm loving every minute of it. Plus, I've picked up a bit of knowledge and a few tip and tricks here and there.

Currently, the PC has got XP installed on it, but it's in a terrible state. I spent nearly a whole day trying to remove spy/ad/mal-ware and numerous virii. What I'd really like to do is wipe the drive and install a Linux distro on it instead. I've got an Ubuntu Live CD, but because of the low specs, it simply can't get to the Gnome desktop.

So my question is... can you guys recommend me a simple (read: lightweight) distro that I can put on this machine? I'd like to be able to run the CD, maybe setup a few apps, then leave it. I've read about Ubuntu Server, which looks like it might do the job, but I'm fairly certain I won't be needing any kind of webserver - I just want a central location where I can dump all my media files, so that they can be accessed by any device connected to my network. The whole webserver setup seems like overkill to me. I've read that Samba might be the tool I need, but that's about all I know about it.

Your advice please?

Link to comment
https://www.neowin.net/forum/topic/574196-setup-a-simple-nas-device/
Share on other sites

Ubuntu certainly is one way to go. if you do choose to do that, make sure you've downloaded and installed smb (Samba), (you can do this via apt-get), then read

SMB-HOWTO

This will apply to any Linux based OS running SMB. I started out learning this with Redhat. There are a few dedicated NAS distro's out there I think but i've never used them. personally I just bought a Synology DiskStation in the end and ran that. Your system is consuming at least 250W, mine is about 18W :p

Yours will have more potential functionality though, as its a Server, not an appliance.

TLDP (The Linux Documentation Project) is your friend! :D

One thing I will say, is that Samba should really be configured by hand, using the config files, not using a silly GUI or anything. If you're going to keep using Linux, make sure you learn it from the command line. anyone can use a GUI, but you'll never really find out what it is doing behind the scenes. Try to do everything via command line.

After you've done SMB, configure SSH. If you're feeling really adventurous, maybe try your hand at IPTables (NAT Gateway) or Apache (Webserver). I know you said you don't think you'll need them, but they're good skills to have.

If you want a nicer way to admin stuff, try installing Webmin. its a free web-based administration package which is rather nice to have onboard.

If you want to save time (not that setting up a SMB server takes a lot of time if you know the basics) but this might help you see if you find an SMB server convienient. Try FREENAS: http://www.freenas.org/. I have a system PII 266 running on it for a while now.

  DrunkenMaster said:
If you want to save time (not that setting up a SMB server takes a lot of time if you know the basics) but this might help you see if you find an SMB server convienient. Try FREENAS: http://www.freenas.org/. I have a system PII 266 running on it for a while now.

(Y)

Thanks for your replies.

I did originally intend to buy a dedicated NAS device. I liked the idea of simply plugging the box into my router and being able to use it straight away. Then this PC came up, and I started to consider that instead as a much cheaper way of doing it. I didn't consider the running costs, though, so that's a good point.

FreeNAS looks very interesting. That seems to be exactly what I'm looking for. I'll have to look at it more closely.

Forgot to mention.... If you are using an older system, you do have to obey the BIOS limitations on HDD size, unless of course you use a RAID card which FreeNAS supports (*all* supported hardware is listed on the website). You don't need to use it for RAID-per-se just to add more HDDs and get around BIOS limits. Overall, a nice system with a web-based admin package. I'm happy with it.

  • 3 weeks later...

Quick question before I take the plunge on this.... I understand that FreeNAS needs it's own file system (UFS), but I've got a NTFS-formatted drive with about 30GB of music on it. Would I be able to simply install this second drive in the FreeNAS box and then copy all the files over to the FreeNAS data partition?

  Mr Fish said:
I understand that FreeNAS needs it's own file system (UFS), but I've got a NTFS-formatted drive with about 30GB of music on it. Would I be able to simply install this second drive in the FreeNAS box and then copy all the files over to the FreeNAS data partition?
Where did you get that IDEA???

http://www.freenaskb.info/kb/?View=entry&EntryID=205

NTFS ? Originally found on Windows NT/2000/XP/Vista. You can mount this type of file system for read-only. Writing on NTFS can give you unexpected results(data lost). You can?t format(create a new NTFS partition) and run fsck(file system check) on FreeNFrom version 0.684b, FreeNAS will fully support read+write on NTFS volumes. However FreeNAS can?t format and fsck an NTFS volume.e.

You can mount your NTFS disk without any problems.. there is NO reason you have to format it to UFS. That is just the native file system for freenas.. It supports other file systems - see above link.

Well, installation and setup was a painless experience. I've apparently got a FreeNAS server. I say apparently, because I can't actually use it, and I'm not sure why. I used the PDF guide to set it up. I found this nugget on the FreeNAS knowledge base on how to mount a NFS share:

  Quote
sudo su

Password : ubuntu (or your root password)

mkdir /mnt/freenas

mount –t nfs 192.168.1.250:/mnt/share /mnt/freenas

ls /mnt/freenas

The mount point directory on local machine (/mnt/freenas in the above example) must exist.

Obviously, I changed the IP to the address of my server (192.168.1.66). I'm slightly confused here as to what it's saying. The "/mnt/share" bit after the IP address indicates an area on the server. How do I know if this actually exists? Becuase:

root@el-crappo-lappo:/home/fish# mount -t nfs 192.168.1.66:/mnt/share /mnt/freenas
   mount: 192.168.1.66:/mnt/share failed, reason given by server: Permission denied

Also, what exactly does this lot mean?

post-94504-1187117258_thumb.jpg

Firstly, the subnet is correct, but I'm not sure about the "/32" bit at the end. And what does it mean by "The name of the exported directories are /mnt/sharename".

I was impressed with how easy FreeNAS is to setup, but it seems like I'm just stumbling at the final hurdles.

Edit: just a quick thought.... do I have to forward any ports on my router?

  Mr Fish said:
how to mount a NFS share:

Obviously, I changed the IP to the address of my server (192.168.1.66). I'm slightly confused here as to what it's saying. The

Um.. in your OP, you state you know nothing of linux.. But yet your running NFS shares??

I think your confusing NFS with SMBFS ??

Are you trying to mount a share off a windows machine?? NFS is primarily the nix world

http://en.wikipedia.org/wiki/Network_File_System_(protocol)

I find it HIGHLY unlikely you would be using NFS shares off some windows machine -- it is possible, but unlikely since you state you do not know anything about linux.

in the nix world to mount a windows share it would be smbfs

you could use smbmount

smbmount //servername/sharename /mountdirectory -o username=mywindowsusername,password=mywindowspassword

Or mount with the smbfs

mount -t smbfs //servername/sharename /mountdirectory -o username=mywindowsusername,password=mywindowspassword

Not sure why you would want to do this? Would not be putting the NTFS drive you have into the NAS hardware.. If your just to mount a share off a windows system? What was the reason for asking if freenas supports ntfs?? Its support for ntfs would only come into play if it was directly attached an mounted.. Across a network share would have nothing to do with the filesystem on the disk, etc. As long as the system sharing it understands it ;) An why would you need freenas -- just access the drive off the share its in, etc.. ???

I may have confused the issue a little by mentioning the NTFS drive. I'm not using it right now (it isn't installed in the machine). Basically, I've installed FreeNAS onto the 80gb hard drive and let it partition the rest of the space itself for data storage.

I freely admit to not knowing much about Linux, or indeed networking in general. I'm treating this whole exercise as a learning experience, with practical benefits.

I know FreeNAS will let me setup Samba (or CIFS as it like to call them) shares, as well as Linux NFS shares (and a whole bunch of other stuff which I might get to in due course). As I'm using a laptop running Ubuntu, I went for the seemingly correct option of activating the NFS service in FreeNAS. My reasoning being that it should be simpler to setup than trying to go down the Samba route in Linux. For now, this is all I want from FreeNAS. A "networked" or "shared" drive (not sure of the correct terminology) that I can copy files to from my laptop (mp3's in this case), and be able to access them via whatever media player I decide works best for me. Bottom line is I'm quickly running out of space on the laptop and need somewhere to store them.

Despite following the instructions, I seem to have done something wrong somewhere because although I can access the web GUI, I can't seem to do anything else. The "data" partition is formatted (freeNAS does this during installation) but I'm unsure how to mount that partition onto my laptop. I can mount and unmount it fine via the GUI (the partition is listed as "NAS_Media (disk: /dev/ad0 Partition: s2). What I need to know is how to "add" that partiton to my Ubuntu file system. In my mind, this should be correct:

root@el-crappo-lappo:/home/fish# mount -t nfs 192.168.1.66:/mnt/NAS_Media /mnt/freenas
 mount: 192.168.1.66:/mnt/NAS_Media failed, reason given by server: Permission denied
 root@el-crappo-lappo:/home/fish#

... at least, based on what I found on the knowledge base.

Yes, I am a little out of my depth. But that's the fun isn't it? And how are you going to learn without trying? I've tried. I don't know what to do next, so I'm asking here for help.

So did you create the NFS share on the freenas? Where did you mount the disk? is it /mnt/NAS_Media ?

the network set for authorized would not be a net mask, ie would be a network.

So your freenas server 192.168.1.66 255.255.255.0 I assume?

An your laptop is say 192.168.1.67 255.255.255.0 let say.

On the free nas -- if want machines to be able to access freenas NFS, you need to tell it which IP or network is authorize.. If you want only your laptop 192.168.1.67 to be able to access it, then you would use 192.168.1.67/32 if you want any machine on the 192.168.1.0/24 network to access then you would use just that.

the 32 is telling you to look at all 4 octets of the network, 24 would be the 3, 16 would be 2, 8 would be first octet only.

A IPv4 address is made up 32 bits. 4 octets. X.X.X.X

The netmask state how many bits of the address are host, how many are network.

255.0.0.0 = 8 bit

255.255.0.0 = 16 bit

255.255.255.0 = 24 bit

255.255.255.255 = 32 bit -- or just that HOST

So your authorized statement of 255.255.255.0/32 is saying only a machine with the address of 255.255.255.0 is allow to connect ;)

If your machine are on the 192.168.1.0/24 network -- an you want any machine on your network to be able to access your freenas, then put that in as your authorized network.

Let me know if you have more questions.

Also, since you are trying to look at it from an Ubuntu Linux box, let's try this command on Ubuntu and see what is reported:

smbclient -L 192.168.1.66

If your server at IP 192.168.1.66 is actually sharing anything out, it will respond and you will see a listing.

Thanks Budman. That actually made some sense to me. Bit of a crash course in networking principles, and it seems to be working.

My mistake was putting the subnet address in instead of the actual IP address of the laptop. Thankyou for explaining this clearly to me.

  Quote
Also, since you are trying to look at it from an Ubuntu Linux box, let's try this command on Ubuntu and see what is reported:

smbclient -L 192.168.1.66

If your server at IP 192.168.1.66 is actually sharing anything out, it will respond and you will see a listing.

I quickly activated and setup the CIFS service and got this:

root@el-crappo-lappo:/home/fish# smbclient -L 192.168.1.66
   Password: 
   Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.24]

		   Sharename	   Type	  Comment
		   ---------	   ----	  -------
		   Media		   Disk	  where stuff is
		   IPC{:content:}nbsp;		   IPC	   IPC Service (FreeNAS Server)
   Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.24]

		   Server			   Comment
		   ---------			-------

		   Workgroup			Master
		   ---------			-------
   root@el-crappo-lappo:/home/fish#

... not really sure what that's telling me, but the "sharename" and "comment" are the same as I created, so I assume that's working too.

Now, my final question is this.... obviously, I'd like to automatically mount my NFS share everytime I boot. What do I need to add to /etc/fstab to be able to do this? Currently the NFS share is in /mnt/freenas. And ideally I'd like a shortcut into my Home directory too (but I'm guessing that will be straight forward).

off the cuff your fstab entry would be

192.168.1.66:/mnt/NAS_Media /mnt/freenas nfs rsize=8192,wsize=8192,timeo=15,intr

I think the default timout is .7 seconds, this makes it 1.5 seconds

intr allows for signal interrupts -- incase your nfs server hangs, etc.

Off the cuff there - I dont play with nfs as much as in the old days.. Some stuff might have changed -- check the nfs man for the latest info.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.