New machine, new RAID, wrong device name...

New machine, new RAID, wrong device name...

am 21.02.2011 20:59:06 von Mark Knecht

I've got a new laptop that has two hard drives in it and I've chosen
to use RAID1 on it. The Gentoo install is complete but when I reboot
the kernel doesn't find the RAID and I hang without syncing.

During the Gentoo install from a CD the machine is called (apparently)
"livecd". To build the RAID initially I wanted it to be /dev/md3 so I
used

livecd ~ # mknod /dev/md3 b 9 3
livecd ~ # mdadm --create /dev/md3 --level=1 --raid-devices=2
/dev/sda3 /dev/sdb3
livecd ~ # mke2fs -j /dev/md3

and everything went fine.

However once I've rebooted using the CD, and even though the machine
is once again called livecd the RAID is now called /dev/md127. I
assume, but don't know for sure, that something similar is happening
when I boot the actual installation, mdadm gives the RAID a different
name and it's likely not found by my new environment.

What's the right solution to changing the RAID naming in the
superblock so that the laptop finds it as local to 'laptop1' and
mounts it according the fstab?

I understand that I can probably put the UUID in the mdadm config
file, and I will, but before I do I wanted to cross this threshold and
figure out the right way to do it automatically.

Thanks,
Mark


livecd ~ # mdadm --detail /dev/md127
/dev/md127:
Version : 1.2
Creation Time : Wed Feb 16 16:03:29 2011
Raid Level : raid1
Array Size : 343758245 (327.83 GiB 352.01 GB)
Used Dev Size : 343758245 (327.83 GiB 352.01 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Thu Feb 17 19:42:36 2011
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

Name : livecd:3 (local to host livecd)
UUID : f75493a8:1189516e:0f192f04:e21fbe28
Events : 17

Number Major Minor RaidDevice State
0 8 3 0 active sync /dev/sda3
1 8 19 1 active sync /dev/sdb3
livecd ~ # mdadm --examine /dev/sda3
/dev/sda3:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : f75493a8:1189516e:0f192f04:e21fbe28
Name : livecd:3 (local to host livecd)
Creation Time : Wed Feb 16 16:03:29 2011
Raid Level : raid1
Raid Devices : 2

Avail Dev Size : 687516763 (327.83 GiB 352.01 GB)
Array Size : 687516490 (327.83 GiB 352.01 GB)
Used Dev Size : 687516490 (327.83 GiB 352.01 GB)
Data Offset : 2048 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 4430631f:454150f1:903a86cc:9d2c034c

Update Time : Thu Feb 17 19:42:36 2011
Checksum : 9adbdc7f - correct
Events : 17


Device Role : Active device 0
Array State : AA ('A' == active, '.' == missing)
livecd ~ #
--
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

Re: New machine, new RAID, wrong device name...

am 21.02.2011 22:23:12 von NeilBrown

On Mon, 21 Feb 2011 11:59:06 -0800 Mark Knecht wrote:

> I've got a new laptop that has two hard drives in it and I've chosen
> to use RAID1 on it. The Gentoo install is complete but when I reboot
> the kernel doesn't find the RAID and I hang without syncing.
>
> During the Gentoo install from a CD the machine is called (apparently)
> "livecd". To build the RAID initially I wanted it to be /dev/md3 so I
> used
>
> livecd ~ # mknod /dev/md3 b 9 3
> livecd ~ # mdadm --create /dev/md3 --level=1 --raid-devices=2
> /dev/sda3 /dev/sdb3
> livecd ~ # mke2fs -j /dev/md3
>
> and everything went fine.
>
> However once I've rebooted using the CD, and even though the machine
> is once again called livecd the RAID is now called /dev/md127. I
> assume, but don't know for sure, that something similar is happening
> when I boot the actual installation, mdadm gives the RAID a different
> name and it's likely not found by my new environment.

If it is being assembled as md127 even though the host name is livecd, the
implication is that the hostname is not set un after the array is assembled.
Maybe they are done in the initrd in the wrong order?
If you
mdadm -S /dev/md127
mdadm -As
from the livecd, does it then assemble as /dev/md3?

>
> What's the right solution to changing the RAID naming in the
> superblock so that the laptop finds it as local to 'laptop1' and
> mounts it according the fstab?

I think you are asking how to change the name recorded in the metadata.
When booted into the livecd:
mdadm -S /dev/md127
mdadm -A /dev/md3 --update=homehost --homehost=laptop1 /dev/sd[ab]3

should do it.

NeilBrown


>
> I understand that I can probably put the UUID in the mdadm config
> file, and I will, but before I do I wanted to cross this threshold and
> figure out the right way to do it automatically.
>
> Thanks,
> Mark
>
>
> livecd ~ # mdadm --detail /dev/md127
> /dev/md127:
> Version : 1.2
> Creation Time : Wed Feb 16 16:03:29 2011
> Raid Level : raid1
> Array Size : 343758245 (327.83 GiB 352.01 GB)
> Used Dev Size : 343758245 (327.83 GiB 352.01 GB)
> Raid Devices : 2
> Total Devices : 2
> Persistence : Superblock is persistent
>
> Update Time : Thu Feb 17 19:42:36 2011
> State : clean
> Active Devices : 2
> Working Devices : 2
> Failed Devices : 0
> Spare Devices : 0
>
> Name : livecd:3 (local to host livecd)
> UUID : f75493a8:1189516e:0f192f04:e21fbe28
> Events : 17
>
> Number Major Minor RaidDevice State
> 0 8 3 0 active sync /dev/sda3
> 1 8 19 1 active sync /dev/sdb3
> livecd ~ # mdadm --examine /dev/sda3
> /dev/sda3:
> Magic : a92b4efc
> Version : 1.2
> Feature Map : 0x0
> Array UUID : f75493a8:1189516e:0f192f04:e21fbe28
> Name : livecd:3 (local to host livecd)
> Creation Time : Wed Feb 16 16:03:29 2011
> Raid Level : raid1
> Raid Devices : 2
>
> Avail Dev Size : 687516763 (327.83 GiB 352.01 GB)
> Array Size : 687516490 (327.83 GiB 352.01 GB)
> Used Dev Size : 687516490 (327.83 GiB 352.01 GB)
> Data Offset : 2048 sectors
> Super Offset : 8 sectors
> State : clean
> Device UUID : 4430631f:454150f1:903a86cc:9d2c034c
>
> Update Time : Thu Feb 17 19:42:36 2011
> Checksum : 9adbdc7f - correct
> Events : 17
>
>
> Device Role : Active device 0
> Array State : AA ('A' == active, '.' == missing)
> livecd ~ #
> --
> 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

--
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

Re: New machine, new RAID, wrong device name...

am 21.02.2011 23:14:45 von Mark Knecht

On Mon, Feb 21, 2011 at 1:23 PM, NeilBrown wrote:

>>
>> However once I've rebooted using the CD, and even though the machine
>> is once again called livecd the RAID is now called /dev/md127. I
>> assume, but don't know for sure, that something similar is happening
>> when I boot the actual installation, mdadm gives the RAID a differen=
t
>> name and it's likely not found by my new environment.
>
> If it is being assembled as md127 even though the host name is livecd=
, the
> implication is that the hostname is not set un after the array is ass=
embled.
> Maybe they are done in the initrd in the wrong order?
> If you
>   mdadm -S /dev/md127
>   mdadm -As
> from the livecd, does it then assemble as /dev/md3?
>

It does.

>>
>> What's the right solution to changing the RAID naming in the
>> superblock so that the laptop finds it as local to 'laptop1' and
>> mounts it according the fstab?
>
> I think you are asking how to change the name recorded in the metadat=
a.
> When booted into the livecd:
>   mdadm -S /dev/md127
>   mdadm -A /dev/md3 --update=3Dhomehost --homehost=3Dlaptop1 /de=
v/sd[ab]3
>
> should do it.
>
> NeilBrown

Thanks Neil. That looks good.

I'll now work on making sure I can actually boot the machine and sync
into Linux correctly.

I appreciate the help.

Cheers,
Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" i=
n
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html