Want to make your Raspberry Pi a home file server to centrally store all your media files? And you want to make it publicly accessible? Read on.
Want to make your Raspberry Pi a web dev server instead? Click here.
I’m open to suggestions or alterations for this post as I appreciate there may be some flaws in my set up, so feel free to share your thoughts.
Cloud storage vs. Home storage
You can’t beat the speeds of cloud storage providers, such as Dropbox, OneDrive or Google Drive. However you really must ask yourself: “How much can I depend on these guys?” It is commonly acceptable to take the majority vote to assume that their physical infrastructure and service continuity is better than anything at home. Though the fact remains that you don’t know their physical infrastructure and you don’t know how well they maintain their hardware. Whereas at home you definitely know your own kit, room and neighbourhood – you’ll have complete control.
Don’t misunderstand me – I’m not stupid. Common risk assessment applies here as well as it does anywhere else. This is for those who wish to satisfy their own paranoia, or just to make their own cheap file server for the fun of it.
I’ve seen many attempts of this done by many bloggers around the web, some have seemed complicated and others seem ill-explained. Skiwithpete’s version was my inspiration. I thought I’ll give this a go myself. It’s not an overly complicated process, however it does require you to be competent with basic networking and use of Linux.
I broke the tutorial down individual posts as it got quite long wounded, so the below points are links:
- Setup the RPi, installed Raspbian
- Configured a static IP and configured SSH (using public keys)
- Installed and configured No-IP2 to use a domain for public access
- Installed Samba and configured external hard drive for local file sharing
- Map your RPi’s external hard drive as a network drive across your network
- [optional] Configure my Python script to automate your backups from Windows machines using rsync
- [optional] Configure my Python script to automate your backups from Windows machines using rdiff-backup
- A comparison of Rsync vs. rdiff-backup
- Configuration and utilisation of various administrative utilities, including hdparm to set external HDD to idle after x minutes, and sar (Sysstat) to retrieve system usage information.
- A list of useful applications to use on and with your RPi as a file server
- A complete image of the SD card in case of any future failures
- Using a host-powered external hard drive is not recommended.
- rdiff-backup and rsync had some trouble writing to the external hard drive. This was overcome by specify the user pi’s uid and gid in /etc/fstab
- SSH keys generated by Putty do not have correct permission settings. Easily changed using chmod
- When trying to use the official Dropbox application and Dropbox Uploader andreafabrizi, I quickly learnt that Dropbox recognises differences in files by modification date and not checksums. This was a massive headache when my laptop and desktop both held my Dropbox files but the deltas were set to the download date not original modification/creation date. This left Rsync forever pushing files to the RPi each time as the modification times never matched. It looks like Dropbox doesn’t preserve file timestamps.
- Trying to find a half decent SSHFS application for Windows.