Netatalk does everything Apple Time Capsule does, for a lot less money

Disk Arrays

The configuration of a disk array is very similar to that for a single disk. However, before you partition the hard disk, you should first install the RAID tool mdadm:

$ sudo apt-get install mdadm

A dialog box pops up telling you that if you want to start your system directly from a hard disk array, additional steps are necessary to finish the configuration process. However, in this case, the hard disk array is only used for backup storage, so further steps are not necessary.

As a result, you should leave the MD arrays needed for the root filesystem line in the dialog blank, because it refers to the arrays that are required for booting the system. Then, a question appears asking whether the system should mount all of the RAID arrays, to which you should answer in the affirmative. Additional questions will come up, depending on the system and the hard drive arrangement, for which you should accept the default answers.

An error message for the exim4 package appears while the system is installing the packages. This message results from a well-known bug  [6] that appears if IPv6 support is not activated on the system. However, the message will not have any effect on the installation process for mdadm.

You can now use fdisk to continue partitioning the hard disks. When entering the type of partition, the program will automatically select the one existing partition and issue a request for a hexadecimal code. You should type fd followed by Enter. The partition type is changed to Linux raid autodetect. Press W to write the changes and confirm with Enter. Repeat this process for the second hard disk.

You can create the array with:

$ sudo mdadm --verbose --create /dev/md0 --level=<RAID Level> --raid-disks=2 /dev/sda1 /dev/sdb1

If you are dealing with a mirrored hard disk array optimized for security, the RAID Level should be 1. If you are dealing with a distributed array optimized for speed and capacity, it should be 0  [7].

Because the RAID type is set for autodetect, the tool will give you an alert that the partitions could be part of a RAID array. You should confirm with Y that you want to Continue creating raid?. Once the process is finished, you can make sure that the creation of the array has been accomplished correctly by entering:

cat /proc/mdstat

Finally, you should save the current configuration in the corresponding configuration file. Start by creating a backup of the configuration file template, then add to the configuration file information about the individual partitions that make up the RAID array, as well as how the array is put together:

$ sudo cp -v /etc/mdadm/mdadm.conf{,.orig}
$ echo "DEVICE /dev/sd[a|b]1" | sudo tee -a /etc/mdadm/mdadm.conf
$ sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

The RAID array md0 that has been created appears to the system to be a typical hard disk. Although it is possible to use a hard disk or RAID drive immediately after formatting, it is customary to partition the disks first, even a RAID array.

At this point you can proceed as if you were configuring a single hard disk. However, instead of /dev/sda, the /dev/md0 device should be used.

Ready, Set, …

Before installing the Netatalk library, you need to modify the access rights for the corresponding folders. You can use the find command in connection with chmod to establish access rights for all filesystem objects of the HFS+ partition:

$ sudo find /var/timemachine -exec chmod 777 '{}' \;

Use the find command once again to change the ownership of all objects within the /var/timemachine folder to the nobody system user and the nogroup group:

$ sudo find /var/timemachine -exec chown nobody:nogroup '{}' \;

Afterward, you should restart the Raspberry Pi so that the system can mount the partition for the first time by itself.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content