LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   mdadm configuration (https://www.linuxquestions.org/questions/linux-networking-3/mdadm-configuration-4175655732/)

helen314 06-14-2019 07:36 PM

mdadm configuration
 
I have posted a request for assistance regarding how to enable mdadm to assemble / activate on boot.
I am sorry but I cannot find my original post.
I have received several answers but NONE of them helped me to set the mdadm to assemble or activate on boot.

I have no issues doing it manually.

Even after checking the mdadm man I have no idea how to instruct mdadm.conf to assemble on boot.

There is also something odd in the attached mdadm.conf - it shows only 1 spare.

I have added another "spares" and mdadm confirmed my additions.

Is there a manual way to "update" the mdamd.conf file ?




Quote:

# 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=5afe531e:3c41ecd9:7057ae6e:98985049 name=jim-desktop:0
spares=1

# This file was auto-generated on Thu, 13 Jun 2019 20:34:37 -0500
# by mkconf $Id$






wpeckham 06-14-2019 08:07 PM

I think you missed the step where you save your mdadm confiuration. I found
Quote:

NOTE : The assemble command reads the /etc/mdadm.conf file to start the array. In case you did not save your configuration in mdadm.conf before stopping the array, this command would fail. You can use the below command to recreate the mdadm.conf file :
# mdadm –examine –scan > /etc/mdadm.conf
in a RedHat/CentOS mdadm setup page.

helen314 06-14-2019 10:58 PM

Quote:

Originally Posted by wpeckham (Post 6005421)
I think you missed the step where you save your mdadm confiuration. I found in a RedHat/CentOS mdadm setup page.

Sorry, it does not work.

I did try similar command and as far as I can tell such attempt to write (redirect output to x.conf file) into mdmadm.conf which is auto build by other process SHOULD be blocked.

Several x.conf files come with note "do not modify this file".
grub and mdadm are one of them.



Quote:

z@z-desktop:~$ sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
bash: /etc/mdadm/mdadm.conf: Permission denied
z@z-desktop:~$
But this does work and really does not help me to make it assemble on boot.

Quote:

z@z-desktop:~$ sudo mdadm --examine --scan -v
[sudo] password for z:
ARRAY /dev/md/0 level=raid5 metadata=1.2 num-devices=3 UUID=5afe531e:3c41ecd9:7057ae6e:98985049 name=jim-desktop:0
spares=3 devices=/dev/sdf19,/dev/sdf18,/dev/sde6,/dev/sde5,/dev/sda3,/dev/sdb6,/dev/sdb4
z@z-desktop:~$
However, now the info is completed (3 active and 3 spares ), maybe it will "assemble " on next boot.
I'll try that soon.


Thanks for the reply.

berndbausch 06-15-2019 12:46 AM

You put your question into the Linux Networking forum. Not a very intuitive choice.

The following doesn’t work because you are not root:
Code:

z@z-desktop:~$ sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
bash: /etc/mdadm/mdadm.conf: Permission denied

The IO redirection >>/etc/mdadm.conf is executed before the sudo. It fails because you are a non-privileged user.

First become root, e.g. sudo -i, then redirect the command to mdadm.conf.

Quote:

Several x.conf files come with note "do not modify this file".
grub and mdadm are one of them.
I don’t see this mentioned in the mdadm.conf you display here. In any case, rather than adding array details to this file, I would replace the existing ARRAY definition.

helen314 06-15-2019 10:59 AM

Quote:

Originally Posted by berndbausch (Post 6005478)
You put your question into the Linux Networking forum. Not a very intuitive choice.

The following doesn’t work because you are not root:
Code:

z@z-desktop:~$ sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
bash: /etc/mdadm/mdadm.conf: Permission denied

The IO redirection >>/etc/mdadm.conf is executed before the sudo. It fails because you are a non-privileged user.

First become root, e.g. sudo -i, then redirect the command to mdadm.conf.


I don’t see this mentioned in the mdadm.conf you display here. In any case, rather than adding array details to this file, I would replace the existing ARRAY definition.


Excuse me for saying this, but that is not very safe and logical. I hope you do not get offended that I do not implement your advise AS IS. Whatever I do next HAS to be 150% safe.


The array is functional, can be manually activated and I have NO desire to loose the contents.

I sure like to know if scanning for detail will CHANGE what is already in the .conf file.
Perhaps I will create backup first or redirect the output to different file just to test.

Actually I feel the most safest way would be to duplicate current RAID md0.

berndbausch 06-15-2019 06:50 PM

Quote:

Originally Posted by helen314 (Post 6005630)
Excuse me for saying this, but that is not very safe and logical. I hope you do not get offended that I do not implement your advise AS IS. Whatever I do next HAS to be 150% safe.

If you run mdadm -Ds >> mdadm.conf, you add a second ARRAY directive for the same array to mdadm.conf. I don’t know if it is defined what that means, and I certainly don’t consider it safe. I also wonder what would convince you that some action is safe. No, I am not offended, but worried for your data.
Quote:

I sure like to know if scanning for detail will CHANGE what is already in the .conf file.
It won’t.
It will generate text output, which you can append to the configuration file (resulting in two ARRAY statements for the same array), or you can use to replace the existing ARRAY directive.
Quote:

Perhaps I will create backup first or redirect the output to different file just to test.
Redirecting output to a different file will have the same effect as not redirecting output, i.e. none.

Actually, the ARRAY statement should not be required to automatically assemble the array at system startup. Without it, assembly might take longer, but it should take place.

helen314 06-15-2019 10:57 PM

Here is a current copy of mdadm.conf.
It includes newly added ARRAY, neither one starts / mounts on boot.

I will look at EFI boot file(s) next.

At this point the question is - which process should have the "start at boot " instructions?
I had it working before and have a written note somewhere how it was optioned.
I'll try "find" .


Yes, just for kicks I'll comment the ARRAY out to see what will transpire.
Need to wait for "dd" to finish for next reboot.






Quote:

z@z-desktop:~$ cat /etc/mdadm/mdadm.conf
# 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/1 metadata=1.2 UUID=2fcd6c3c:7536faa9:8eb26bcd:31243bf7 name=z-desktop:1
ARRAY /dev/md/0 metadata=1.2 UUID=5afe531e:3c41ecd9:7057ae6e:98985049 name=jim-desktop:0
spares=3

z@z-desktop:~$




helen314 06-16-2019 10:38 AM

SOLVED

This is where / how to instruct mdadm to mount on boot

Quote:


z@z-desktop:~$ sudo dpkg-reconfigure mdadm
[sudo] password for z:
update-initramfs: deferring update (trigger activated)
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.15.0-51-generic
Found initrd image: /boot/initrd.img-4.15.0-51-generic
Found linux image: /boot/vmlinuz-4.15.0-45-generic
Found initrd image: /boot/initrd.img-4.15.0-45-generic


All times are GMT -5. The time now is 08:22 PM.