Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mdadm still claiming old RAID member drive on boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
octomancer
n00b
n00b


Joined: 29 Dec 2006
Posts: 6

PostPosted: Fri Jun 08, 2018 11:48 am    Post subject: mdadm still claiming old RAID member drive on boot Reply with quote

Hi,

Not sure this is the right place to ask this, apologies if not.

I had a software (mdadm) RAID5 composed of a bunch of 2TB drives in my Gentoo server. It was created a long time ago, the member disks' partition tables were MSDOS ones, a reasonable choice at the time. The partition type was set to "fd", the mdadm auto-assemble partition type. These partitions were created with fdisk. To replace this RAID5, I created a new RAID6 on 4TB drives. I had to use GPT partition tables on those due to the 4TB size. I used parted to create these partitions. Once I'd copied all the data over, I decided that I wanted to use one of the old 2TB drives as a general purpose data drive in the same server. Because I had been using parted, I used it to create a GPT partition on this old 2TB drive. Then I used mkfs.ext4 to create a filesystem. So far so good.

But now, when I boot my server, mdadm "claims" the old 2TB drive, as shown:

Code:
marv ~ # cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md126 : inactive sdb[4](S)
      1953514496 blocks

md127 : active raid6 sdg1[5] sdf1[4] sde1[6] sdc1[0] sdd1[1]
      11720656896 blocks super 1.2 level 6, 512k chunk, algorithm 2 [5/5] [UUUUU]
      bitmap: 0/30 pages [0KB], 65536KB chunk

unused devices: <none>


This prevents the filesystem on /dev/sdb1 getting mounted at boot time.

Nothing bad is happening, I can stop the bogus raid device with

Code:
mdadm -S /dev/md126


and then mount it. But I want this to happen automatically at boot time (it has a correct entry in fstab).

So my question is, what do I have to do to /dev/sdb or /dev/sdb1 to stop mdadm seeing it as a RAID member at boot? I don't know what the issue is, is it the presence of a RAID superblock, is mdadm still seeing the old partition type of "fd", or is it something completely different?

I suspect that I could probably achieve the effect I want by putting something like this in /etc/mdadm.conf

Code:
ARRAY <ignore> devices=/dev/sdb*


but I'd rather frob /dev/sdb or /dev/sdb1 so I don't need that

Any info greatly appreciated :-)

Cheers,
Rich
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Fri Jun 08, 2018 12:32 pm    Post subject: Reply with quote

Yes, if md detects a superblock on any disk on the system when autodetecting, it will assume that it needs to eventually assemble it and snap it up... I believe this happens regardless of the partition type, it still seems to check them all.

You should wipe the superblock with something like

# mdadm --zero-superblock /dev/sdb

if you don't want it ever showing up again. Backup before using this command unless you want to trash the contents of the drive anyway.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
octomancer
n00b
n00b


Joined: 29 Dec 2006
Posts: 6

PostPosted: Fri Jun 08, 2018 12:51 pm    Post subject: Reply with quote

Thanks for the quick reply.

At the moment, the RAID superblock and the ext4 filesystem are happily co-existing on that drive (/dev/sdb). Unless zeroing the superblock is going to write zeros somewhere other than the superblock, I can't see why it would trash the contents of the drive. I have a spare SATA port in the server, so I'll put another of the old 2TB drives back in it (and zero the superblock before doing anything else :-D and change the partition type to something other than fd with fdisk before creating the GPT partition) and backup the data to it before I try zeroing the superblock on /dev/sdb. But really, if it the ext4 filesystem is happy with a valid superblock there, it should be happy without one. Ooooh, I get do science! I will report back with the results. Hopefully I don't create a monster.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Fri Jun 08, 2018 12:58 pm    Post subject: Reply with quote

Well,... you were warned. It shouldn't cause trouble, but if it does, wouldn't it be nice if you had a backup?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54234
Location: 56N 3W

PostPosted: Fri Jun 08, 2018 6:51 pm    Post subject: Reply with quote

octomancer,

It sounds like you have a version 0.9 raid superblock on that drive.
Code:
madam -E /dev/...
will tell.
That puts the raid superblock at the end of the volume.

The raid superblock is now inside the new filesystem. Zeroing the superblock may or may not be harmless to the filesystem metadata.
A raid version 0.9 superblock has space for 28 volumes, so much of it won't be used. If mkfs.ext4 overwrote an unused part of the superblock, mdadm may not notice.
If zeroing the superblock inside the filesystem trashes filesystem metadata ... well, that's what backups are for.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
octomancer
n00b
n00b


Joined: 29 Dec 2006
Posts: 6

PostPosted: Fri Jun 15, 2018 1:38 pm    Post subject: Reply with quote

Hi

You're right Neddy.

Code:

# mdadm -E /dev/sdb
/dev/sdb:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 03a399e7:13b3a40d:8ff0046e:0760338e
  Creation Time : Fri Apr 30 23:14:40 2010
     Raid Level : raid5
  Used Dev Size : 1953134400 (1862.65 GiB 2000.01 GB)
     Array Size : 9765672000 (9313.27 GiB 10000.05 GB)
   Raid Devices : 6
  Total Devices : 5
Preferred Minor : 127
...


I didn't actually get around to doing anything with this, I did indeed find that

Code:
ARRAY <ignore> devices=/dev/sdb*


in mdadm.conf gets around the problem. I'll sort it out this weekend, replace the current drive with one with a properly zeroed superblock.

Cheers both

R
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum