Score:0

md RAID spare disk partition has another partition?

cn flag

I recently had a drive fail in my RAID 5 array with 3 disks and 1 spare. The spare was used automatically. All seems to be working OK.

I then added a new disk as the new spare like this, where sdb was a working drive in the array and sdc is the new one as reported by dmesg:

sfdisk -d /dev/sdb | sfdisk /dev/sdc

mdadm --manage /dev/md0 --add /dev/sdc1

However, becuase I forgot to add the parition number on that last command, it means the partitioning scheme isn't the same for the spare as it is the others, and /proc/mdstat looks like this now:

md0 : active raid5 sdc[4](S) sdd1[5] sdb1[3] sde1[6]
      955537408 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/3] [UUU]
      bitmap: 0/4 pages [0KB], 65536KB chunk

lsblk shows this:

sdb                         8:16   0 465.8G  0 disk  
└─sdb1                      8:17   0 455.8G  0 part  
  └─md0                     9:0    0 911.3G  0 raid5 /mnt/nas
sdc                         8:32   0 465.8G  0 disk  
├─sdc1                      8:33   0 455.8G  0 part  
└─md0                       9:0    0 911.3G  0 raid5 /mnt/nas
sdd                         8:48   0 465.8G  0 disk  
└─sdd1                      8:49   0 455.8G  0 part  
  └─md0                     9:0    0 911.3G  0 raid5 /mnt/nas
sde                         8:64   0 465.8G  0 disk  
└─sde1                      8:65   0 455.8G  0 part  
  └─md0                     9:0    0 911.3G  0 raid5 /mnt/nas

Is it a problem that the spare disk is different in the event that it needs to be added? Should I remove it and re-add it so that it's the same?

Terrance avatar
id flag
RAID 5 is supposed to have the parity striped across the disks and not have a spare. While you can use it with a spare, it is better to have the parity striped. You probably need to grow your array to 4 disks. See: https://raid.wiki.kernel.org/index.php/Growing
TommyPeanuts avatar
cn flag
You're right, but I'm just too lazy to reconfigure the RAID for that. The existence of the spare is because originally I only had 3 disks and bought another one later :-)
Terrance avatar
id flag
Then nothing is wrong the way it is configured. As long as it is mounting correctly then there is no issue. If you have rebooted the host from the time the one drive went bad and installed your new hot spare, the `/dev/sdX` can change between reboots. As far as I remember the RAID is created by the UUID and not the `/dev/sdXX` anyways. Then it should be mounted in the `fstab` file by the UUID. If you look in `/etc/mdadm/mdadm.conf` you should be able to see your ARRAYs in there using the UUIDs instead of the drive designations.
Terrance avatar
id flag
If you run `sudo mdadm -D /dev/md0` it should show you the health (state) of your array, the ARRAY UUID and the drives that are currently in use for the array.
TommyPeanuts avatar
cn flag
Oh OK. So it'll just use the UUID of the partition I added for the spare. `mdadm -D` looks fine.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.