Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo installed on 1 disk, now I want RAID5
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
petrjanda
Veteran
Veteran


Joined: 05 Sep 2003
Posts: 1557
Location: Brno, Czech Republic

PostPosted: Wed Feb 09, 2005 8:28 am    Post subject: Gentoo installed on 1 disk, now I want RAID5 Reply with quote

Is it possible without reinstalling the whole system?
_________________
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Back to top
View user's profile Send private message
halfgaar
l33t
l33t


Joined: 22 Feb 2004
Posts: 781
Location: Netherlands

PostPosted: Wed Feb 09, 2005 6:18 pm    Post subject: Reply with quote

It should. There are howtos wandering the net at www.tldp.org about how to convert an existing system to raid. It involves marking newly added partitions of the MD drive as failed and when the setup is complete, let it sync as if you've installed a new disk.

A quick search reveales http://www.tldp.org/HOWTO/Boot+Root+Raid+LILO-4.html, but I remember from when I was configuring raid, that there are a few different howto's out there, some of which are outdated, incorrect or too clumsy.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Feb 10, 2005 7:29 am    Post subject: Reply with quote

You can't make an existing partition part of a software raid set unless the partition's system id was set to fd, Linux raid auto. I know as I tried to turn an existing system into a RAID 1 set. IIRC you can set it up, change the partition id, but the md stuff complains about blocks or somethig. RAID 5 is completely outside the realm of possibility as you'd need to generate all your meta data across your disk from the original data.

What you can do is create a RAID 5 set of disks that don't involve the original. Then move each partition over to the new RAID set. Pain in the ass, but it'll work. Eventually you'd move /boot and / over reinstall grub, tweak grub to play nice with software Raid, and then pull the old system disk.

The rules will be different for hardware based RAID 1 depending out the manufacturer.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
petrjanda
Veteran
Veteran


Joined: 05 Sep 2003
Posts: 1557
Location: Brno, Czech Republic

PostPosted: Thu Feb 10, 2005 11:15 am    Post subject: Reply with quote

Then why is this webpage saying something else?
http://www.tldp.org/HOWTO/Boot+Root+Raid+LILO-4.html
_________________
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Back to top
View user's profile Send private message
halfgaar
l33t
l33t


Joined: 22 Feb 2004
Posts: 781
Location: Netherlands

PostPosted: Thu Feb 10, 2005 12:31 pm    Post subject: Reply with quote

kashani wrote:
You can't make an existing partition part of a software raid set unless the partition's system id was set to fd, Linux raid auto. I know as I tried to turn an existing system into a RAID 1 set. IIRC you can set it up, change the partition id, but the md stuff complains about blocks or somethig. RAID 5 is completely outside the realm of possibility as you'd need to generate all your meta data across your disk from the original data.

What you can do is create a RAID 5 set of disks that don't involve the original. Then move each partition over to the new RAID set. Pain in the ass, but it'll work. Eventually you'd move /boot and / over reinstall grub, tweak grub to play nice with software Raid, and then pull the old system disk.

The rules will be different for hardware based RAID 1 depending out the manufacturer.

kashani


I've never setup RAID5, but I can tell you that setting up RAID1 using an existing array is easy as pie, I've done it several times. Maybe your error about blocks was that there weren't enough, that you didn't make the new partition of equal or bigger size than the original.

And about RAID5, the howto says it's possible, but doesn't show an example. I must say, I'm not sure how they would generate the parity information over the existing and new drives. If you've got spare hardware to test with, I'd test it first. Perhaps there's some more info somewhere on the net, someone else must have tried it.

And remember, always backup first, before you start messing with raid creation or re-syncing...
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Feb 10, 2005 4:04 pm    Post subject: Reply with quote

Did anyone actually read the How-to? It clearly says

1. Make a degraded RAID
2. Copy your OS from the original disk to the new RAID
3. Format the original disk and then add it to the RAID.

which is exactly what I said other then I pointed out that you can't just add another drive or five, hit the 'make raid' button, and watch the RAID come up against your original install/disk.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
halfgaar
l33t
l33t


Joined: 22 Feb 2004
Posts: 781
Location: Netherlands

PostPosted: Thu Feb 10, 2005 4:27 pm    Post subject: Reply with quote

kashani wrote:
Did anyone actually read the How-to? It clearly says

1. Make a degraded RAID
2. Copy your OS from the original disk to the new RAID
3. Format the original disk and then add it to the RAID.

which is exactly what I said other then I pointed out that you can't just add another drive or five, hit the 'make raid' button, and watch the RAID come up against your original install/disk.

kashani


Ok, you're right. But, the original question was if you can setup a raid without re-installing. You can. With RAID1 at least, you add the drive, setup the MD (mirror device) setting your existing drive as failed, copy the system to the MD, and sync over the original partition.
Back to top
View user's profile Send private message
brickhaus
n00b
n00b


Joined: 17 Feb 2004
Posts: 9

PostPosted: Thu Feb 10, 2005 7:54 pm    Post subject: And The Answer to the Original Question is... Reply with quote

No, you can't dynamically build a RAID 5 disk from a single drive... here's the science.

Disclaimer: Since the original poster was asking about reinstalling, I'm assuming that the original poster is attempting to make the disk that their /boot partition is on into RAID5.

First and foremost, you need to understand the differences between non-RAID, RAID 1, and RAID 5. Non-RAID is obviously the default and data is stored sequentially (for the most part) on the disk. RAID 1 builds on non-RAID by mirroring the sequential information onto a second disk. RAID5 doesn't store the information sequentially on any one disk. RAID5 stripes information across multiple disks (I'm ignoring parity since I'll assume that the original poster possibly already did that bit of homework).

There are plenty of ways to build a RAID1 array off a single non-RAID disk, as has been mentioned in this thread. The important thing to remember here is that the 2 disks in a RAID1 array are EXACTLY IDENTICAL. Therefore there's no need to redistribute the information previously stored on the original non-RAID disk -- it's just making a copy of it.

The difference with RAID5 is that it's striped across 3 disks or more. Therefore, no 2 disks in the array are exactly identical. For instance, if you have 3 drives set up in RAID5 with a 4KB stripe size, a 16KB file will be broken up into 4 4KB stripes and stored as such:
    The first 4KB chunk is on the first drive
    The second 4KB chunk is on the second drive
    The third 4KB chunk is on the third drive
    The fourth 4KB chunk is on the fourth drive

Therefore, if you were to attempt to take a non-RAID drive and make it into RAID5, there would be a need to redistribute the information stored on the original disk over the rest of the array. This would more than likely corrupt any information on the original disk since striping would have to be handled.

The simple answer is no. Don't try. Backup your original disk to another disk or another box via NFS or Samba and then use a Gentoo boot disk, create the array, then copy the information back over to the new array.

