Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 10791  / 2 Years ago, tue, february 15, 2022, 4:50:52

I'm facing a really annoying bug, I have set up a Software RAID1 with mdadm, and the setup went just ok with this results




/dev/md/lucas.mgscreativa.com.ar:0




I have also configured mdadm.conf like this



DEVICE /dev/sda /dev/sdb

# auto-create devices with Debian standard permissions CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts MAILADDR root

# definitions of existing MD arrays ARRAY /dev/md/lucas.mgscreativa.com.ar:0 metadata=1.2
name=lucas.mgscreativa.com.ar:0
UUID=c913486a:e62c7ea1:cfb98b6b:253d1f62


And fstab configured like this



/dev/md/lucas.mgscreativa.com.ar:0 /media/data     ext4
defaults,noatime 0 0


But, some day, my array name suddenly changed from /dev/md/lucas.mgscreativa.com.ar:0 to /dev/md0, so I have done some changes in fstab and mdadm.conf (of course, after hours and hours of tryal and error) and everything went just ok, but today, AGAIN, the MD number changed from /dev/md0 to /dev/md127!!!



What's going on here? is this a bug I guess.



Is there any way to fix the MD number so my server can work as it shhould, without flaws?



Thanks!


More From » server

 Answers
5

First: you are probably having errors in your array. You need to check its status, immediately.



Example:



root@locutus:~# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Fri Jun 1 15:30:31 2012
Raid Level : raid10
Array Size : 1953119232 (1862.64 GiB 1999.99 GB)
Used Dev Size : 976559616 (931.32 GiB 1000.00 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent

Update Time : Sun Nov 25 21:39:44 2012
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

Layout : near=2
Chunk Size : 512K

Name : locutus:0 (local to host locutus)
UUID : b81ac63a:51a9b01c:c01812ec:86c534c4
Events : 182

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 49 1 active sync /dev/sdd1
2 8 17 2 active sync /dev/sdb1
3 8 33 3 active sync /dev/sdc1


You will very likely find that you have errors... those will need to get addressed.



Moving on, you should change the way your fstab is set up, to use UUID instead of using devicename. Use the blkid command on your array (or a partition under your array) to get its UUID, then use that UUID to mount it in /etc/fstab.



Example:



root@locutus:~# blkid /dev/mapper/vg0-root
/dev/mapper/vg0-root: UUID="61998221-7b39-49cd-83f7-62fda973218c" TYPE="ext4"


With this information, I would set my /etc/fstab entry for root to look like this:



UUID=61998221-7b39-49cd-83f7-62fda973218c    /    ext4    defaults,errors=remount-ro    0    1


Once you've done this, your system will find your partitions no matter whether their device names change or not (for example, if drive cables get swapped around).



You should also set up your /etc/mdadm/mdadm.conf to find things automatically without needing any particular drive to be in any particular location:



# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md/0 metadata=1.2 UUID=c913486a:e62c7ea1:cfb98b6b:253d1f62 name=lucas.mgscreativa.com.ar:0


NOTE THAT THERE ARE NO DEVICES SPECIFIED IN THIS CONF FILE. This is a feature, not a bug. With mdadm.conf set up this way, your system will automatically scan all attached drives looking for anything that belongs to your array, and will assemble them all as /dev/md0.


[#34511] Tuesday, February 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
landarre

Total Points: 254
Total Questions: 96
Total Answers: 109

Location: Burundi
Member since Sun, Apr 16, 2023
1 Year ago
landarre questions
;