* Converting RAID5 to RAID0
@ 2014-08-31 12:43 Mike Muratet
2014-08-31 17:13 ` Robin Hill
2014-08-31 22:31 ` NeilBrown
0 siblings, 2 replies; 9+ messages in thread
From: Mike Muratet @ 2014-08-31 12:43 UTC (permalink / raw)
To: linux-raid
I am doing some experiments with mdadm to combine two 1TB disks into a RAID
array. I used fdisk to create the partitions and mdadm to create a two disk
RAID5 array. I would like to have more space and I can live without
redundancy. I searched the man pages and boards for a way to do that and found:
$ sudo mdadm /dev/md0 -f /dev/sdd
mdadm: set /dev/sdd faulty in /dev/md0
$ sudo mdadm /dev/md0 -r /dev/sdd
mdadm: hot removed /dev/sdd from /dev/md0
$ sudo echo raid0 > /sys/block/md0/md/level
-bash: /sys/block/md0/md/level: Permission denied
which was not the result I expected.
Is it possible to convert RAID5 to RAID0?
There are no data on the disk. Is there a way to start over?
Cheers
Mike
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Converting RAID5 to RAID0
2014-08-31 12:43 Converting RAID5 to RAID0 Mike Muratet
@ 2014-08-31 17:13 ` Robin Hill
2014-08-31 22:31 ` NeilBrown
1 sibling, 0 replies; 9+ messages in thread
From: Robin Hill @ 2014-08-31 17:13 UTC (permalink / raw)
To: Mike Muratet; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]
On Sun Aug 31, 2014 at 12:43:26PM +0000, Mike Muratet wrote:
> I am doing some experiments with mdadm to combine two 1TB disks into a RAID
> array. I used fdisk to create the partitions and mdadm to create a two disk
> RAID5 array. I would like to have more space and I can live without
> redundancy. I searched the man pages and boards for a way to do that and found:
>
> $ sudo mdadm /dev/md0 -f /dev/sdd
> mdadm: set /dev/sdd faulty in /dev/md0
> $ sudo mdadm /dev/md0 -r /dev/sdd
> mdadm: hot removed /dev/sdd from /dev/md0
> $ sudo echo raid0 > /sys/block/md0/md/level
>
> -bash: /sys/block/md0/md/level: Permission denied
>
> which was not the result I expected.
>
> Is it possible to convert RAID5 to RAID0?
>
It should be, yes. I'd use "mdadm --grow --level=0" rather than direct
interaction with sysfs though. You may need to add "--force" in order to
get a 1-disk RAID0 array though (it's mentioned as being required for
create anyway).
> There are no data on the disk. Is there a way to start over?
>
Sure. Just stop the arrays (mdadm -S /dev/md0) and then run a new create
command. You'll be prompted about an existing array (and filesystem, if
you'd created that) but can continue to overwrite with the new settings.
Cheers,
Robin
--
___
( ' } | Robin Hill <robin@robinhill.me.uk> |
/ / ) | Little Jim says .... |
// !! | "He fallen in de water !!" |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Converting RAID5 to RAID0
2014-08-31 12:43 Converting RAID5 to RAID0 Mike Muratet
2014-08-31 17:13 ` Robin Hill
@ 2014-08-31 22:31 ` NeilBrown
2014-09-10 16:15 ` Add disks and convert level 0 to level 5 Michael Muratet
1 sibling, 1 reply; 9+ messages in thread
From: NeilBrown @ 2014-08-31 22:31 UTC (permalink / raw)
To: Mike Muratet; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]
On Sun, 31 Aug 2014 12:43:26 +0000 (UTC) Mike Muratet <muratetm@gmail.com>
wrote:
> I am doing some experiments with mdadm to combine two 1TB disks into a RAID
> array. I used fdisk to create the partitions and mdadm to create a two disk
> RAID5 array. I would like to have more space and I can live without
> redundancy. I searched the man pages and boards for a way to do that and found:
>
> $ sudo mdadm /dev/md0 -f /dev/sdd
> mdadm: set /dev/sdd faulty in /dev/md0
> $ sudo mdadm /dev/md0 -r /dev/sdd
> mdadm: hot removed /dev/sdd from /dev/md0
> $ sudo echo raid0 > /sys/block/md0/md/level
>
> -bash: /sys/block/md0/md/level: Permission denied
>
> which was not the result I expected.
>
> Is it possible to convert RAID5 to RAID0?
Presumably you mean to convert a 2-device RAID5 to q 2-device RAID0, thus
doubling the amount of space.
mdadm /dev/md0 --grow --level=0 --raid-disks=2
will tell you that you need a backup file, so
mdadm /dev/md0 --grow --level=0 --raid-disks=2 --backup-file=/root/backup
will work... but will leave you with a degraded RAID4. So just run that same
command again to finish the job.
NeilBrown
>
> There are no data on the disk. Is there a way to start over?
>
> Cheers
>
> Mike
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Add disks and convert level 0 to level 5
2014-08-31 22:31 ` NeilBrown
@ 2014-09-10 16:15 ` Michael Muratet
2014-09-11 0:27 ` NeilBrown
2014-09-11 7:27 ` Robin Hill
0 siblings, 2 replies; 9+ messages in thread
From: Michael Muratet @ 2014-09-10 16:15 UTC (permalink / raw)
To: linux-raid
I have a two-disk RAID0 system that is working splendidly, thanks to the list for the help.
I managed to get my hands on more identical disks and since I have the disks and because I'm adding precious data, I'd like to add two more disks and grow to RAID5.
I have partitioned the two new drives to type 'fd', /dev/sde and /dev/sdf
I believe the command to accomplish the change is this:
mdadm /dev/md0 --grow --level=5 --add /dev/sde /dev/sdf
Following the old adage "measure twice, cut once", is this syntax correct? Is there any danger of data loss in such a conversion?
Thanks
Mike
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Add disks and convert level 0 to level 5
2014-09-10 16:15 ` Add disks and convert level 0 to level 5 Michael Muratet
@ 2014-09-11 0:27 ` NeilBrown
2014-09-17 14:59 ` Michael Muratet
2014-09-11 7:27 ` Robin Hill
1 sibling, 1 reply; 9+ messages in thread
From: NeilBrown @ 2014-09-11 0:27 UTC (permalink / raw)
To: Michael Muratet; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]
On Wed, 10 Sep 2014 11:15:24 -0500 Michael Muratet <muratetm@gmail.com> wrote:
> I have a two-disk RAID0 system that is working splendidly, thanks to the list for the help.
>
> I managed to get my hands on more identical disks and since I have the disks and because I'm adding precious data, I'd like to add two more disks and grow to RAID5.
>
> I have partitioned the two new drives to type 'fd', /dev/sde and /dev/sdf
>
> I believe the command to accomplish the change is this:
>
> mdadm /dev/md0 --grow --level=5 --add /dev/sde /dev/sdf
>
> Following the old adage "measure twice, cut once", is this syntax correct? Is there any danger of data loss in such a conversion?
I recommend creating a few loop-back devices and experimenting.
i.e.:
create some 100M files.
use "losetup" to turn them into block devices.
create an 2-device raid0
try converting it as you suggest.
You find it doesn't do quite what you expected, but should be easy to fix.
Providing your new devices are reliable (as least read/write the entire drive
once if you feel at all cautious) there is no particular danger of data loss.
NeilBrown
>
> Thanks
>
> Mike--
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Add disks and convert level 0 to level 5
2014-09-10 16:15 ` Add disks and convert level 0 to level 5 Michael Muratet
2014-09-11 0:27 ` NeilBrown
@ 2014-09-11 7:27 ` Robin Hill
1 sibling, 0 replies; 9+ messages in thread
From: Robin Hill @ 2014-09-11 7:27 UTC (permalink / raw)
To: Michael Muratet; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 945 bytes --]
On Wed Sep 10, 2014 at 11:15:24AM -0500, Michael Muratet wrote:
> I have a two-disk RAID0 system that is working splendidly, thanks to
> the list for the help.
>
> I managed to get my hands on more identical disks and since I have the
> disks and because I'm adding precious data, I'd like to add two more
> disks and grow to RAID5.
>
> I have partitioned the two new drives to type 'fd', /dev/sde and /dev/sdf
>
> I believe the command to accomplish the change is this:
>
> mdadm /dev/md0 --grow --level=5 --add /dev/sde /dev/sdf
>
If you've partitioned the drives then presumably you'd want to use the
partitions here (/dev/sde1 and /dev/sdf1?) rather than the full drives.
Cheers,
Robin
--
___
( ' } | Robin Hill <robin@robinhill.me.uk> |
/ / ) | Little Jim says .... |
// !! | "He fallen in de water !!" |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Add disks and convert level 0 to level 5
2014-09-11 0:27 ` NeilBrown
@ 2014-09-17 14:59 ` Michael Muratet
2014-09-17 15:15 ` Robin Hill
0 siblings, 1 reply; 9+ messages in thread
From: Michael Muratet @ 2014-09-17 14:59 UTC (permalink / raw)
To: NeilBrown; +Cc: linux-raid
On Sep 10, 2014, at 7:27 PM, NeilBrown wrote:
> On Wed, 10 Sep 2014 11:15:24 -0500 Michael Muratet <muratetm@gmail.com> wrote:
>
>> I have a two-disk RAID0 system that is working splendidly, thanks to the list for the help.
>>
>> I managed to get my hands on more identical disks and since I have the disks and because I'm adding precious data, I'd like to add two more disks and grow to RAID5.
>>
>> I have partitioned the two new drives to type 'fd', /dev/sde and /dev/sdf
>>
>> I believe the command to accomplish the change is this:
>>
>> mdadm /dev/md0 --grow --level=5 --add /dev/sde /dev/sdf
>>
>> Following the old adage "measure twice, cut once", is this syntax correct? Is there any danger of data loss in such a conversion?
>
> I recommend creating a few loop-back devices and experimenting.
> i.e.:
> create some 100M files.
> use "losetup" to turn them into block devices.
> create an 2-device raid0
> try converting it as you suggest.
>
> You find it doesn't do quite what you expected, but should be easy to fix.
In case anyone wants to do a similar thing...
As predicted, it did not do as I expected. I have another identical server and disks and so I did the experiment there.
980 sudo fdisk /dev/sdc
981 sudo fdisk /dev/sdd
982 sudo fdisk /dev/sde
983 sudo fdisk /dev/sdf
988 sudo partprobe /dev/sdc
989 sudo partprobe /dev/sdd
990 sudo partprobe /dev/sde
991 sudo partprobe /dev/sdf
995 sudo mdadm --create /dev/md0 --level=0 --raid-disk=2 /dev/sdc1 /dev/sdd1
996 sudo mkfs -t ext3 /dev/md0
997 sudo mount -t ext3 /dev/md0 /db
Same RAID0 system I created before. Now to grow
1004 sudo mdadm /dev/md0 --grow --level=5 --add /dev/sde1 /dev/sdf1
Makes a RAID5 system, but sde1 was added as a spare
1022 sudo mdadm --grow /dev/md0 --raid-devices=4
It's now a four disk RAID, but smaller than expected. It spread the original space over four drives, which I think is the documented behavior.
1040 sudo umount /dev/md0
1045 sudo e2fsck -f /dev/md0
1046 sudo resize2fs -p /dev/md0
1048 sudo mount -t ext3 /dev/md0 /db
1049 df -h
/dev/md0 2.7T 202M 2.6T 1% /db
which is what I wanted. I can't take my original system offline now, but when I can I will apply the same steps.
Thanks for the help
Cheers
Mike
>
> Providing your new devices are reliable (as least read/write the entire drive
> once if you feel at all cautious) there is no particular danger of data loss.
>
> NeilBrown
>
>
>>
>> Thanks
>>
>> Mike--
>> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Add disks and convert level 0 to level 5
2014-09-17 14:59 ` Michael Muratet
@ 2014-09-17 15:15 ` Robin Hill
0 siblings, 0 replies; 9+ messages in thread
From: Robin Hill @ 2014-09-17 15:15 UTC (permalink / raw)
To: Michael Muratet; +Cc: NeilBrown, linux-raid
[-- Attachment #1: Type: text/plain, Size: 3360 bytes --]
On Wed Sep 17, 2014 at 09:59:00am -0500, Michael Muratet wrote:
>
> On Sep 10, 2014, at 7:27 PM, NeilBrown wrote:
>
> > On Wed, 10 Sep 2014 11:15:24 -0500 Michael Muratet <muratetm@gmail.com> wrote:
> >
> >> I have a two-disk RAID0 system that is working splendidly, thanks
> >> to the list for the help.
> >>
> >> I managed to get my hands on more identical disks and since I have
> >> the disks and because I'm adding precious data, I'd like to add two
> >> more disks and grow to RAID5.
> >>
> >> I have partitioned the two new drives to type 'fd', /dev/sde and /dev/sdf
> >>
> >> I believe the command to accomplish the change is this:
> >>
> >> mdadm /dev/md0 --grow --level=5 --add /dev/sde /dev/sdf
> >>
> >> Following the old adage "measure twice, cut once", is this syntax
> >> correct? Is there any danger of data loss in such a conversion?
> >
> > I recommend creating a few loop-back devices and experimenting.
> > i.e.:
> > create some 100M files.
> > use "losetup" to turn them into block devices.
> > create an 2-device raid0
> > try converting it as you suggest.
> >
> > You find it doesn't do quite what you expected, but should be easy to fix.
>
> In case anyone wants to do a similar thing...
>
> As predicted, it did not do as I expected. I have another identical
> server and disks and so I did the experiment there.
>
> 980 sudo fdisk /dev/sdc
> 981 sudo fdisk /dev/sdd
> 982 sudo fdisk /dev/sde
> 983 sudo fdisk /dev/sdf
> 988 sudo partprobe /dev/sdc
> 989 sudo partprobe /dev/sdd
> 990 sudo partprobe /dev/sde
> 991 sudo partprobe /dev/sdf
> 995 sudo mdadm --create /dev/md0 --level=0 --raid-disk=2 /dev/sdc1 /dev/sdd1
> 996 sudo mkfs -t ext3 /dev/md0
> 997 sudo mount -t ext3 /dev/md0 /db
>
> Same RAID0 system I created before. Now to grow
>
> 1004 sudo mdadm /dev/md0 --grow --level=5 --add /dev/sde1 /dev/sdf1
>
> Makes a RAID5 system, but sde1 was added as a spare
>
> 1022 sudo mdadm --grow /dev/md0 --raid-devices=4
>
You should be able to combine the above into a single command (it worked
for me on loopback devices anyway):
sudo mdadm --grow /dev/md0 --level=5 --raid-devices=4 \
--add /dev/sde1 /dev/sdf1
> It's now a four disk RAID, but smaller than expected. It spread the
> original space over four drives, which I think is the documented
> behavior.
>
As md has no knowledge of the filesystem or how to change the size of
it, then all it can do it redistribute the original data over the
additional disks. The md device size should have increased though, even
if the filesystem size hadn't.
> 1040 sudo umount /dev/md0
> 1045 sudo e2fsck -f /dev/md0
> 1046 sudo resize2fs -p /dev/md0
> 1048 sudo mount -t ext3 /dev/md0 /db
> 1049 df -h
>
> /dev/md0 2.7T 202M 2.6T 1% /db
>
> which is what I wanted. I can't take my original system offline now,
> but when I can I will apply the same steps.
>
You shouldn't need to take it offline - resize2fs works perfectly well
online.
Cheers,
Robin
--
___
( ' } | Robin Hill <robin@robinhill.me.uk> |
/ / ) | Little Jim says .... |
// !! | "He fallen in de water !!" |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Converting RAID5 to RAID0
@ 2014-09-01 14:10 Michael Muratet
0 siblings, 0 replies; 9+ messages in thread
From: Michael Muratet @ 2014-09-01 14:10 UTC (permalink / raw)
To: linux-raid
Thanks Neil and Robin
I was able to get what I wanted.
Cheers
Mike
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-17 15:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-31 12:43 Converting RAID5 to RAID0 Mike Muratet
2014-08-31 17:13 ` Robin Hill
2014-08-31 22:31 ` NeilBrown
2014-09-10 16:15 ` Add disks and convert level 0 to level 5 Michael Muratet
2014-09-11 0:27 ` NeilBrown
2014-09-17 14:59 ` Michael Muratet
2014-09-17 15:15 ` Robin Hill
2014-09-11 7:27 ` Robin Hill
2014-09-01 14:10 Converting RAID5 to RAID0 Michael Muratet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.