RAID 6 Backup Server with SAMBA (windows sharing), E-MAIL Monitoring (Ubuntu), and Remote Desktop

This is in need of an update due to dead links and deprecated content.

Today I’m posting to list the tutorials / steps I used to create the a backup server for the Multimedia, Knowledge, and Web Technologies Group at Athens Information Technology – Athens.

A server resulting from the use of the tutorials below will:

  • be accessible from windows PCs.
  • be able to withstand two disk failures without loss of data.
  • e-mail the administrator upon disk failure within the RAID array to take preventive steps.
  • e-mail the administrator on a scheduled basis with disk statuses outlining bad sectors.

So on to the actual good stuff…

Steps/Tutorials

1) Setting up Raid
http://www.ainer.org/raid-5-6-install-setup-configuration-guide-for-ubuntu-10-04-lts-lucid-lynx

2) Raid Monitoring with SSMT (E-Mail)
http://blog.agdunn.net/?p=383

3) Testing RAID Failure
http://www.jfamiglietti.com/john/?p=213

4)Setup SAMBA SERVER
http://www.liberiangeek.net/2011/04/share-files-folders-ubuntu-11-04-natty-narwhal/

5)Hard-Drive-Monitor-Script:
http://www.howtogeek.com/51848/hard-drive-monitor-script-for-headless-linux-servers/
For 5) I modified the script to e-mail me every day at 12 with the bad sectors of each disk regardless of a threshold, but ofcourse this is up to each person’s preference:

 #!/bin/bash
########Email function########
email_admin_func()
{
/usr/sbin/ssmtp -t < $temp_email_file
echo "Sent an Email to the Admin"
}

init_to_temp_func()
{
echo "To: me@domain.com" > $temp_email_file
echo "From: server@domain.com" >> $temp_email_file
echo "Subject: MKWT " $1 >> $temp_email_file
echo "" >> $temp_email_file
}

write_to_temp_func()
{
    echo $1 >> $temp_email_file;
}

smartc_func()
{
/usr/sbin/smartctl -A /dev/$1 | grep Reallocated_Sector_Ct |tr -s ' '|cut -d' ' -f11
}

########End of Functions########

########Set working parameter########
temp_email_file=/tmp/smart_monitor.txt
allowed_threshold=5 #set the amount of bad sectors your willing to live with, recommended 5.

########Engine########
init_to_temp_func
for i in sda sdb sdc sdd sde sdf ; do # Add or subtract disk names from this list as appropriate for your setup.
    write_to_temp_func "$i has "`smartc_func $i`" bad sectors."
done
email_admin_func
cat $temp_email_file

In order to modify what the e-mail contains, the smartc_func() function can be modified which calls smartctl and pipes it to grep.

6)Remote Desktop
http://scarygliders.net/2011/09/23/install-xrdp-and-x11rdp-the-comprehensive-howto-for-ubuntu-and-debian-based-systems/

The installation went fine but there were authentication issues due to the .Xauthority file missing. For those facing this problem the following from(http://ubuntuforums.org/showthread.php?t=1138337) will help:

“Create a blank .Xauthority file in the home directory of the user you are connecting with. Be sure to log in as that user (either graphically, or via the terminal), then run:

touch ~/.Xauthority
chmod 600 ~/.Xauthority” – TwistedLincoln

7) Configure RAID Autostart / Automount

There is a possibility you may turn on your Server and see the RAID is not mounted. In this case the threads below are very useful:
I can not autostart and automount software RAIDhttp://ubuntuforums.org/showthread.php?t=1312539
Auto Mounting RAID Arrays on Linux Server Startuphttp://www.linuceum.com/Server/srvRAIDAuto.php

It took some time to configure but was well worth the effort!

Some Pictures:

Happy Server Building,

Menelaos




Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts