Hi there! In this video I want to show
you how to use any flash storage or hard
drive with your Pi and use it as a
wireless backup server for macOS.
Basically we are emulating a Time
Capsule, those are quite expensive but
known to work reliably, so yeah, that's
what we're trying to achieve today.
Okay, to get started we will connect to our Pi
and we are going to install gparted
with "sudo apt-get install gparted".
Now, with this tool we are going to partition
our drive to use for to use it for Time
Machine, in my case I'm using Linux own
format of EXT4 for that drive, in
terms of stability that's just the best
option but if you want to use the drive
with your Mac locally aswell you should
choose HFS+. The issue with HFS is that
sometimes, if you
don't unmount your hard drive or if you
just power off your Pi, your partition
might get corrupted and you would need
to fix it inside macOS, but that's
basically it. It's just as
compatible but I like to use EXT4
as I'm just using this drive in a
network.
Okay, so gparted is a GUI program so we
can do it from terminal - well, you can
with startx - but I'm just gonna use VNC.
You can just use a mouse and a screen
on your Pi, it doesn't matter, and we go
to run and enter "sudo gparted" and then we
see our partitions here, we select our
external drive up here and I have some
old NTFS partition I don't need. I'm
going to delete that, create a new one
with EXT4 and I'm gonna name it "TimeMachine"
Okay, that seems to have worked fine.
We're going to exit that and just to
check what you got mounted you can
always type "lsblk"
and we got our newly created drive here.
Okay, cool.
Now we are going to create a new folder
for our Time Machine backup, I'm choosing
/mnt/TimeMachine here and we are going
to modify the rights of this folder so
everybody has access to it. Great, now we
need to handle the mounting of our hard
drive so
basically if we do "lsblk" again we see
this partition is marked as "sdb1"
but if you have multiple hard drives
connected or plug in another one and so on and
so forth
it might get another name and your
system doesn't know where to mount it
because it doesn't have a unique
identifier. So we are going to find that
unique identifier and modify it
accordingly. So for that we are going to
type "sudo blkid" and then we have our
partitions here, and as you can see we
have the /dev/sdb1 here which is our
Time Machine partition and this is the
UID we want to use, so this is a unique
identifier that's always the
same so it doesn't get changed and now
we are going into "/etc/fstab",
and I have some stuff from earlier
here, I'm just going to comment that out
for now and the first thing you need to
do is point it to the UUID, paste your
UUID that you want to get used and
then we're going to define the mount
point which is "/mnt/TimeMachine", we
are going to define the partition type
which is EXT4 and then we are just going
to type "nofail,defaults 0 2"
and confirm that with CTRL+X and save
with Y and Enter.
Okay, next up we are going to install netatalk which is a tool for Linux to
seamlessly talk to Apple's file protocol
and network we will need to install all
the dependencies - just follow the link in
the description. And in my case I already
do have them installed, and next up we are
going to install netatalk. Now since
the newest version of netatalk is not
included in the default Debian
repositories we are going to download
the tarball here and we are going to
extract the source. Okay, once that's done
we see that we have a newly created
directory here and we are going to
browse into it. Okay, so now we are going
to configure the installation and for
that we are going to paste these lines
of code inside here.
Alright, and then we are going to
compile it so this might take a while
but don't worry just grab a cup of
coffee and come back in five minutes.
Okay, now that this is done we just
finish it by typing "sudo make install"
and that's it - we do have netatalk
installed, we can test that by typing
"netatalk -V" and if you get any kind of
output here that's not an error you have
successfully installed it
Okay, now we are going to continue with
configuring netatalk and first of all
we are going to edit this file which is
at "/etc/nsswitch.conf" and in the
hosts line we need to have "mdns mdns4" here, I already had that in mine so
it will look like this for
you. So we just need to type mdns4
and mdns here, save with CTRL+X, Y and
Enter. Okay, so now we are going to auto-
start these two services that are needed,
which is the avahi daemon and the
netatalk daemon. Next thing we need to do is
edit another config file under
"/usr/local/etc/" and it's called "afp.conf"
and in the global settings we are going
to add "mimic model = TimeCapsule6,106"
and down here
we already have a template for Time
Machine settings so we are going to
uncomment these and we're just going to
call that "PiMachine" and the path will
be "/mnt/TimeMachine" as you might
remember from before, that's where we
mounted our hard drive. And "time machine
 = yes" and we're gonna add
"valid users = pi". Then we are going into
/mnt/ and of course our drive is not
mounted yet so we are just going to type
"sudo mount -a" and now we have the Time
Machine folder here and we are going to
"chown -R pi:pi TimeMachine"
So we are going to be
the owner of this folder. No, actually, we
forgot to do one thing which is restart
the services - and now we should be done
for real. Okay,
to get started on our Macintosh we go
into System Preferences, go to Time
Machine and select our backup disk and
now we see our newly created "PiMachine"
here. You can choose to encrypt your
backup - I will highly recommend you to do
that - but for times sake I'm not going to
do that now, and it will ask you to
connect to the server and in here you
will enter pi or whatever default user
you are using on your Raspberry and of
course the password.
And now you see the Time Machine drive
got mounted here
and it will start our back up in 100
seconds I'm gonna enforce that now, it
will look for the backup disk on our
network,
and it is preparing the backup.
And as you can see here, the
backup just started, and don't worry,
this will get faster, it's just preparing some stuff now.
Yeah , so, I hope you learned something today,
thanks for watching and have a good one!
