Swap on /dev/md1 always lost after reboot

Swap on /dev/md1 always lost after reboot

am 29.03.2010 04:21:51 von Joachim Otahal

Machine is:
Debian Lenny, Linux version 2.6.26-2-686 (Debian 2.6.26-21lenny4)
mdadm - v2.6.7.2 - 14th November 2008
2 HD's
/dev/md1 = /, /dev/sda1 /dev/sdb1
/dev/md0 = /home/data, /dev/sda3 /dev/sdb3

They are numbered that way for "historical" reasons, I created /dev/md0
as data partition first and converted root/boot to RAID1 later.

The problem is:
/dev/md2 = swap, /dev/sda2, /dev/sdb2

I set up md2 (/dev/md2 is already in fstab as swap, the partition type
is fd on both drives):
mdadm --zero-superblock /dev/sda2
mdadm --zero-superblock /dev/sdb2
mdadm -C /dev/md2 -l 1 -n 2 /dev/sdb2 /dev/sda2
mkswap /dev/md2
swapon -a
free says: swap active, mdstat says:
md2 : active (auto-read-only) raid1 sda2[1] sdb2[0]
979840 blocks [2/2] [UU]
(no resync=PENDING or other funny stuff)
mdadm --examine --scan shows the md2, /etc/mdadm/mdadm.conf gets updated
by me.
reboot, and the free says: no swap.

cat /proc/mdstat says: no md2 !
mdadm --examine --scan shows md2, exactely as written in
/etc/mdadm/mdadm.conf

