Re: Problem with mdadm, raid1 and automatically adds any disk to raid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 2/26/19 6:37 AM, Simon Matter via CentOS wrote:
How is it not systemd doing it? Such things didn't happen with pre systemd
distributions.


The following log is from a CentOS 6 system.  I created RAID devices on two drives.  I then stopped the RAID devices and 'dd' over the beginning of the drive.  I then re-partition the drives.

At that point, the RAID devices auto-assemble.  They actually partially fail, below, but the behavior that this thread discusses absolutely is not systemd-specific.

What you're seeing is that you're wiping the partition, but not the RAID information inside the partitions.  When you remove and then re-create the partitions, you're hot-adding RAID components to the system.  They auto-assemble, as they have (or should have) for a long time.  It's probably more reliable under newer revisions, but this is long-standing behavior.

The problem isn't systemd.  The problem is that you're not wiping what you think you're wiping.  You need to use "wipefs -a" on each partition that's a RAID component first, and then "wipefs -a" on the drive itself to get rid of the partition table.


[root@localhost ~]# dd if=/dev/zero of=/dev/vdb bs=512 count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.0757563 s, 6.9 MB/s
[root@localhost ~]# dd if=/dev/zero of=/dev/vdc bs=512 count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.0385181 s, 13.6 MB/s
[root@localhost ~]# kpartx -a /dev/vdb
  Warning: Disk has a valid GPT signature but invalid PMBR.
  Assuming this disk is *not* a GPT disk anymore.
  Use gpt kernel option to override.  Use GNU Parted to correct disk.
[root@localhost ~]# kpartx -a /dev/vdc
  Warning: Disk has a valid GPT signature but invalid PMBR.
  Assuming this disk is *not* a GPT disk anymore.
  Use gpt kernel option to override.  Use GNU Parted to correct disk.
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid1]
unused devices: <none>
[root@localhost ~]# parted /dev/vdb -s mklabel gpt   mkpart primary ext4 1M 200M   mkpart primary ext4 200M 1224M   mkpart primary ext4 1224M 100% [root@localhost ~]# parted /dev/vdc -s mklabel gpt   mkpart primary ext4 1M 200M   mkpart primary ext4 200M 1224M   mkpart primary ext4 1224M 100%
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid1]
unused devices: <none>
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid1]
md2 : active raid1 vdc3[1] vdb3[0]
      19775360 blocks super 1.0 [2/2] [UU]

md1 : active raid1 vdb2[0]
      999360 blocks super 1.0 [2/1] [U_]

md0 : active raid1 vdb1[0]
      194496 blocks super 1.0 [2/1] [U_]

unused devices: <none>

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux