Skip to contentSkip to conversation

Swap on /dev/md1 always lost after reboot

DISCUSSION Joachim Otahal 3 participants 5 messages Mar 29, 2010 – Apr 14, 2010 MD RAID

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 3 lines · Joachim Otahal

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

#2 lore raw
Quoted 17 lines · Joachim Otahal
Quoted 4 lines · Joachim Otahal

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]

Quoted 9 lines

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 [email protected]
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 23 lines · Michael Evans
Quoted 21 lines · Joachim Otahal
Quoted 4 lines · Joachim Otahal

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

Quoted 10 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
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

#4 lore raw
Quoted 31 lines · Joachim Otahal
Quoted 30 lines · Michael Evans
Quoted 28 lines · Joachim Otahal
Quoted 4 lines · Joachim Otahal

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

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Quoted 7 lines
Quoted 4 lines

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.

Signature · 3 lines
Bill Davidsen <[email protected]>
 "We can't solve today's problems by using the same thinking we
  used in creating them." - Einstein