the longer output:
mdadm --examine /dev/sda2
/dev/sda2:
Magic : a92b4efc
Version : 00.90.00
UUID : d97bc68d:a6bd724d:b66f1fce:677f10ed (local to host
nearyou)
Creation Time : Mon Mar 29 03:43:06 2010
Raid Level : raid1
Used Dev Size : 979840 (957.04 MiB 1003.36 MB)
Array Size : 979840 (957.04 MiB 1003.36 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Update Time : Mon Mar 29 03:45:06 2010
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : dec1b89a - correct
Events : 8
Number Major Minor RaidDevice State
this 1 8 2 1 active sync /dev/sda2
0 0 8 18 0 active sync /dev/sdb2
1 1 8 2 1 active sync /dev/sda2

mdadm --examine /dev/sda2
/dev/sda2:
Magic : a92b4efc
Version : 00.90.00
UUID : d97bc68d:a6bd724d:b66f1fce:677f10ed (local to host
nearyou)
Creation Time : Mon Mar 29 03:43:06 2010
Raid Level : raid1
Used Dev Size : 979840 (957.04 MiB 1003.36 MB)
Array Size : 979840 (957.04 MiB 1003.36 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Update Time : Mon Mar 29 03:45:06 2010
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : dec1b89a - correct
Events : 8
Number Major Minor RaidDevice State
this 1 8 2 1 active sync /dev/sda2
0 0 8 18 0 active sync /dev/sdb2
1 1 8 2 1 active sync /dev/sda2

So the raid is there, it is on the HD, it is consistent and clean, it
says it's preferred minor is 2 = md2.
It is simply not autodetected at boot time, or not activated, I tried
that quite a few times now. I can recreate the raid with -C -f and issue
a --rebuild, swapon -a, everything fine. The other RAID1's on the drives
work as expected.

What is the trap I am running in here? I have other machines with
/dev/md1 as swap without such problems. It there some kind of kernel
option how high autodetect should count in md "Preferred Minor" devices?

kind regards,

Joachim Otahal

--
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: Swap on /dev/md1 always lost after reboot

am 29.03.2010 04:32:56 von Joachim Otahal

Joachim Otahal schrieb:
> free says: swap active, mdstat says:
> md2 : active (auto-read-only) raid1 sda2[1] sdb2[0]
> 979840 blocks [2/2] [UU]
minor correction: the output right after creating the raid + issuing a
mkswap is
md2 : active raid1 sda2[1] sdb2[0]
979840 blocks [2/2] [UU]
[=======>.............] resync = 37.9% (372480/979840)
finish=0.1min speed=93120K/sec

and a few second later:
md2 : active raid1 sda2[1] sdb2[0]
979840 blocks [2/2] [UU]

mdadm.conf updated, but md2 still not there after reboot.

Joachim

--
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: Swap on /dev/md1 always lost after reboot

am 29.03.2010 08:33:53 von Michael Evans

On Sun, Mar 28, 2010 at 7:32 PM, Joachim Otahal wrote:
> Joachim Otahal schrieb:
>>
>> free says: swap active, mdstat says:
>> md2 : active (auto-read-only) raid1 sda2[1] sdb2[0]
>> =A0 =A0 =A0979840 blocks [2/2] [UU]
>
> minor correction: the output right after creating the raid + issuing =
a
> mkswap is
> md2 : active raid1 sda2[1] sdb2[0]
> =A0 =A0 =A0979840 blocks [2/2] [UU]
> =A0 =A0 =A0[=======3D>.............] =A0resync =3D 37.9% =
(372480/979840) finish=3D0.1min
> speed=3D93120K/sec
>
> and a few second later:
> md2 : active raid1 sda2[1] sdb2[0]
> =A0 =A0 =A0979840 blocks [2/2] [UU]
>
> mdadm.conf updated, but md2 still not there after reboot.
>
> Joachim
>
> --
> 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 =A0http://vger.kernel.org/majordomo-info.html
>

Trigger the regeneration of your initrd/initramfs image. It's
probably got an mdadm.conf that lacks your second device.
--
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

Re: Swap on /dev/md1 always lost after reboot

am 29.03.2010 19:32:29 von Joachim Otahal

Michael Evans schrieb:
> On Sun, Mar 28, 2010 at 7:32 PM, Joachim Otahal wrote:
>
>> Joachim Otahal schrieb:
>>
>>> free says: swap active, mdstat says:
>>> md2 : active (auto-read-only) raid1 sda2[1] sdb2[0]
>>> 979840 blocks [2/2] [UU]
>>>
>> minor correction: the output right after creating the raid + issuing a
>> mkswap is
>> md2 : active raid1 sda2[1] sdb2[0]
>> 979840 blocks [2/2] [UU]
>> [=======>.............] resync = 37.9% (372480/979840) finish=0.1min
>> speed=93120K/sec
>>
>> and a few second later:
>> md2 : active raid1 sda2[1] sdb2[0]
>> 979840 blocks [2/2] [UU]
>>
>> mdadm.conf updated, but md2 still not there after reboot.
>>
>> Joachim
>>
>> --
>> 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
>>
>>
> Trigger the regeneration of your initrd/initramfs image. It's
> probably got an mdadm.conf that lacks your second device.
>
>
Strike, thank you.

Joachim Otahal
--
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: Swap on /dev/md1 always lost after reboot

am 14.04.2010 22:13:47 von Bill Davidsen

Joachim Otahal wrote:
> Michael Evans schrieb:
>> On Sun, Mar 28, 2010 at 7:32 PM, Joachim Otahal wrote:
>>
>>> Joachim Otahal schrieb:
>>>
>>>> free says: swap active, mdstat says:
>>>> md2 : active (auto-read-only) raid1 sda2[1] sdb2[0]
>>>> 979840 blocks [2/2] [UU]
>>>>
>>> minor correction: the output right after creating the raid + issuing a
>>> mkswap is
>>> md2 : active raid1 sda2[1] sdb2[0]
>>> 979840 blocks [2/2] [UU]
>>> [=======>.............] resync = 37.9% (372480/979840)
>>> finish=0.1min
>>> speed=93120K/sec
>>>
>>> and a few second later:
>>> md2 : active raid1 sda2[1] sdb2[0]
>>> 979840 blocks [2/2] [UU]
>>>
>>> mdadm.conf updated, but md2 still not there after reboot.
>>>
>>> Joachim
>>>
>>> --
>>> 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
>>>
>>>
>> Trigger the regeneration of your initrd/initramfs image. It's
>> probably got an mdadm.conf that lacks your second device.
>>
>>
> Strike, thank you.
>
> Joachim Otahal

My thought was that you didn't change the partition type to
"raid-autostart" so the array got started by the kernel (0.90 meta
needed). I suspect that would have fixed it as well.

--
Bill Davidsen
"We can't solve today's problems by using the same thinking we
used in creating them." - Einstein

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