# to raid or not to raid?

## DaggyStyle

hello all,

I have two samsung f3 1TB hd and I'm wandering how to prepare the layout on them and thought I'd see if raid is a good idea.

they will be used for backup, media storage and user's home dirs.

also, my mb doesn't support raid, so I can do only sw raid.

is there any raid setup which can suits me? what are the cons on such setup?

Thanks.

----------

## Veldrin

The good part about sw raid is, that is can be implemented on any hardware, with any level - provided that you have enough disks.

As you mentioned, that you have only 2 hdds, raid1 or raid0 are the only option. (agreed, you could also use jbod, but this does not count as raid IMO)

raid1 mirrors your data, raid0 stripes it. 

with raid1 your data survives a disk failure, with raid0 it does not.

raid1 provides the same speed as single disk, raid0 could double the speed.

raid1 allows you only to use half of the total space (due to redundancy), raid0 allows you to use the entire space

I would definitely use raid1 for the home dirs.

media storage, and backup data could be on raid1 or raid0 depending on your needs.

If restoring from backup (for the media data), or living without backup for some time is an option (both in case of a raid failure), then raid0 is an option, due to the increase space available.

sw raid also allows you to partition a hdd (or in your case a pair), and use one part as raid1 and another as raid0. this is the same as intel does with its matrix storage raid...

and one last point - raid1 does not replace a backup solution. it only allows you to continue working if one disk dies. but it does not protect against accidental deletion.

V.

----------

## DaggyStyle

thanks for the explanation.

first, the backup I've mentioned is for confs files mostly in case I loss them (almost happened the other day when I lost a 80GB hd with portage tree, boot, overlay, games and var), I haven't thought of backing up the personal info as I have quite alot and my wife uses xp in vmware so I didn't know what is the right way to back it up and I don't have extra money.

I want to see if I got it right, let say I want to allocate 600GB for personal data as raid 1 and the rest for media as raid 0, then I'll have to allocate 1.2 TB for the personal data and 800GB for the rest?

----------

## Veldrin

 *Quote:*   

> I want to see if I got it right, let say I want to allocate 600GB for personal data as raid 1 and the rest for media as raid 0, then I'll have to allocate 1.2 TB for the personal data and 800GB for the rest?

 

quite, and not quite...

just to get this straight: 

you have 2 hdd, lets say sda and sdb with 1TB (or 1000GB for simplicity)

you partition both of them into 600GB (sda1, sdb1)  and 400GB (sda2, sdb1).

then you create a raid1 (md1) set out of the two 600GB partitions 

and you create another raid0 (md2) set out of the two 400GB partitions

(md1/md2 is just the kernel notation for sw raid devices)

md1 (raid1) will have 600GB of usable space, and md2 will have 800GB of usable space.

raid1 (or mirror raid) basically saves you data on 2 disks, and this causes (depending on the point of view) that you data takes up twice the space, or your available space is halved. I prefer the second view.

as you backup mostly your config files, i would suggest, that you put them too on a raid1 partition, because, if your raid0 partitions dies (due to a disk failure) your backups are gone. on a raid1 they survive.

V.

----------

## DaggyStyle

<OT>

if both of them die, then I have nothing left.

</OT>

that will make my media spread over two hd, not sure I've feeling comfortable about that...

if one hd fails, can I access the other part like in lvm partially?

how about performance in raid0? from what I understand, every action is done twice, isn't this cause performance issue?

----------

## Veldrin

 *Quote:*   

> if one hd fails, can I access the other part like in lvm partially?

 

well there is the option of using jbod (just a bunch of disks) mode, which basically concatenates both disks. IIRC in that case you have a chance of being able to read at least some part of the data.

 *Quote:*   

> how about performance in raid0? from what I understand, every action is done twice, isn't this cause performance issue?

 

raid0 gets faster the more disks you use. but it takes only one dead disk to destroy the entire array.

with raid1, the same data gets written twice, and the performance impact is negligible

raid5 and raid6 where some checksum computation needs to be made, there could be some performance loss on weak hardware. 

I probably did not stress it enough:

I am no fan of raid0. there are some/few cases where it makes IMO sense to use it. Cases as for the portage tree (can be regenerated pretty easily) or for /var/tmp where only temporary data resides. Or basically any case where temporary or volatile data is involved.

HTH

V.

----------

## depontius

