Setting up a linux based backup server!

linuxbackup

You might remember me having a bit of a data loss here last year, in the aftermath of this i set up a dedicated backup server, this is in general a computer that holds backups of my files just in case i have a disk crash or something else that deletes my files. I choose Windows Server 08 for operating system since I was familiar with this and I wanted to try the os out on a different computer that our main server before switching, and so I did i set it up with the OS on one disk and two other disks in raid 5 and that worked nicely but after trying out Windows server for a while i decided to upgrade our main server to this and thus eliminating the need to have it on my backup server, don’t get me wrong it worked like a charm ther too but I’we always wanted to learn Linux but never had the time or opportunity to run in on a standalone computer, I’we always been stuck having it on a virtual computer or using my Raspberry PI but that never suited me really and the PI can’t run Ubuntu which is the distro I’d like to learn.

 

The idea comes to life. I decided to make a copy of my backup on my main computer and then wipe clean all disks and give Ubuntu a go, and so I did.

I installed Ubuntu Desktop 13.04 just because i would like the opportunity to connect a monitor, keyboard and mouse and use a GUI if I need to, this is in general a headless server, meaning that it’s just the box and no monitor is connected as it sits behind my couch  it would really make the misses cross if there was a monitor poking out behind it.

ubuntu1304splash

I did some research on setting up raid in Ubuntu and found this article on it I followed the instructions to the letter and almost got it working but the RAID failed to mount during boot/start-up of the computer and it turned out that I had used the space button to make, well space between the statements in the /etc/fstab file and you’re supposed to use Tab, so after this was fixed and it booted properly.
I wanted to get a daily status update from my backup server on the condition of the RAID, I did not have this in Windows so that’s one plus for Linux. I followed this instructions on getting that set up, note that once again either something got changed in an update or the author forgot to put in that you have to specify an email address by adding MAILADDR [email protected] in the /etc/mdadm.conf file.

It had taken me a fair bit of Googling and reading but at this point i had a Ubuntu based backup server with a RAID level 10 running with email status updates running. Since I’ve got Windows 8 on my main computer I would have to set up a Samba share on the Linux box, Samba share is the platform which all windows machines share files on. I installed samba and set it up according to these instructions but for some reason I was not able to get access to my shares on the Windows 8 machine at first I came across some others having what seemed like the same problem but they were having issues with older versions of samba and mine was the latest so that could not be the case for me, I had set up samba to require a username and password of an existing user when trying to get access to the files and got the prompt for it but no mater what i entered i got rejected claiming wrong password or username. After some fiddling around with different solutions I figured that I had to set the security option in /etc/samba/smb.conf file to user and enable password sync. Then I needed to add the following to the properties of the share in the same file:
force user = username
read only = no
create mask = 0777
folder mask =0777
guest ok = no

and finally I had to add the user to the Samba user list with the ‘smbpasswd -a username’ command, after that all was working as it should.

Synctoy

Now for the process of actually doing the backup. Earlier I have used and liked the Comodo Backup program but I stumbled upon a Microsoft app that does the same thing in general, It’s called SyncToy and is made by Microsoft and is compatible with XP, Vista, Windows 7 and 8 tho I have only tested it on Windows 8 Pro. It basically keeps pairs of folders synced in different ways and to make this work with my backup solution i Mapped the shared folder on my Linux box to a virtual drive in windows.

mapnetwork

Sounds like nerd talk right? Well that is the technical term for it in plain English it translates to I fooled my windows into thinking the folder on my backup server was a hard disk in the Windows machine, this is done by right clicking on the ‘My Computer’ icon and selecting ‘Map network drive’ up pops a window asking for the location of the network resource you want to map, this can be set in two ways, either you enter the IP address of the Linux machine or you enter it’s machine name. Using the machine name is usually the best as this does not change in case of a reboot were as the IP address can change if you haven’t set it to static, if you are following this tutorial you have not set it to static. Back to the mapping, in the address box enter ‘\\machine-name\share-name’ this depends on what you have set up during install of Linux and what you have called the share you set up earlier.Check the ‘Connect using different credentials’ box and enter the Username and Password when it prompts you for it, remember to check  remember me box.

When the network drive has been mounted all you have to do is set up a folder pair for each folder you want it to take backup of with the source folder to the left and the destination folder on the right. Since we are using this program to make a backup we don’t want the program to delete files on both ends if you mess up and delete a file or something on your main computer therefore we choose Contribute in the ‘What do you want to do?’ page and repeat for each folder you want and there you go.

All done

 

If you have a smart phone and want to be able to check up on the Linux server there is an app called Pc Monitor that will do that for you! to install it on your linux server you first have to get an account, follow these steps to make one. Then install Java which is done by running the following command in the terminal sudo apt-get install and then the versions listed here under open JDK, as these are subject to change as newer versions are developed I will leave the command for you to fill in. When Java is done installing do the following commands(everything between two ” ” you have to change to fit your computer):

cd /home/”username”

sudo wget http://www.mobilepcmonitor.com/download/pcmonitor.tar.gz

sudo -xvf pcmonitor.tar.gz

cd pcmonitor

sudo ./install

Then follow the setup and enter what you fell like changeing and then your Pc monitor Username and Password at the end and it should pop up in the app!

No Comments

Leave a Reply