Maximum PC - UK (2020-01)

(Antfer) #1
©^

OP

EN

ME

DI
AV
AU

LT
,^ K
AL

I.O

RG

If you’d like slightly more complexity to
your NAS than a simple Samba share, look
in the direction of OpenMediaVault, and
cross your fingers that it gets updated to the Pi 4
soon. It’s a much more complex and fully-featured
NAS solution, with a web interface that lets you
do the dirty work of setting it up and allows you to
access files on your server from outside your local
network, if you set it up correctly. It also offers
access to services like SSH and FTP, allows you to
run torrents on your NAS box, and much more.
While there’s no official build for the Pi 4 yet,
you can download an entire single-purpose OMV
distro for its elder siblings at https://sourceforge.
net/projects/openmediavault, which you just
need to write to a card with Etcher—as with all
these not-officially-compatible projects, you’re
welcome to try it to see whether the current 32-bit
version works for you. OMV’s distro is based on
Debian, which has been proven to at least vaguely
work with the Pi 4, so you should be able to run it
without too many hardware conflicts.
Run through the installation when connected
to a mouse, keyboard, and monitor, logging in
with the default username “root” and password
“openmediavault.” Use the command ifconfig to
determine your Pi’s network address, and head
to the OMV web interface from another machine on
the same network by dropping that location into a
browser address bar. Logging in as “admin” with
the same password should get you in, and you can
start configuring straight away. No guarantees,
though: A few months’ more Pi 4 maturity should
get you a version directed at the new board.

version will do‚ and you won’t need
to keep it hooked up to a monitor or
any peripherals, as we’ll be able to
control it remotely, though for the
sake of ease of setup, we suggest
you hook everything up at least until
the NAS is up and running.
Let’s tick off some prerequisites:
Write Raspbian Buster Lite to your
card, boot it up in your Pi, then run
sudo raspi-config from the shell.
In “Interfacing Options,” switch
on SSH, so that you’ll be able to
access the shell using a tool such
as PuTTY later on, set up your Wi-
Fi if you’re going to use that, change
your password (because leaving
the default password on a device
you’re going to deliberately leave
open on the network would be a
drastically foolish move), then head
to the “Network Options” page.
We recommend changing the host
name to something like “nas” so it’s
easily found later.
There’s a ton of ways we could go
about this. You could, with enough
drives, set up a mirrored RAID 1
array using the tool mdadm ,
presenting them as a single drive.
We’ll sidestep that for now—it’s
a little excessive, and unless
you have your Pi hooked up to
a UPS that is going to ensure it
never loses power, there’s a good
chance Linux’s overly-sensitive file
handling will lead to the array’s
demise sooner rather than later. If
you do want to use it, install it using
apt-get , consult its man page ( man
mdadm ) for instructions, and (once
installed) use /mnt/raid1 or similar
when referencing the storage drive.
The simplest solution would be
to take advantage of Samba, Linux’s
Server Message Block (SMB)

network sharing tool, which will give
us a simple storage area that shows
up as a network drive in Windows.
First, get your drive (or drives—
repeat the following as necessary)
ready. Insert your storage device
into the Pi, and Raspbian should
mount it automatically; run lsblk to
see what drive designation it’s given
it—in our case, this is /dev/sdb. You
need to initialize the drive and give it
a partition Raspbian can work with;
fdisk is our friend for this task. First,
unmount any partitions lsblk listed
using umount /dev/sdb1 or similar.
Now run sudo fdisk /dev/sdb ,
hit N when prompted to create a
new partition, and if you’re told one
already exists, hit D to delete it, then
N again to create a fresh one. You’ll
want a primary partition (P), then
just hit Return until you get back to
the base command prompt. Hit W to
write the changes, and your disk is
initialized—repeat this for any other
drives you might be using.
Now format the drive with sudo
mkfs.ext4 /dev/sdb , create a mount
point for it using sudo mkdir /mnt/
sdb , and mount it with sudo mount
/dev/sdb /mnt/sdb. It’s important
if we’re setting up network storage
that this drive gets mounted to
the same point every time, so let’s
set it to happen at boot by running
sudo nano /etc/fstab to edit the
static filesystem table. Insert the
following on a new line, separating
each entry with a tab:
/dev/sdb /mnt/sdb ext4
defaults 0 0
Exit nano, and it’s time to set
up Samba—a mercifully simpler
procedure. Install it with sudo
apt-get install samba samba-
common-bin , then run sudo

as a serious storage solution, is a
powered USB hub to ensure your
drives never drain the Pi of too much
precious energy when worked hard.
Truthfully, you probably don’t need
it, but something like TP-Link’s
UH720 ($30) offers up a whole raft
more por ts as well as adding power,
meaning you can expand your
central storage as additional drives
become available.
You don’t need the all-inclusive
Raspbian package for this—the Lite

OMV offers a
whole host of
functionality
and an easy-to-
use interface.

Want a toolkit for white hat hacking? Kali Linux is ideal. Behave yourself!

Raspberry Pi 4


40 MAXIMUMPC JAN 2020 maximumpc.com

Free download pdf