LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-14-2019, 07:36 PM   #1
helen314
Member
 
Registered: Jun 2019
Posts: 78

Rep: Reputation: 0
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$




 
Old 06-14-2019, 08:07 PM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,978

Rep: Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272Reputation: 1272
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.
 
Old 06-14-2019, 10:58 PM   #3
helen314
Member
 
Registered: Jun 2019
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wpeckham View Post
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.
 
Old 06-15-2019, 12:46 AM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,160

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
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.

Last edited by berndbausch; 06-15-2019 at 12:53 AM.
 
Old 06-15-2019, 10:59 AM   #5
helen314
Member
 
Registered: Jun 2019
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by berndbausch View Post
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.
 
Old 06-15-2019, 06:50 PM   #6
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,160

Rep: Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828Reputation: 828
Quote:
Originally Posted by helen314 View Post
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.
 
Old 06-15-2019, 10:57 PM   #7
helen314
Member
 
Registered: Jun 2019
Posts: 78

Original Poster
Rep: Reputation: 0
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:~$


 
Old 06-16-2019, 10:38 AM   #8
helen314
Member
 
Registered: Jun 2019
Posts: 78

Original Poster
Rep: Reputation: 0
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
 
  


Reply

Tags
boot, grub, mdadm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to backup MDADM super blocks and other tips I should know about mdadm? road hazard Linux - Newbie 5 08-04-2016 12:21 AM
[SOLVED] Attempts to work around a mdadm bug/ mdadm cannot get exclusive access to /dev/md127 Sereph Linux - Newbie 1 08-16-2011 03:21 AM
MDADM screws up the LVM partitions? Can't mount the LVMs after mdadm stopped alirezan1 Linux - Newbie 3 11-18-2008 04:42 PM
unable to load MDADM module BUT mdadm works?!?!?! alirezan1 Linux - Software 2 09-08-2008 07:58 PM
mdadm says "mdadm: /dev/md1 not identified in config file" when booting FC7 raffeD Linux - Server 1 08-11-2008 11:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration