Raspberry Pi as Network Attached Storage (NAS)

Content on this page is intended to compliment the article series published The Shed magazine (To Server or Not to Server – What Was I Thinking? Or, A Sheddies Guide to the Data Galaxy, by Nigel Young), as a way of delivering more in-depth detail and update changes to install and configuration of software used/described.

The article also mentions the Ykush USB2.0 software switchable hub which I can supply for NZ$50 (plus freight). The board can also be purchased via other online vendors including the more up-to-date USB3.0 version. Leave your details in the form below to place an order.

One of the steps in the article mentions mounting the storage drive. If you are using an SSD device it will need to be formatted prior to mounting. Full instructions on that are contained in this article https://www.zdnet.com/article/raspberry-pi-adding-an-ssd-drive-to-the-pi-desktop-kit/ starting at: SSD as additional disk drive.

The steps describe installing the Gparted software that allows the partitioning and setup of the storage drive. It is easiest done via the GUI (desktop) interface.

The next step is to map a folder/directory on the Raspberry Pi to the SSD drive (for the purpose of using it as storage only).

Easiest method is to create a folder on the root of the RPi and adding a script line that is run at boot to mount that folder name to the SSD drive.

An example is to create a folder ‘nas’. While mentioned it could be created from the root (base), it can be anywhere. You just need to remember where it is so you can include the directory path in the script.

Turn the Raspberry Pi on/off with a button

Practically, as a NAS, it needs a power on/off button. For the ease of simplicity I’ve deployed a method long used and well scripted, by connecting a button to two of the GPIO pins. A simple script runs each time the button is pushed, to shutdown and startup the Raspberry Pi.

Follow the simple tutorial here: https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi

Remote access: CLI and GUI using Dataplicity and Porthole

Dataplicity have a solid platform for remote access to a Raspberry Pi, outside your home network, giving you access via CLI or GUI, as if you were in front of a keyboard/monitor. Via a web browser you can port via their website to the CLI of the Raspberry Pi.

If you’re needing GUI access it can be done via VNC using the Dataplicity Porthole method and VNC Viewer.

Security is important here and a key point to remember when it comes to the scope of your NAS/home security.

Backup the SD card – Raspberry Pi

Take a copy of the SD card (image) – it is simple and will save you a tonne of time should things go pear-shaped later. Ideally have a copy of the SD card attached to the unit for quick swapping out should it be needed. Alternatively just store it on your computer in an easy-found location.

From a Windows PC the most stable method is to use the Win32 Disk Imager. Power down and remove the SD card from the RPi and connect it to the PC (via card reader). Ignore the pop-up message ‘You need to format the disk drive…

Look for the USB drive under ‘Device’ selector, give the image file a name and location and click ‘Read’.

Phase two: Raspberry Pi as NAS – backing up photos from iCloud

The second part of this project was to reduce the overall space used on iCloud. Secondly; it was to back up all iCloud photos, and then have them backed up.

This method involved adding a second 1TB SSD and a second 6TB USB HDD. Replicating the function of phase one (above), the second SSD becomes a dedicated drive for photos (especially iCloud). From there another cron routine will copy the 1TB SSD to the 6TB one on a weekly basis, powering down the drive once complete (via the software switchable YKUSH USB hub).

Much of the process involves following the tutorial: https://www.pcmag.com/how-to/how-to-back-up-and-organize-photos-from-your-iphone-or-ipad

Was this of value to you? If so and you feel the desire: Buy Me A Coffee

Got a question? Want to know more?

Please enter your name.
Please enter a message.
Please check the captcha to verify you are not a robot.