[opensuse] changing "number" propety of devices in linux mdraid array
Hello: I use linux mdraid in openSUSE for device mirroring (raid1). When looking at array properties in /proc/mdstat and mdadm -D I see arrays like: md13 : active raid1 sdc13[2] sdb13[3] 62918468 blocks super 1.0 [2/2] [UU] mdadm -D /dev/md13 /dev/md13: Version : 1.0 Creation Time : Mon Jul 15 10:44:48 2013 Raid Level : raid1 Array Size : 62918468 (60.00 GiB 64.43 GB) Used Dev Size : 62918468 (60.00 GiB 64.43 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Sun Oct 11 15:17:01 2015 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Name : pc:13 (local to host pc) UUID : xxxxxxxxxxxxxxxxxxxxxxxxx Events : 2631 Number Major Minor RaidDevice State 3 8 29 0 active sync /dev/sdb13 2 8 45 1 active sync /dev/sdc13 As you see the array has only two devices still the "number" for the devices are 3 and 2. How could I change this to have number 0 for /dev/sdb13 and number 1 for /dev/sdc13? That is, that mdstat would indicate this: md13 : active raid1 sdb13[0] sdc13[1] Also, what exactly are the meanings of "Number" and "Minor"? Which one is the so called "slot" I see at some page dealing with mdraid? I could not find info regarding this in mdadm manual or raid wiki pages. Thanks, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
11.10.2015 16:31, Istvan Gabor пишет:
Hello:
I use linux mdraid in openSUSE for device mirroring (raid1). When looking at array properties in /proc/mdstat and mdadm -D I see arrays like:
md13 : active raid1 sdc13[2] sdb13[3] 62918468 blocks super 1.0 [2/2] [UU]
mdadm -D /dev/md13 /dev/md13: Version : 1.0 Creation Time : Mon Jul 15 10:44:48 2013 Raid Level : raid1 Array Size : 62918468 (60.00 GiB 64.43 GB) Used Dev Size : 62918468 (60.00 GiB 64.43 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent
Update Time : Sun Oct 11 15:17:01 2015 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0
Name : pc:13 (local to host pc) UUID : xxxxxxxxxxxxxxxxxxxxxxxxx Events : 2631
Number Major Minor RaidDevice State 3 8 29 0 active sync /dev/sdb13 2 8 45 1 active sync /dev/sdc13
As you see the array has only two devices still the "number" for the devices are 3 and 2. How could I change this to have number 0 for /dev/sdb13 and number 1 for /dev/sdc13?
Does it really matter?
That is, that mdstat would indicate this: md13 : active raid1 sdb13[0] sdc13[1]
Also, what exactly are the meanings of "Number" and "Minor"? Which one is the so called "slot" I see at some page dealing with mdraid?
"Slot" is the very first column, Number. I do not think you can change it. It does not look like it is exposed anywhere in management interface. The only way is probably to recreate (not assemble) array using --assume-clean; that should reinitialize superblock, starting slot allocation anew.
I could not find info regarding this in mdadm manual or raid wiki pages.
Thanks,
Istvan
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Andrei Borzenkov <arvidjaar@gmail.com> schreef:
11.10.2015 16:31, Istvan Gabor пишет:
As you see the array has only two devices still the "number" for the devices are 3 and 2. How could I change this to have number 0 for /dev/sdb13 and number 1 for /dev/sdc13?
Does it really matter?
The higher numbers have probably resulted from a disk being re-added to the array after the system has booted with only one disk, some time. So it started out as 0 1, then some disk became 2, then another disk became 3. You can see here on a system of mine that I have the same: md0 : active raid1 sda3[2] sdb3[0] md4 : active raid1 sda2[3] sdb2[2] This is because I have experimented with booting with only one disk to see what would happen and what I needed to do to get the array working again. I have no solution for your ...problem though ;-). Sure I would love the same. I also don't know how to reorder the raid numbers: md0 : active raid1 sda3[2] sdb3[0] md1 : active raid0 sda4[1] sdb4[0] md2 : active raid0 sda5[1] sdb5[0] md3 : active raid1 sda6[2] sdb6[0] md4 : active raid1 sda2[3] sdb2[2] as you can see the last array was added after the others, and it includes the boot partitions. You can also see that the stripe raids never did any kind of reordering (number increment) because they are simply not loaded when a disk is missing. I wonder how I can turn md4 into md0 and increment md0-md3, but I worry that grub will start to bolt if I do something wrong (it is a remote system). It also complains that my mdadm.conf is wrong (that no arrays are defined) but that is even another story. Regards.. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Xen wrote:
It also complains that my mdadm.conf is wrong (that no arrays are defined) but that is even another story.
Run "mdadm --examine --scan >/etc/mdadm.conf.new" and (optionally study the contents before you) move it to mdadm.conf. -- Per Jessen, Zürich (8.7°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Xen wrote:
I wonder how I can turn md4 into md0 and increment md0-md3, but I
mdadm --stop /dev/mdA mdadm --assemble /dev/mdB <previous units of mdA> -- Per Jessen, Zürich (8.8°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Mon, Oct 12, 2015 at 9:02 AM, Per Jessen <per@computer.org> wrote:
Xen wrote:
I wonder how I can turn md4 into md0 and increment md0-md3, but I
mdadm --stop /dev/mdA mdadm --assemble /dev/mdB <previous units of mdA>
Assuming metadata 1.x. you probably want to add --update=name as well. But note that this actually only affects names under /dev/md/ directory. Names under /dev (/dev/mdX) are auto-allocated at runtime; it is quite possible to have /dev/md/md0 referring to /dev/md127. In general there is no way to get persistent /dev/mdX just like there is no way to get persistent /dev/sdX. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Andrei Borzenkov wrote:
On Mon, Oct 12, 2015 at 9:02 AM, Per Jessen <per@computer.org> wrote:
Xen wrote:
I wonder how I can turn md4 into md0 and increment md0-md3, but I
mdadm --stop /dev/mdA mdadm --assemble /dev/mdB <previous units of mdA>
Assuming metadata 1.x. you probably want to add --update=name as well. But note that this actually only affects names under /dev/md/ directory.
That's not quite what I see - I have a test desktop (Leap 42) with an md0, md1 and md2. Before I tested the above, I had # l /dev/md total 0 drwxr-xr-x 2 root root 100 Oct 9 09:16 ./ drwxr-xr-x 19 root root 4080 Oct 9 09:17 ../ lrwxrwxrwx 1 root root 6 Oct 9 09:16 0 -> ../md0 lrwxrwxrwx 1 root root 6 Oct 9 09:16 1 -> ../md1 lrwxrwxrwx 1 root root 6 Oct 9 09:16 2 -> ../md2 And /dev/md0, /dev/md1, /dev/md2. I stopped md2, reassembled as md22. # l /dev/md* brw-rw---- 1 root disk 9, 0 Oct 9 09:16 /dev/md0 brw-rw---- 1 root disk 9, 1 Oct 9 09:16 /dev/md1 brw-rw---- 1 root disk 9, 22 Oct 12 08:59 /dev/md22 /dev/md: total 0 drwxr-xr-x 2 root root 80 Oct 12 07:56 ./ drwxr-xr-x 19 root root 4080 Oct 12 08:59 ../ lrwxrwxrwx 1 root root 6 Oct 9 09:16 0 -> ../md0 lrwxrwxrwx 1 root root 6 Oct 9 09:16 1 -> ../md1
Names under /dev (/dev/mdX) are auto-allocated at runtime;
I thought the naming was controlled by mdadm.conf?
it is quite possible to have /dev/md/md0 referring to /dev/md127. In general there is no way to get persistent /dev/mdX just like there is no way to get persistent /dev/sdX.
Except for one recent system with two raid controllers, I have always had persistent /dev/sdX names. Maybe by sheer luck, dunno. -- Per Jessen, Zürich (9.1°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/11/2015 10:01 AM, Andrei Borzenkov wrote:
As you see the array has only two devices still the "number" for the devices are 3 and 2. How could I change this to have number 0 for /dev/sdb13 and number 1 for /dev/sdc13?
Does it really matter?
It does not matter at all. Andrei's question (rhetorical in nature) along with he and Xen's discussion regarding the raid "slot" number is directly the point. The "slot" number used by mdraid has no bearing on overall array operation from the user standpoint. It is more an accounting parameter used internally by mdraid. Don't lose any more sleep over it. You already know it resulted from you booting in degraded mode as a test. mdraid is doing exactly what it is supposed to be doing. Unless you need to see the details, $ cat /proc/mdstat will show you are pertinent information from an "is the array working on all disks?" standpoint. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2015-10-11 15:31, Istvan Gabor wrote:
Number Major Minor RaidDevice State 3 8 29 0 active sync /dev/sdb13 2 8 45 1 active sync /dev/sdc13
Also, what exactly are the meanings of "Number" and "Minor"?
Major and minor, you can find in the detailed list of devices, given in the output of "ls -l /dev", and they identify devices. What module driver is assigned to them. You can find those numbers documented in the kernel sources documentation, /usr/src/linux/Documentation/ (path given from memory, so probably misspelled). The file in there you need could be "Devices.txt". Sorry, I don't have it in this computer, so I can't verify at this instant. Later, if you are interested. - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlYa3M4ACgkQja8UbcUWM1wjmAD+NmI54vwjv59p6skHJGIVnMSw JoZKpJMFqQ3mw45QlWIA/3N34fLCufSwerJAYS3v/eZTPajPk64L+X2H6k1Zutau =GrBC -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2015-10-12 00:03, Carlos E. R. wrote:
On 2015-10-11 15:31, Istvan Gabor wrote:
Number Major Minor RaidDevice State 3 8 29 0 active sync /dev/sdb13 2 8 45 1 active sync /dev/sdc13
Also, what exactly are the meanings of "Number" and "Minor"?
Major and minor, you can find in the detailed list of devices, given in the output of "ls -l /dev", and they identify devices. What module driver is assigned to them.
You can find those numbers documented in the kernel sources documentation, /usr/src/linux/Documentation/ (path given from memory, so probably misspelled). The file in there you need could be "Devices.txt". Sorry, I don't have it in this computer, so I can't verify at this instant. Later, if you are interested.
I'm now at another computer with that information. /usr/src/linux/Documentation/devices.txt LINUX ALLOCATED DEVICES (2.6+ version) Maintained by Alan Cox <device@lanana.org> Last revised: 6th April 2009 ... Fourth, remember that Linux now has extensive support for dynamic allocation of device numbering and can use sysfs and udev to handle the naming needs. ... 8 block SCSI disk devices (0-15) 0 = /dev/sda First SCSI disk whole disk 16 = /dev/sdb Second SCSI disk whole disk 32 = /dev/sdc Third SCSI disk whole disk ... 240 = /dev/sdp Sixteenth SCSI disk whole disk Partitions are handled in the same way as for IDE disks (see major number 3) except that the limit on partitions is 15. ... 3 block First MFM, RLL and IDE hard disk/CD-ROM interface 0 = /dev/hda Master: whole disk (or CD-ROM) 64 = /dev/hdb Slave: whole disk (or CD-ROM) For partitions, add to the whole disk device number: 0 = /dev/hd? Whole disk 1 = /dev/hd?1 First partition 2 = /dev/hd?2 Second partition ... 63 = /dev/hd?63 63rd partition For Linux/i386, partitions 1-4 are the primary partitions, and 5 and above are logical partitions. Other versions of Linux use partitioning schemes appropriate to their respective architectures. And the limit on partitions is no longer 15. Major, minor, were "byte" size, ie, up to 255 max. I believe this is no longer true. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)
participants (6)
-
Andrei Borzenkov
-
Carlos E. R.
-
David C. Rankin
-
Istvan Gabor
-
Per Jessen
-
Xen