Pages

01 January 2013

curlftpfs


Having a raspi on the network is a fantastic thing. It has so many possibilities that it seems endless. One of its constraints, however, is that it has not got a lot of available space. Well, it can have as much space as you can afford but big sd memory cards are expensive (or at least more expensive than the raspi itself) An sd card of 32 GB costs 39€, way more than the raspi itself.
Solutions:
  1. Attach a pendrive (or several of them using a hub) to have a bit more spacehmm similar situation. This might be expensive and even ugly.
  2. Mount a network drive as if it were a local storage device.
I chose option 2. I normally use sshfs to mount drives on my network or even remotely. I have an ftp-only drive that cannot be mounted using ssh. So I had to install curlftpfs. It is extremely easy to use.
  1. Make sure your user belongs to the fuse group. If not:
    $ sudo adduser < user > fuse
  2. Then make a mount point.
    $ mkdir -p ${HOME}/nas
  3. Mount it.
    $ curlftpfs -o allow_other < user >:< password >@192.168.2.30 ${HOME}/nas
Nice huh?
To unmount it:
$ fusermount -u ${HOME}/nas
You can now either add the mount to fstab to make it permanent (not really necessary in my case since the raspi is up 24/7) or create an alias.
alias nasmount='curlftpfs -o allow_other < user >:< password >@192.168.2.30 $HOME/nas'
alias nasumount='fusermount -u ${HOME}/nas'
Now the best part of it. I mount the ftp server in my raspi but I also mount my raspi over ssh in my laptop so in the end I have my ftp server mounted in my laptop out of the box. Neat!!!