Portable Linux Server\Great way to backup and restore?

For complex topics that regular users would not be interested in. For power users and database administrators.
Post Reply
User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Portable Linux Server\Great way to backup and restore?

Post by Justin Shafer » Sat Jul 28, 2007 8:48 pm

I am trying to do a portable file server using lGRML Linux. It has to do bootable usb and raid, hardware detection with every boot, samba, mysql, and mono if possible.


Advantages:
1. Hardware Detection: Can boot on more then one pc in case a server fails. In otherwords wouldnt it be nice if any computer in the office could be your server just by booting a usb device?
2. No waiting for Backups.
3. Possible to restore data while working

Disadvantages:
1.Only works with software that does NOT require a windows server. Like Dentrix Image requries Microsoft SQL Server.
2. Slower bootup as far as I can tell.
3. Your basically resyncing your raid array on a daily basis.
Last edited by Justin Shafer on Sat Aug 11, 2007 7:33 am, edited 7 times in total.

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Sun Jul 29, 2007 12:01 pm

Wow this is cool. i'll have to look into this.

ps. im almost up and running in my trixbox asterisk pbx system.
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Post by Justin Shafer » Thu Aug 02, 2007 11:06 pm

stuff
Last edited by Justin Shafer on Sat Aug 11, 2007 7:00 am, edited 1 time in total.

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

YAY

Post by Justin Shafer » Sat Aug 11, 2007 6:55 am

So far so good the raid is working. I decided to change up the internal drives sorta.

So /dev/md0 = /dev/sda1 /dev/sdb1

And /dev/md0 = /dev/sda2 /deb/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2 /dev/sdf2 /dev/sdg2

A bootable linux os resides on /dev/sdc1 - /dev/sdg1

The server usuall boots right into /dev/md0 as root. But if all of the drives are bootable and have hardware detection. To restore a backup and overwrite the data on the array md1 that is tied to the internal drives, will be a simple command like ./overwritedata.

I did a lot of testing with software raid, more then usual and asked questions liked what happens if I yank the drive and then insert it another drive, how will it automatically hotadd this new drive to the array. I acheived this with a cronjob that runs every minute. mdadm --manage /dev/md1 -add /dev/sdc2 or d2 or e2 etc etc. So if the drive is present it will get added.

So if you took the external drive to another pc and used it as a server, then brought the drive back to the original server, you would want to boot off the external drive and not the internal drive or the servers cronjob will eventuall hot add that external drive to the internal drives and overwrite the new data on the external drive.

If you boot off the external drive instead, you can run the overwrite command and it will make the internal drives md1 like the external drives md1 or /dev/sdc2

I plan on booting into grml, installing vlc, and watching some tv and other things to see if anything goes wrong. Yesterday I was running vlc as root and thats a nono. Kept throwing the system iunto read-only, but it did say running vlc as root was dangerous.

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Picture of the design

Post by Justin Shafer » Sat Aug 11, 2007 6:57 am

Here is a pic

Image

brad
Posts: 1
Joined: Wed Aug 29, 2007 7:13 am
Location: Austin, TX
Contact:

How about a NAS with builtin PHP/MYSQL

Post by brad » Wed Aug 29, 2007 7:23 am

This NAS can do it as well.

http://www.synology.com/enu/products/CS407/index.php

$650 Plus drives. :twisted:

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Re: How about a NAS with builtin PHP/MYSQL

Post by Justin Shafer » Thu Aug 30, 2007 6:43 am

brad wrote:This NAS can do it as well.

http://www.synology.com/enu/products/CS407/index.php

$650 Plus drives. :twisted:
That NAS does nothing of the sort! 8) re read my post on what Im doing!

I made 4 linux servers and put thyem on usb drives, so to use them you have to boot off the usb drive, then I made sure the linux I was using can do hardware detection, so you can boot this off different hardware and linux will find all the new, different hardware, and all I really care about is the network card. Then I have mysql and samba serve out the data that is residing on the raid partition.

Why? Server goes down at night, you can make any pc at the office a server in less then 5 minutes.

enamelrod
Posts: 462
Joined: Tue Jul 24, 2007 9:51 am

Post by enamelrod » Tue Sep 25, 2007 7:22 am

so justin does this work or are you still toying with it?

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Post by Justin Shafer » Mon Oct 29, 2007 4:54 am

It works... I am using it at an office and so far so good but technically Im still toying with it... I need to go out to the office and boot off the external drives and see how their databases are doing. I had to change my crontab file to be more complex then I expected.

You have to tell mdadm that you want to fail, and remove the drive from the array and also have cron automatically add the drive to the array once its been attached to the computer....

At 9:15 in the morning it will fail the drive, remove the drive from the array 5 minutes later, then another 5 minutes it will automatically add it back. I cant come up with a way to do this more intelligently... The server is always running the add command every 5 minutes for all 4 drives. So the doc has to have the drive connected before 9:15 am which is no problem as the drive is usually connected the day before, right before he leaves.. So if today was wednesday wednesday would be disconnected at the end of the day and thursday would be put on... then at 9:20-9:25 am thursday it would be added to the array..

You cant tell mdadm to constantly add otherwise it will fail by saying the device is busy... so the way around it is to fail the device, then remove it, then add it. Them mdadm is happy.

Here is my cron file

*/5 * * * * /sbin/mdadm --manage --add /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY48F4B-0:0-part2
15 9 * * * /sbin/mdadm --manage --fail /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY48F4B-0:0-part2
20 9 * * * /sbin/mdadm --manage --remove /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY48F4B-0:0-part2
*/5 * * * * /sbin/mdadm --manage --add /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3XA72-0:0-part2
15 9 * * * /sbin/mdadm --manage --fail /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3XA72-0:0-part2
20 9 * * * /sbin/mdadm --manage --remove /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3XA72-0:0-part2
*/5 * * * * /sbin/mdadm --manage --add /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY1X2J7-0:0-part2
15 9 * * * /sbin/mdadm --manage --fail /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY1X2J7-0:0-part2
20 9 * * * /sbin/mdadm --manage --remove /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY1X2J7-0:0-part2
*/5 * * * * /sbin/mdadm --manage --add /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3VSME-0:0-part2
15 9 * * * /sbin/mdadm --manage --fail /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3VSME-0:0-part2
20 9 * * * /sbin/mdadm --manage --remove /dev/md1 /dev/disk/by-id/usb-Seagate_FreeAgent_Go_5LY3VSME-0:0-part2
30 18 * * * rsync -rPzt --modify-window=2 /Data/* latname@lastnameddshome.gotdns.com:/cygdrive/c/Apps
25 18 * * * rsync -rPzt --modify-window=2 /Data/mysql/opendental/* lastname@lastnameddshome.gotdns.com:/cygdrive/c/mysql/data/opendental

Post Reply