I'm trying to control mdadm
from a Python script, and have a call similar to this:
subprocess.Popen('mdadm --create /dev/md1 --raid-devices=4 /dev/md-0 /dev/md-1 /dev/md-2 /dev/md-3'.split())
mdadm
then complains with mdadm: You have listed more devices (5) than are in the array(4)!
When I use shell=True
(or os.system
), it works just fine. For example:
subprocess.Popen('mdadm --create /dev/md1 --raid-devices=4 /dev/md-0 /dev/md-1 /dev/md-2 /dev/md-3', shell=True)
Why does the call fail without shell=True
?
EDIT: Here is the full string that I'm splitting up and passing to subprocess.Popen
:
mdadm --create /dev/md10 --name /dev/md/demo --chunk=128K --level=raid6 --size=104857600 $MDADM_r6_OPT --spare-device=0 --raid-devices=8 /dev/mapper/mpathbp2 /dev/mapper/mpathbp3 /dev/mapper/mpathbp4 /dev/mapper/mpathbp5 /dev/mapper/mpathcp2 /dev/mapper/mpathcp3 /dev/mapper/mpathcp4 /dev/mapper/mpathcp5