You are not logged in.

#1 2015-02-25 21:24:18

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

[Solved] Moving a RAID-0 based installation

I started out installing my root partition on a RAID-0 array with two drives.
The two drives are 180 and 120 GB respectively and I have a 100GB+100GB array setup


Now I added yet another 2 drives to my laptop with the DVD-ROM caddy adapter and an m-Sata card.
I would like to migrate my installation so I can have a 4 way array.

How can I migrate?

I believe the following is the right way:

Make an empty partition, copy everything in / to that and boot into that install by specifying the root= option in grub
Then remake the RAID array and copy everything back

Will this work?

Thanks in advance

Last edited by rep_movsd (2015-02-26 19:19:17)

Offline

#2 2015-02-25 21:33:56

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [Solved] Moving a RAID-0 based installation

So you want to have RAID0 with 4 disks? Wouldn't something like https://wiki.archlinux.org/index.php/RA … ID0_Arrays work?

Offline

#3 2015-02-26 06:59:28

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

WOW I had no idea RAID 0 could grow!

Will it restripe the existing data across the newly added drives?

Last edited by rep_movsd (2015-02-26 06:59:40)

Offline

#4 2015-02-26 07:44:46

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

Seems like this wont work:

https://bugs.archlinux.org/task/27507

Offline

#5 2015-02-26 08:57:52

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [Solved] Moving a RAID-0 based installation

Have you actually tried it? That bug report is old.

It should restripe data.

In case it isn't clear, you should probably use "mdadm --grow /dev/md0 --raid-devices=4 --add /dev/sdc1 /dev/sdd1".

Offline

#6 2015-02-26 09:09:15

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

I made a test array with two small partitions, copied some data onto it and tried the following:

rep ~ $ cat /proc/mdstat
Personalities : [raid0] [raid6] [raid5] [raid4]
md2 : active raid0 sdc3[1] sda4[0]
    33718272 blocks super 1.2 64k chunks

md0 : active raid0 sda1[0] sdc1[1]
    203776 blocks super 1.2 512k chunks

md1 : active raid0 sda2[0] sdc2[1]
    200055296 blocks super 1.2 512k chunks

unused devices: <none>
rep ~ $ sudo mdadm --grow /dev/md2 --level=0 --raid-devices=3 --add /dev/sdd1
mdadm: /dev/md2: could not set level to raid4
rep ~ $

What now?


FYI it is not mounted either

Last edited by rep_movsd (2015-02-26 09:17:03)

Offline

#7 2015-02-26 09:20:19

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [Solved] Moving a RAID-0 based installation

What if you remove "--level=0"?

Offline

#8 2015-02-26 09:58:31

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

rep ~ $ sudo mdadm --grow /dev/md2  --raid-devices=3 --add /dev/sdd1
mdadm: /dev/md2: could not set level to raid4

This happens

dmesg shows :

[10231.922029] md/raid:md2: cannot takeover raid0 with more than one zone.
[10231.922038] md: md2: raid4 would not accept array
[10231.923433]  md2: p1

Last edited by rep_movsd (2015-02-26 10:03:02)

Offline

#9 2015-02-26 10:11:24

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [Solved] Moving a RAID-0 based installation

Are the partitions in md2 the same size? http://forums.gentoo.org/viewtopic-p-71 … ml#7158464

Offline

#10 2015-02-26 10:25:54

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

Let me retry making the test once more from scratch

Offline

#11 2015-02-26 11:34:46

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

Thanks!

Remaking the partitions to the exact same size worked!
Now I shall make a backup of my / filesystem and try adding to it

Offline

#12 2015-02-26 12:32:37

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: [Solved] Moving a RAID-0 based installation

4 drive raid0? You do have backups, right? smile

Offline

#13 2015-02-26 13:26:36

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

I'm using SSDs from Intel, Crucial and Samsung

I've never experienced sudden failure on my  SSDs without SMART warnings since I started using them in 2009. My 40 GB Intel from then is still working great on a desktop system (FWIW a WD Raptor from 2006 is still working perfectly, no SMART warnings, it's booted almost daily since then and was my primary system for a few years - must be some sort of record!)

