Preparing the RAID set

In this section, we will build the actual software RAID drive from our previously prepared and formatted physical drives.

Confirming whether RAID is correctly initialized

The /proc/mdstat file is a dynamically modified log file, which provides the current status of all the RAID devices on the system. We can confirm that the initialization is complete by displaying the file, with the following command:

cat /proc/mdstat

This may take some time to complete, depending on the size of the attached drives.

Confirming whether RAID is correctly initialized

The preceding screenshot shows the result of this command. You will notice that our array is called md0 and that it consists of two physical drives, called sda and sdb.

It's now time to format the drives in our RAID array. We will use the mkfs.ext4 command to do this, as shown in the screenshot that follows the command line:

mkfs.ext4 /dev/md0
Confirming whether RAID is correctly initialized

Creating the Mdadm.conf configuration file

The new Mdadm installer creates an mdadm.conf file in the /etc/mdadm directory.

All the partitions will be given a UUID label that contains four sets of eight numbers and letters. The mdadm.conf file makes sure that this mapping is remembered when you reboot.

Here, we export the screen's output to create the configuration file by adding a pipe to the mdadm.conf file:

mdadm --detail –-scan /dev/md0 > /etc/mdadm.conf

The following screenshot shows the contents of mdadm.conf:

Creating the Mdadm.conf configuration file

Creating a mount point for the RAID set

We proceed further by creating a mount point for /dev/md0. In this case, we'll create one called /mnt/raid, which will then be used to store all your media files.

First, we will create a mount point in the /mnt subdirectory of the root file system:

mkdir /mnt/raid

Then, we will use mdadm to assign this point to /dev/md0:

mount /dev/md0 /mnt/raid

We then tell mdadm to create the array, as follows:

root@beaglebone: mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sda /dev/sdb

This command tells mdadm to create a RAID array called device, md0 and to use our preformatted drives sda and sdb:

mdadm: chunk size defaults to 512K
mdadm: /dev/sda appears to be part of a raid array:
       level=raid0 devices=2 ctime=Wed Jan 28 00:44:42 2015
mdadm: partition table exists on /dev/sda but will be lost or
       meaningless after creating array
mdadm: /dev/sdb appears to be part of a raid array:
       level=raid0 devices=2 ctime=Wed Jan 28 00:44:42 2015
mdadm: partition table exists on /dev/sdb but will be lost or
       meaningless after creating array
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

The command also creates a configuration file called mdadm.conf, which will be used by Mdadm when we reboot, as shown here:

root@beaglebone:/etc/mdadm# cat mdadm.conf
ARRAY /dev/md0 metadata=1.2 name=beaglebone:0 UUID=f1ba55ee:e2e48a29:c1d343fd:7576ba8f

If you have set up your RAID properly, then enter this command:

mdadm --detail -–scan /dev/md0

This will produce the following output (a properly configured RAID array):

Creating a mount point for the RAID set

This tells us that the array has been mounted properly on the device md0 and that it is a RAID devices /dev/sda and /dev/sbd. Both these devices are active and synced so that the OS can access both the devices simultaneously (RAID 0).

We then copy some simple text files to the RAID array in order to make sure that it is working. A directory listing is shown in the following screenshot:

Creating a mount point for the RAID set

Configuring Samba

Back in Chapter 2, Installing and Configuring Multimedia Server Software, when Samba was installed, I told you that you will have to make an entry into the smb.conf file in order to add the RAID array. Now, you can do this so that the RAID array is visible to all the network devices connecting to your BeagleBone. If you have not already done so in Chapter 2, Installing and Configuring Multimedia Server Software, edit smb.conf and add the following lines.

#Share for the Raid array
[media]
  Comment= Raid array connected to BeagleBone
  path = /media/<Raid mount point>
  read only = no
  browseable = yes
  valid users = <debian>

What we are doing here is explained in the following points:

  1. We tell Samba the path to the RAID array with the path= statement.
  2. We make the directory writeable by telling Samba that it is NOT read-only. For security reasons, many Linux settings deny access rather than grant it by default.
  3. We then tell Samba which users are allowed to browse the directory. In this case, the default debian user. If we had a user called guest, we will add them here.
  4. You will also have to add the RAID array to the /etc/minidlna.conf so that you can stream your files to any dlna device on your network:
    #media_dir=/var/lib/minidlna
    port=8200
    media_dir=V,/mnt/raid/Videos
    media_dir=A,/mnt/raid/Music
    media_dir=P,/mnt/raid/Pictures
    friendly_name=Beaglebone DLNA Server
    

The functions of these entries are shown in the following screenshot:

Configuring Samba
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.82.4