[quote="Veldrin"

raid1 provides the same speed as single disk, raid0 could double the speed.

[/quote]

Actually, raid1 doubles your read speed in a more interesting way that raid0.  With raid1 you don't bother reading both drives - the second drive only needs to be read if the first says that a read failed.  So generally in raid1 both drives are scheduled for reading separate data.  That means that they can stripe their reads, to get the same read bandwidth as raid0.  But more often it means that the two drives can optimize their seeks separately, giving better multitasking performance.

Writes of course are back to single-drive performance.

----------

## Veldrin

 *Quote:*   

> Actually, raid1 doubles your read speed in a more interesting way that raid0. With raid1 you don't bother reading both drives - the second drive only needs to be read if the first says that a read failed. So generally in raid1 both drives are scheduled for reading separate data. That means that they can stripe their reads, to get the same read bandwidth as raid0. But more often it means that the two drives can optimize their seeks separately, giving better multitasking performance. 

 

Isn't that how it should work, but not how it does. My current sw raid1 arrays normally only read from one disk.

The same goes for the current implementation of btrfs.

V.

----------

## DaggyStyle

so raid0 on two hd will not save my data at all, not even part of it.

not sure I want that.

----------

## Veldrin

well, true - the redundant part is somewhat omitted in raid0

 *Quote:*   

> not sure I want that.

 

Then, what do you want?

----------

## DaggyStyle

 *Veldrin wrote:*   

> well, true - the redundant part is somewhat omitted in raid0
> 
>  *Quote:*   not sure I want that. 
> 
> Then, what do you want?

 

ok, for now, I'll use the raid1 for my wife's vmware fro 100gb.

about the rest, I'm still not sure, maybe raid0 for my media, but backup and rest of home will probably be in lvm.

two questions, I'm looking at the lvm2+raid howto, just to verify, lvm is a must for raid?

second, will  mknod /dev/md1 b 9 1&& mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1 is ok?

----------

## Veldrin

Sorry for the late answer

 *Quote:*   

> two questions, I'm looking at the lvm2+raid howto, just to verify, lvm is a must for raid? 

 

No, lvm and raid can used seperately, or combinded as described the howto.

 *Quote:*   

> second, will mknod /dev/md1 b 9 1&& mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sda1 /dev/sdb1 is ok?

 

correct, assuming, that both hdd have been partitioned, and that you want a raid1 array.

V.

----------

## tv007

 *DaggyStyle wrote:*   

> two questions, I'm looking at the lvm2+raid howto, just to verify, lvm is a must for raid?

 

No, LVM just adds another level of abstraction / flexibility. With LVM you can do things that would be impossible or very difficult with RAID, e.g. adding more space to a partition etc. You could do something similar with RAID0 but it's much more difficult. But I believe you really don't need LVM, it will just complicate things for you.

Anyway I think the decision should be quite simple. Do you want to make the storage more reliable? Use RAID1. Do you just want to get as much space as possible? Use RAID0 (or LVM to create a logical volume on top of those drives). How much data are we talking about? If you only need to backup the config files, then it probably is not more than a few MBs - it seems like an overkill to build a RAID for that. Wouldn't it be easier to backup the data somewhere else?

BTW I've noticed you have two exactly the same drives - same manufacturer, type, maybe even the same batch. That generally is not a good thing, when building RAID. The drives are subject to the same conditions, workload, manufacturing problems etc. which means it's very likely they'll fail at about the same time. I've seen several RAID arrays that were running fine for a year and then all the drives failed within an hour. If you can, go and switch one of the drives for a different one.

----------

## DaggyStyle

 *tv007 wrote:*   

>  *DaggyStyle wrote:*   two questions, I'm looking at the lvm2+raid howto, just to verify, lvm is a must for raid? 
> 
> No, LVM just adds another level of abstraction / flexibility. With LVM you can do things that would be impossible or very difficult with RAID, e.g. adding more space to a partition etc. You could do something similar with RAID0 but it's much more difficult. But I believe you really don't need LVM, it will just complicate things for you.
> 
> Anyway I think the decision should be quite simple. Do you want to make the storage more reliable? Use RAID1. Do you just want to get as much space as possible? Use RAID0 (or LVM to create a logical volume on top of those drives). How much data are we talking about? If you only need to backup the config files, then it probably is not more than a few MBs - it seems like an overkill to build a RAID for that. Wouldn't it be easier to backup the data somewhere else?
> ...

 

I'll use raid1 for my wife's windows on vmware, the raid0 will be used for the media repository.

although the hd are same, they were purchased in different timelines, one is about 7-8 months old (was using mostly as storage and the other is brand new, so I don't think they will fail together.

thanks for the headsup thought.

----------