All my personal data is backed up, work stuff is on assembla, so I can take the risk!

The main advantage of this striping comes when you work with multiple VMs - Suspending and resuming them is super fast with RAID0

Offline

#14 2015-02-26 15:08:25

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

Further progress and further stumbling block

So I started by making a full rsync backup of the / partition and booted into that successfully
After that I discovered that the initial two raid0 partitions differed in size, so I deleted and recreated that array, now with three partitions.
I updated /etc/mdadm.conf and ran mkinitcpio to create a fresh initrd
Now rsynced the backup onto the new raid0 array

Tried to reboot, but grub couldnt find it's theme files etc and gave me a text menu. The backup partition still boots
Edited the grub config, it had the old GUID in the "search" statements
I changed that GUID to the new one from /etc/mdadm.conf
Again rsynced the changes to the new root

Rebooted again...

Now GRUB still fails to find the theme files
When I select the old entry, the kernel loads, it gets as far as "Started /dev/md1  etc etc"
After that it says "fsck.e2 failed for /dev/md1, Error 2 : not found" or something to that effect and gives me a root shell, but for some reason the tty doesnt work and I cant type anything.

Note that my /boot partition is /dev/md0

Whats to be done next?

Offline

#15 2015-02-26 15:19:57

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

I have a feeling I messed up something :

rep ~ $ lsblk -f
NAME        FSTYPE            LABEL     UUID                                 MOUNTPOINT
sda
|-sda1      linux_raid_member archiso:0 514bcc23-3a29-8779-235e-390743d2e5e9
| `-md0     ext4                        b2b35d72-71b7-4558-beb0-eceacc59294f /boot
|-sda2      linux_raid_member archaic:1 238d7fab-995b-c7b8-6fd9-b884dd5974e8
| `-md1
|   `-md1p1 ext4              raid_root e2f763af-0c17-40af-bcd8-6be6bfed00da /mnt/new_raid
|-sda3      ext4                        c84f122a-c7ca-4716-a9cb-19b7e34fb819
`-sda4      ext4              backup    dd0a5e00-c231-411d-ba8b-27006d40c8fc /
sdb
`-sdb1      ext4              data      b7c6a22b-8734-48d6-bb31-35367ac5b7b9 /mnt/500g
sdc
|-sdc1      linux_raid_member archiso:0 514bcc23-3a29-8779-235e-390743d2e5e9
| `-md0     ext4                        b2b35d72-71b7-4558-beb0-eceacc59294f /boot
`-sdc2      linux_raid_member archaic:1 238d7fab-995b-c7b8-6fd9-b884dd5974e8
  `-md1
    `-md1p1 ext4              raid_root e2f763af-0c17-40af-bcd8-6be6bfed00da /mnt/new_raid
sdd
|-sdd1      ntfs                        30F93E06015AD5DF                     /mnt/test
`-sdd2      linux_raid_member archaic:1 238d7fab-995b-c7b8-6fd9-b884dd5974e8
  `-md1
    `-md1p1 ext4              raid_root e2f763af-0c17-40af-bcd8-6be6bfed00da /mnt/new_raid
rep ~ $

In this new configuration, the filesystem is on /dev/md1p1 instead of md1 directly
Earlier I am sure it was directly on /dev/md1

I used gparted to do that - perhaps I should have run mkfs directly on /dev/md1 rather than let gparted make another partition table within it

Offline

#16 2015-02-26 16:45:53

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

I redid the operation using mkfs and updated grub

Now it works great!

Read speed up from ~400 MB/s to 600 MB/s

Offline

#17 2015-02-26 18:39:11

rep_movsd
Member
Registered: 2013-08-24
Posts: 127

Re: [Solved] Moving a RAID-0 based installation

How do you mark a topic solved? I'm sure there used to be an option somewhere, cant find it though!
[Solved]

Offline

#18 2015-02-26 18:55:21

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [Solved] Moving a RAID-0 based installation

Edit the first post.

Offline

Board footer

Powered by FluxBB