From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D2AFB15802C for ; Fri, 20 Dec 2024 14:51:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BC5A7E0951; Fri, 20 Dec 2024 14:51:10 +0000 (UTC) Received: from turkos.aspodata.se (turkos.aspodata.se [185.140.117.226]) by pigeon.gentoo.org (Postfix) with ESMTP id DAE65E0946 for ; Fri, 20 Dec 2024 14:51:09 +0000 (UTC) Received: from turkos.aspodata.se (localhost.aspodata.se [127.0.0.1]) by turkos.aspodata.se (Postfix) with ESMTP id C0A4085A4352 for ; Fri, 20 Dec 2024 15:50:53 +0100 (CET) Received: by turkos.aspodata.se (Postfix, from userid 1000) id B361C85A435A; Fri, 20 Dec 2024 15:50:53 +0100 (CET) X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7+dev X-Exmh-Isig-CompType: repl X-Exmh-Isig-Folder: inbox From: karl@aspodata.se To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Fun with mdadm (Software RAID) In-reply-to: References: Comments: In-reply-to Alan Mackenzie message dated "Fri, 20 Dec 2024 10:47:41 +0000." Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply Mime-Version: 1.0 Content-Type: text/plain Message-Id: <20241220145053.B361C85A435A@turkos.aspodata.se> Date: Fri, 20 Dec 2024 15:50:53 +0100 (CET) X-Virus-Scanned: ClamAV using ClamSMTP X-Archives-Salt: 3cf0d9e5-e942-4272-9d64-196f73e50f68 X-Archives-Hash: 2b4c750a7c70184ba8c2cdfbc9e39df5 Alan Mackenzie: ... > The cause was me booting up the machine with a rescue disk. This > assembled my RAID partitions /dev/md127 and /dev/md126 reversed, but > also wrote those wrong identifiers, 126 and 127, into the "preferred > minor" field of the partitions' super blocks. In essence, they got > swapped. ... > Just for the record, all my RAID arrays have metadata version 0.90, the > (old fashioned) one that allows auto-assembly by the kernel without the > need of an initramfs. > > The moral of the story: if your system uses software RAID, be careful > indeed before you boot up with a rescue disk. So, why don't you simple add "root=902 md=2,/dev/sda2,/dev/sdb2" or similar to your boot loader kernel command line ? /// And... what is the need for dynamic minors now when dev_t is 32bits: $ grep dev_t /Net/git/linux-stable/include/linux/types.h typedef u32 __kernel_dev_t; typedef __kernel_dev_t dev_t; $ and we have 20 bits minors: $ grep -A1 MINORBITS /Net/git/linux-stable/include/linux/kdev_t.h #define MINORBITS 20 #define MINORMASK ((1U << MINORBITS) - 1) #define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) Regards, /Karl Hammar