Welcome to WebmasterWorld Guest from 184.73.126.70

Forum Moderators: bakedjake

Message Too Old, No Replies

Linux server with two mirrored drives

Possible?

   
7:58 pm on Aug 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey all,

My first foray into linux is about to begin. I'm going to pick up two 250gig hd's and install them in my older pc. I want to turn it into a file/print server with linux, and have one drive mirror the other.

Can anyone recommend a linux install that would be able to handle that? I don't want to setup a raid array necessairly, just have the main hard drive cloned onto the extra hard drive automatically (or as automated as possible).

If anyone is doing this already, let me know!

9:35 pm on Aug 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm doing a nightly mirror with Fedora 4, and rsync. My mirrors are mounted on /mirror, /mirror/home, etc. And I have a script which performs the mirroring (only the changes, including deletions), as follows.

#!/bin/bash

cd /
if [! -e "/mirror/etc" ]; then
echo "/mirror does not seem to be mounted."
exit 1
fi

cd /
rsync --archive --verbose --perms --delete --hard-links \
--exclude=/mirror \
--exclude=/media \
--exclude=/mnt \
--exclude=/dev \
--exclude=/proc \
--exclude=/sys \
--exclude=/misc \
--exclude=/net \
--exclude=/var/named/chroot/proc \
--exclude=/var/lib/nfs/rpc_pipefs \
. /mirror

4:27 pm on Aug 26, 2006 (gmt 0)

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Some/most of the current Linux distro's will easily allow you to set up software raid during the installation. Mandriva does this through a simple gui during the install. Not hard at all. So if you want a real mirror that's easy to setup, software raid's the way to go.

There are problems with raid like this though (you can end up with two copies of bad data). If that's your concern, then rsync as noted above is the way to go. Set up correctly, rsync will copy all files over during the first copy, then only changed files after that. You can set it up as a cron job once a day or a couple of times a day, and exclude files like log files.

I do both. Raid locally (mostly just because I can) and then I pretty much clone my entire drive offset every night. It's the offsite clone and archives that allow me to sleep at night.

5:22 pm on Aug 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What about booting? Will rsync copy boot loader files to?

It's all good and well mirroring a disk via rsync but what if the master disk fails? Can you just remove it, move the second disk to be the master and add a brand new disk as the new mirror?

This is something I have not found out how to do. With windows I run ghost every week to duplicate disks. If the main disk fails I just remove it and boot from the ghosted disk.

5:40 pm on Aug 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Excellent point. Rsync will copy all of the files on the disk. However, you need to manually install the bootloader on the secondary disk, thereby making it bootable.

I cheated by cloning it like this:

Install Linux on the primary drive
Mirror the partition table and boot loader like this for IDE drives:
dd if=/dev/hda of=/dev/hdb bs=1k count=10
Or like this for SCSI or SATA drives:
dd if=/dev/sda of=/dev/sdb bs=1k count=10
Reboot
Format the partitions on the secondary drive

3:13 am on Aug 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I totally messed up, being the linux noob that I am.

I ended up installing ClarkConnect, which is working great. The only thing is that instead of showing two seperate hard drives, it shows one large volume (as in both drives together).

I don't know much about partitioning and just left the defaults in.

Is it possible to seperate the drives without having to re-install linux?

5:25 pm on Aug 27, 2006 (gmt 0)

WebmasterWorld Senior Member jtara is a WebmasterWorld Top Contributor of All Time 5+ Year Member



The only thing is that instead of showing two seperate hard drives, it shows one large volume (as in both drives together)

What is the size of the one volume? Is it the size of the two drives combined, or the size of only one drive?

With RAID mirroring you are NOT going to see two seperate volumes in the OS.

If the size of the volume is the size of both drives combined, sounds like you installed with RAID 0 (striping). You wanted RAID 1 (mirroring). In that case, you'll have to start over.

5:47 am on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It shows one big volume.

I'm new to raid though - I don't need any extra hardware for that, do I?

12:32 pm on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member



There's two types of raid, hardware and software. Hardware raid is controlled by the physical controller card. Software raid is handled by the OS. You're using software raid. It used to be that hardware raid was noticeably faster, for most of us these days software raid works fine.

Raid 0 is basically concatenation of drives - making a bunch of disjoint drives into one large drive. That's what you've done. It increases your disk size at the expense of probability of failure (your entire data is now dependent on two drives probability of failing instead of just one).

Raid 1 is effectively mirroring of two drives. If you have two 100 gig hard drives, your total space ends up being 100 gigs. Everything is written to both drives at the same time. The intention is that if one drive dies, the second drive will continue to work, you can pull the bad drive, stick in a new one, the good drive will replicate to the new drive and you're going again. How well this works in reality is debatable.

I would not use raid as a backup or archive practice. It's OK for mission critical servers across many drives but do not use raid as your primary backup method.

8:12 pm on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wheel, what would you suggest as a better backup option? Online uploading of files?
9:33 pm on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member jtara is a WebmasterWorld Top Contributor of All Time 5+ Year Member



You certainly want some form of backup that stores a copy off-site at some interval. What if there is a fire, etc.?
10:40 pm on Sep 1, 2006 (gmt 0)

10+ Year Member



As previously mentioned, RAID is not a backup method, it's a downtime prevention measure. If you just use backup, and a drive fails, then you're down until you can rebuild the system and restore the data.

To prevent downtime and to secure your data from loss, you should use both RAID (software RAID 1, mirroring, is fine) and backup your data to something external to the server, preferrably offsite. If you can't back it up offsite, then onsite is better than nothing. RAID 1 with two internal drives, and a single USB drive with a cronjob setup to copy data, is usually sufficient.