[SOLVED] ZFS partitions get rebuilt/activated by mdadm

Jannoke

Well-Known Member
Jul 13, 2016
58
10
48
I have a trouble where mdadm autoactivates zfs volumes from VM's. I would not like mdadm to touch anything from zfs volumes.
I tried to search for it since it's more like debian problem, but could not filnd a solution. Probably a filter when loading mdadm module?

Bash:
root@elite:~# cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md121 : inactive zd16p3[1](S)
      1020032 blocks
      
md122 : active (auto-read-only) raid1 zd16p5[1]
      27712000 blocks [2/1] [_U]
      
md123 : active (auto-read-only) raid1 zd16p1[1]
      104320 blocks [2/1] [_U]
      
md124 : active (auto-read-only) raid1 zd16p2[1]
      10241344 blocks [2/1] [_U]
      
md125 : inactive zd32p3[1](S) zd0p3[0](S)
      78057472 blocks super 1.2
      
md126 : inactive zd32p1[1](S) zd0p1[0](S)
      1949696 blocks super 1.2
      
md127 : inactive zd32p2[1](S) zd0p2[0](S)
      39026688 blocks super 1.2
      
md1 : active raid1 sdc2[0] sdb2[1]
      19513344 blocks super 1.2 [2/2] [UU]
      
md0 : active raid1 sdc1[0] sdb1[1]
      974848 blocks super 1.2 [2/2] [UU]
      
unused devices: <none>
 
It's said even on proxmox documentation itself - you can test out proxmox cluster inside proxmox :). It's not uncommon to have these setups if there are some dev machines or migration clones from real world servers. I sometimes make test upgrade/reinstallation on proxmox and then dump the contents to disk that can be swapped over into live machine during nightly maintenance. These things happen. It seems article provided applies to multipath or lvm, not mdadm.
 
It's not uncommon to have these setups if there are some dev machines or migration clones from real world servers.
Point taken. Haven't thought of that one.


It seems article provided applies to multipath or lvm, not mdadm.
I know, its one of my threads. Thought it might be useful still because you try to accomplish similar with ldadm. So masking etc. also might be there and be search word you would not think of automatically.

I went back to my legacy documentation (before I moved to zfs) and I think this might help. What you actually try to do is to prevent mdadm raids not to be "auto-assembled"

You can find ton of hints how to prevent this. For instance here:
https://unix.stackexchange.com/questions/166688/prevent-debian-from-auto-assembling-raid-at-boot
Or here:
https://serverfault.com/questions/313548/can-you-disable-automatic-mdadm-startups

Good luck ;)
 
I am not interested in disabling auto assembly. I was interested disabling auto assembly for zd*. Since I can't think of way make negative glob ( can it be even done?) then I just ended matching for scsi and nvme devices. I have never been good at glob/regex.

INI:
# 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

DEVICE /dev/nvme[0-9]*n[0-9]* /dev/sd[a-z]*[0-9]*

NB! This also needs:
Bash:
update-initramfs -u

Mdadm will complain during initramfs generation if you make some glob what it does not understand.

I confirmed it also by sticking usb stick in which is part of raid volume. It auto assembled.
 
I am not interested in disabling auto assembly.
Well I think you do, at least for specific devices. And this is exactly what your regex does. By including auto-assembly of some devices you exclude others. Sometimes we need to think around a corner.

According to my understanding you also can only assemble specific raidsets. That could come in handy at some point.

All the best
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!