Wiki source for HomeNasSetup


Show raw source

======Home NAS Setup======
Follows my notes on building a home made Network Attached Server (NAS).

These are notes are not a step-by-step tutorial, instead they are a complete guide from I've done to solve some difficulties that I've been facing. For topics that I've found interesting notes I'll provide the reference. For the solutions that I came up, I'll try to describe more detailed.

=====Hardware=====
I have assembled to cheapest computer possible to work as NAS:
- Motherboard PCWARE IPX1800E2;
- 2xIntel(R) Celeron(R) CPU J1800 @ 2.41GHz Processor, embedded in the motherboard;
- 2x2 TB Seagate Constellation ES - SATA 2.6;
- 1x2 TB Seagate Barracuda 3.5 - SATA 3.1;
- 4 GB RAM DDR3

=====Operational System=====
For the NAS OS I've choosen [[https://doc.opensuse.org/release-notes/x86_64/openSUSE/Leap/15.1/ OpenSUSE 15.1]].

=====Disks and Filesystems=====
In order to have some redundancy and not trow away I've decided to use the RAID software available on linux with [[https://raid.wiki.kernel.org/index.php/RAID_setup mdadm]]. I'm using RAID level 5, which permits to miss one of my tree disks without loosing any data. As file systems I've played safe and chose EXT4 for / and XFS for /mnt/storage.

=====Notables Software=====
The most important softwares that work as glue between the NAS and theirs clients.

- [[https://github.com/ldemattos/pySleepWake pySleepWake]]: Software to sleep and wake up the server when some client searches for it;
- [[https://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh rsync]]: is a very well known file synchronizer in Unix world. Its main purpose here is transfer files in bulk to NAS. Was very useful to very the first NAS population. Nonetheless, I still use when I want to perform a 'full' backup or make sure that client is in sync with the NAS.
- [[https://syncthing.net/ syncthing]]: This program constantly verifies for changes in clients/NAS (here the update is bidirectional, if desired) and keep both in sync. I do not use for my entire home directory, only for specific and most important folders that are frequently altered.
- [[https://wiki.archlinux.org/index.php/SSHFS SSHFS]]: This is a precious piece of software that permits to mount the NAS folders as 'local' volumes over SSH and, better yet, on demand!
- [[ duplicity]]: USE IT???!?!?!
- [[https://play.google.com/store/apps/details?id=com.estrongs.android.pop&hl=en ES File Manager]]: This is a pretty good file manager for Android that gives the possibility to access the NAS remotely through mobile/wifi networks. With this app you can replace any other 'cloud' stuff. However, it is full of unwanted crap. I'm just still using it while I don't find a better solution.

=====Energy Saving=====
Here in my house the NAS doesn't need to be on 24h/7, it would be an waste of power and also annoying extra heat and noise. So I've decided start it on demand. To accomplish this it necessary other computer able to wake up the NAS, since it is necessary to 'sense' in the network that some other device is looking for the server and also must capable of sending 'magik packets'. The other computer that I'm using to do this task is one Raspberry Pi 2.

There are few software options to this in the web (please refer the links provided below). However, none of them were exactly were I was looking for. So I wrote a small set of Python scripts, called [[https://github.com/ldemattos/pySleepWake pySleepWake]]. In this set there are two Python scripts: the first 'sleep.py' must go in the server and the second 'alarm.py', should be placed in the device that will be turned on all the time. The controlled variable used to suspend the NAS was taken as the network rx and tx traffic average in a given time window.

Here are some links that I've read as references:
https://askubuntu.com/questions/43374/power-management-sleep-wake-up-server-when-accessed
http://rolandtapken.de/blog/2013-07/use-autofs-wake-fileserver-demand
https://serverfault.com/questions/389286/automatic-wake-on-lan-in-linux-when-accessing-remote-filesystem
http://rolandtapken.de/blog/2013-07/suspend-nas-when-idle
https://askubuntu.com/questions/105536/tool-to-shutdown-system-when-there-is-no-network-traffic
https://gist.github.com/n1trux/b3310af725e3e17d4be7

=====Networking & Remote Access=====

- File sharing using ssh (linux) and samba (windows and mac).

====Setup====


=====Raspberry Pi Setup=====

Firewall [X]

=====Other Useful Links=====
https://serverfault.com/questions/74773/when-using-nfs-how-do-i-make-user-a-on-the-server-appear-as-user-b-on-the-clien
https://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing/
https://askubuntu.com/questions/505446/how-to-install-ubuntu-14-04-with-raid-1-using-desktop-installer
https://askubuntu.com/questions/505897/installing-ubuntu-14-04-on-asus-zenbook-raid/532790
https://blog.hostonnet.com/grub-install-warning-this-gpt-partition-label-contains-no-bios-boot-partition-embedding-wont-be-possible
https://ubuntu-mate.community/t/ubuntu-mate-16-04-sometimes-needs-long-to-shut-down/5524/9
http://blog.erratasec.com/2016/10/configuring-raspberry-pi-as-router.html#.WasLmheQxhE
https://h3x.no/2011/07/09/tuning-ubuntu-mdadm-raid56
https://unix.stackexchange.com/questions/1314/how-to-set-default-file-permissions-for-all-folders-files-in-a-directory#1315
https://blog.shadypixel.com/monitoring-hard-drive-health-on-linux-with-smartmontools/
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki