developer.shyd.de. studying my hobby

19Jan/1113

Dockstar-NAS: Automount, hd-idle, Samba, FTP

(4 votes, average: 5.00 out of 5)
Loading...

Having debian installed on the dockstar is quite nice but how about access to the data in there? In this article I will explain how you easily set up a data-storage with autofs, hd-idle, samba and proftpd.
I assume you have debian squeeze running on a usb stick and your data you want to share on your network is stored on an external hard-drive.

1. autofs and hd-idle

In order to mount the hdd as it is connected to a certain mountpoint we will install autofs and to reduce its power-consumption we let it spin down after some minutes with hd-idle. The default repository doesn't contain hd-idle so dev-eth0.de created a repo for the dockstar. You may want to add it to your /etc/apt/sources.list:

If you want to make sure, that this repository isn't faked, you can add the gpg key to your apt-key:

Now install those packages:

1.1 autofs

I want to mount my external drives in /media so I added this line to /etc/auto.master:

This sets /media as the parent folder for all mounts in /etc/auto.media, so create auto.media and add the devices you want to mount. You can use sdxX or the uuid (find out with blkid) as the device:

Your hdd will be mounted as /media/disk1.

1.2 hd-idle

Spinning down all attached hdds: First of all enable hd-idle in /etc/default/hd-idle:

Thats it, just restart the service.

2. samba

You want to have windows-shares on your local network? I will explain how you set up password protected shares because I don't want all of my friends in my WLAN have access to it ;)

Take a look at /etc/samba/smb.conf and customize it for your needs, these are those lines I have edited:

Once you have set this up you are ready to create the users, note they have to be unix users already:

If you now log in as user1 and run smbpasswd again you will update the samba and system password.
Finally restart samba and try the connection!

3. proftpd

Sometimes I have the problem not be at home when I need certain files stored on my dockstar. I either could connect to it with VPN or simply use FTP (note: insecure file-transfer). I chose proftpd because it's easy to configure, install it by typing:

It will ask if you want to install it with inetd or standalone, choose standalone.
The default configuration fits pretty well for my needs, the only thing I enabled was VirtualRoot. As I login I am in jail in my home dir, the module gives me the ability to get out there. There you have to edit two files:

This makes every ftp-user able to access the ftp_share directory. For more security information check out http://www.proftpd.org/docs/faq/linked/faq-ch6.html

4. Reference

http://www.dev-eth0.de/archives/879

Tagged as: , , , , , , | 17,366 views Leave a comment
  • shyd

    dev-eth0.de changed some links and URL of the repo, so I updated this article.

  • Pingback: Anonymous()

  • twinclouds

    Hi, Shyd:
    Thank you for your step-by-step instructions. At beginning, I got authorization error but now everything works. I am not sure what I have changed though.
    Right now I got a transfer speed of about 10 MB per second. Is this what you can get. It is o.k. but I don’t know if there’s anything I can do to speed it up further.
    Thanks again for your good work. It saved me a lot of time.

    • shyd

      Hi,
      if you have a 100Mbps connection, speedrates around 10MB/s are fine. To speed this up, you have to upgrade your network to 1000Mbps. I did, now I get around 25MB/s.

  • Dude, your blog is really awesome. I found many things for my two Dockstars. Bookmarked!
    Please add more articles about tips and tricks.
    Good work.

    • shyd

      Thanks!

      • BTW, how can I access to an external HDD connected on Dockstar (on a router), from another computer?

        • Nevermind mate, I found NFS which seems pretty nice.
          Take care.

          • shyd

            Great, I’m using it as well.

  • Lallo

    Hello,
    I think the repo.key is expired. Is the site still valid to install hd-idle from it?

    • shyd

      Hi,
      can’t tell you, but I’ll contact the site’s admin. If you can’t wait: http://hd-idle.sourceforge.net/

      • Hi Lallo,

        I’m sorry but i currently don’t support the repository anymore, therefor the key is an old one. But the site is still valid, so just ignore the key ;)

  • Koos

    Awesome blog, works like a charm for my Raspberry Pi. THANKS! Sidenote: Article was a little hard to find, maybe mention that this works with the raspberry pi to create a NAS?

  • John

    any idea on this situation?
    i have 2 hard drive shared using samba, each have different username allowed… all seems to be working fine.. except that one of the harddrive i can only access if i use //domainname/sharename name and 2nd hard drive i can only access if i use //IPaddress/sharename