# Software vs. Hardware RAID [solved]

## coplaniuk

I am looking into upgrading my home "server" (low-demand - literally a desktop machine with two NICs).  One of the things I'm looking into where I might need some help is that I want to set up RAID 1 (mirror).  I also want to look into getting SATA hard drives for that purpose.  As my motherboard doesn't support it, I will need to get some sort of controller.  Money is a big issue.  I see two potential scenarios:

1) Get a standard 2-channel SATA card and run software RAID.

2) Get a cheap (Less than $50) RAID 1 controller card and run hardware RAID.  

The reason I want to run RAID is to avoid potential data loss as a result of physical hard drive failure.  I'm not so concerned about the performance as the server is rarely stressed.  But I'm not clear on the pros and cons for either.  It would just seem to me that software RAID isn't really all that dependable.  On the other hand...I don't have the money to get a good RAID controller, so the Software RAID may be the better option.

What are your thoughts?

----------

## BitJam

IMO software RAID is vastly superior to hardware RAID.  Decades ago when CPU's were miniscule compared to today's processors, hardware RAID helped prevent you from taking a performance hit.   That advantage is totally unimportant now.

Software RAID is much more reliable than hardware RAID because you can always re-install the software on new hardware.  On the other hand, if your hardware RAID card blows up then you are totally screwed unless you can get your hands on an exact replacement.

----------

## coplaniuk

You can't replace an old hardware RAID card with a different card?  I always thought RAID cards all worked the same.  

Are there any after-market SATA controllers you might recommend?

----------

## schachti

 *coplaniuk wrote:*   

> You can't replace an old hardware RAID card with a different card?  I always thought RAID cards all worked the same.  

 

No, they aren't. Different controller chips use different data formats on the disks. There might be compatible chips, but if you really want to be sure to be able to access your data after a hardware failure, better use software RAID. If you have a dual core CPU, you hardly will notice any slowdown in daily operations.

----------

## Akkara

 *Quote:*   

> upgrading my home "server" (low-demand) [...] Money is a big issue. [...] The reason I want to run RAID is to avoid potential data loss as a result of physical hard drive failure.

 

It isn't as sexy, but have you considered simply having two drives, identically partitioned, and a cron job to periodically rsync the active onto the backup?

Advantages of the rsync scheme:

- Serves as a poor-man's backup to recover from "oops I didn't mean to delete that" mistakes.

- Option for reduced power consumption if the backup drive is spun down between rsyncs.

- Different use and wear profiles for the two drives makes it less likely they both fail soon after one does.

- Verbose rsync change-log sometimes useful to see what changed in the course of a day.

Disadvantages of the rsync scheme:

- Main drive failure requires manual switchover to backup drive.

- Data written after the rsync can be lost if the main drive fails. (Provide a manual means of starting the script when large or important changes are written.)

----------

## coplaniuk

Don't have a dual-core machine...it's only a 1GHz CPU.  As I said...performance isn't really an issue.  Server is basically just a firewall and data storage for music/photos.  Can't imagine that causing too much performance problems.  Looks like I'll be using Software RAID then.

Thanks for your help.

----------

## ebnerjoh

Hi!

One question regarding the performance. I have a old Pention with 733 MHz which is running as a File-, Web-, and Mailserver. What will be the impact on the performance?

Best Regards,

Johannes

----------

## coplaniuk

I've been running my Software Raid for nearly 9 months now, and I honestly havn't noticed any performance drops.  Granted, I'm not playing games on that server, nor do I even have XFree installed.  But benchmark wise, it appears to have little effect.  I'm actually getting a boost in read/write times on the raid device(s), which is expected considering the way RAID works.

----------

## fangorn

If you are doing RAID1 the difference between hardware and software RAID are minimal. 

For RAID0 (striping) it depends on the controller (throughput) if the software solution is even faster. 

The point where hardware is far superior over software is anything involving RAID5 or 6 as massive XOR calculations have to be performed when writing. This is the point when a 5 drive RAID5 in software is <<30 MB/s while good consumer hardware is >100 MB/s while writing.

----------

## Cyker

 *schachti wrote:*   

>  *coplaniuk wrote:*   You can't replace an old hardware RAID card with a different card?  I always thought RAID cards all worked the same.   
> 
> No, they aren't. Different controller chips use different data formats on the disks. There might be compatible chips, but if you really want to be sure to be able to access your data after a hardware failure, better use software RAID. If you have a dual core CPU, you hardly will notice any slowdown in daily operations.

 

Does this apply to RAID1?

I thought that RAID1 just mirrored the disks, but aside from that didn't do anything special (I know Linux software RAID1 does this, which is why it's the only Linux RAID that it's possible to boot from...)

With software RAID, the main trick is to have a fast controller chip; Something onboard connected via PCIe or HyperTransport is good, but avoid PCI-based controllers.

After that, RAID5 benefits from a dual-core CPU and will give a hardware RAID card a run for its money when properly tweaked.

----------

## ebnerjoh

Hi!

I am a bloody beginner with software raid. I have three questions to you:

1) When I have to replace a disk from the raid, do i have to reinstall the bootloader manualy on the replaced disk?

2) I have to 500G SATA Drives and I made 3 partitions (boot, swap and root). All three partitions are mirrored. I know that it is useless for the swap but I also made a raid1 for the swap. Now i can see with 

```
cat /sys/block/mdX/md/mismatch_cnt
```

a lot of mismatches on the raid.

3) I have a controller and hard disks with NCQ support. Does this make sense on a raid1?

Best Regards,

Johannes

----------