However, this begs the question (of which I don't know the answer), can you even boot a system off any RAID setup other than RAID1? Can Grub or LILO handle constructing the array without the kernel? I would think that the kernel would need to be booted and then it would handle the construction of the RAID array...
Back to top
View user's profile Send private message
halfgaar
l33t
l33t


Joined: 22 Feb 2004
Posts: 781
Location: Netherlands

PostPosted: Thu Feb 10, 2005 8:02 pm    Post subject: Re: And The Answer to the Original Question is... Reply with quote

brickhaus wrote:
No, you can't dynamically build a RAID 5 disk from a single drive... here's the science.

Disclaimer: Since the original poster was asking about reinstalling, I'm assuming that the original poster is attempting to make the disk that their /boot partition is on into RAID5.

First and foremost, you need to understand the differences between non-RAID, RAID 1, and RAID 5. Non-RAID is obviously the default and data is stored sequentially (for the most part) on the disk. RAID 1 builds on non-RAID by mirroring the sequential information onto a second disk. RAID5 doesn't store the information sequentially on any one disk. RAID5 stripes information across multiple disks (I'm ignoring parity since I'll assume that the original poster possibly already did that bit of homework).

There are plenty of ways to build a RAID1 array off a single non-RAID disk, as has been mentioned in this thread. The important thing to remember here is that the 2 disks in a RAID1 array are EXACTLY IDENTICAL. Therefore there's no need to redistribute the information previously stored on the original non-RAID disk -- it's just making a copy of it.

The difference with RAID5 is that it's striped across 3 disks or more. Therefore, no 2 disks in the array are exactly identical. For instance, if you have 3 drives set up in RAID5 with a 4KB stripe size, a 16KB file will be broken up into 4 4KB stripes and stored as such:
    The first 4KB chunk is on the first drive
    The second 4KB chunk is on the second drive
    The third 4KB chunk is on the third drive
    The fourth 4KB chunk is on the fourth drive

Therefore, if you were to attempt to take a non-RAID drive and make it into RAID5, there would be a need to redistribute the information stored on the original disk over the rest of the array. This would more than likely corrupt any information on the original disk since striping would have to be handled.

The simple answer is no. Don't try. Backup your original disk to another disk or another box via NFS or Samba and then use a Gentoo boot disk, create the array, then copy the information back over to the new array.

However, this begs the question (of which I don't know the answer), can you even boot a system off any RAID setup other than RAID1? Can Grub or LILO handle constructing the array without the kernel? I would think that the kernel would need to be booted and then it would handle the construction of the RAID array...


The answer to the boot problem is to create a non-raid boot partition. Or make more than one, on all the disks, so you can instruct your bios (or bootflop or whatever) to boot from another drive when the first one has failed.

I have a question. RAID5 does provide some redundancy in case of disk failure, right? If everything is as you say it is, how can you replace a drive when one has failed?
Back to top
View user's profile Send private message
petrjanda
Veteran
Veteran


Joined: 05 Sep 2003
Posts: 1557
Location: Brno, Czech Republic

PostPosted: Thu Feb 10, 2005 9:07 pm    Post subject: Re: And The Answer to the Original Question is... Reply with quote

Quote:

I have a question. RAID5 does provide some redundancy in case of disk failure, right? If everything is as you say it is, how can you replace a drive when one has failed?

Each drive contains enough information, so that if one disk fails and a new one is put in, the data is copied over to the new disk and youre off to go. This is why you need at least 3 disks for this raid configuration. Like with RAID0 you double the space (eg. 2x80=160), but the third is used explicitly for parity, but im not sure what happens if 2 disks fail. In fact using RAID5 you pretty much have 1/3 disk space wastage, which is the redundancy.
_________________
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Back to top
View user's profile Send private message
brickhaus
n00b
n00b


Joined: 17 Feb 2004
Posts: 9

PostPosted: Thu Feb 10, 2005 11:30 pm    Post subject: Clarification of RAID levels. Reply with quote

petrjanda wrote...
Quote:
Each drive contains enough information, so that if one disk fails and a new one is put in, the data is copied over to the new disk and youre off to go. This is why you need at least 3 disks for this raid configuration. Like with RAID0 you double the space (eg. 2x80=160), but the third is used explicitly for parity, but im not sure what happens if 2 disks fail. In fact using RAID5 you pretty much have 1/3 disk space wastage, which is the redundancy.


No, that's not quite how it works. You are thinking of RAID4. In RAID4, there is a separate parity disk. Please allow me to elaborate on parity, which was something I purposefully ignored in my original post...

In RAID0, the striping I described happens, but there is no rebuilding the data in case of a drive failure. I hope you have good backups.

RAID1 is mirroring, no striping. Essentially you have an exact copy of the first disk on the second disk.

RAID4 is mirroring and striping. In this scenario, the first two drives are striped together, and the third disk is a parity disk, storing bits of data that can be mathematically combined with data from the good disk to restore the bad disk. This is fine, but is slow because everytime the system writes to the disks, there also has to be a write to the third disk, thereby slowing down the operation. Read is really fast though.

RAID5 is similar to RAID4 but with one major difference: parity information is stored on each disk. This is faster than RAID4 because now, instead of completing a separate write operation, you're doing it on a disk you're already writing to. It's still not as fast (write-wise) as RAID0 (or even RAID1 for that matter).

If 2 disks fail in any of these scenarios, you're dead in the water. RAID1, 4, and 5 can recover from a single drive failure. Hope you've got good backups.

There's a good description of it here: http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Software-RAID-HOWTO.html#ss1.4

[Edit]
And here's what I was really looking for... not for the faint of heart...
http://arstechnica.com/paedia/r/raid-1.html
Back to top
View user's profile Send private message
petrjanda
Veteran
Veteran


Joined: 05 Sep 2003
Posts: 1557
Location: Brno, Czech Republic

PostPosted: Fri Feb 11, 2005 1:08 am    Post subject: Re: Clarification of RAID levels. Reply with quote

brickhaus wrote:
petrjanda wrote...
Quote:
Each drive contains enough information, so that if one disk fails and a new one is put in, the data is copied over to the new disk and youre off to go. This is why you need at least 3 disks for this raid configuration. Like with RAID0 you double the space (eg. 2x80=160), but the third is used explicitly for parity, but im not sure what happens if 2 disks fail. In fact using RAID5 you pretty much have 1/3 disk space wastage, which is the redundancy.


No, that's not quite how it works. You are thinking of RAID4. In RAID4, there is a separate parity disk. Please allow me to elaborate on parity, which was something I purposefully ignored in my original post...

In RAID0, the striping I described happens, but there is no rebuilding the data in case of a drive failure. I hope you have good backups.

RAID1 is mirroring, no striping. Essentially you have an exact copy of the first disk on the second disk.

RAID4 is mirroring and striping. In this scenario, the first two drives are striped together, and the third disk is a parity disk, storing bits of data that can be mathematically combined with data from the good disk to restore the bad disk. This is fine, but is slow because everytime the system writes to the disks, there also has to be a write to the third disk, thereby slowing down the operation. Read is really fast though.

RAID5 is similar to RAID4 but with one major difference: parity information is stored on each disk. This is faster than RAID4 because now, instead of completing a separate write operation, you're doing it on a disk you're already writing to. It's still not as fast (write-wise) as RAID0 (or even RAID1 for that matter).

If 2 disks fail in any of these scenarios, you're dead in the water. RAID1, 4, and 5 can recover from a single drive failure. Hope you've got good backups.

There's a good description of it here: http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Software-RAID-HOWTO.html#ss1.4

[Edit]
And here's what I was really looking for... not for the faint of heart...
http://arstechnica.com/paedia/r/raid-1.html

Thats pretty much what I was saying. I wasnt talking about particular disks, but the whole array as one entity 3x80gb = 240gb, even though usable space is only 2x80gb since the third 80gb goes for parity, right?
Sorry that i wasnt clear.
_________________
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Back to top
View user's profile Send private message
gregcoit
Tux's lil' helper
Tux's lil' helper


Joined: 12 Jun 2002
Posts: 101

PostPosted: Tue Feb 15, 2005 4:44 am    Post subject: Space used by parity in RAID5 Reply with quote

The answer is 1 disks worth. Of coarse, the parity is shared among all the drives in the raid, but the equivelent of 1 disks worth is used by the parity. Here's the cool part - this is regardless of how many disks are in the raid!

So, in a 3x80GB raid5, 160GB is useable.

In a 4x80GB raid5, 240GB is useable.

In either case, only 80GB's worth of space is used for parity.

Hope this helps,

Greg
_________________
"Life would be so much easier if we could see the source code"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum