mdadm raid 5 not automounting

I just set up a software raid for the first time after I set it up I rebooted and noticed it doesn’t automount. (fstab reverted as well)

I can remount the raid via the drive manager but every time on reboot it does not stay mounted. These are not external drives either.

Please let me know what sort of information you will need and I will gladly get it for you.

Below is what fstab shows after reboot.

# Please use "dietpi-drive_manager" to setup mounts
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------


#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=11905M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAPFILE
#----------------------------------------------------------------


#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
UUID=2e9d8509-a765-48ba-ba71-4110f21ef219 / ext4 noatime,lazytime,rw 0 1
#UUID=9bdec8cd-8e95-f476-3158-9f8e68a06280 /mnt/9bdec8cd-8e95-f476-3158-9f8e68a06280 linux_raid_member noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=9bdec8cd-8e95-f476-3158-9f8e68a06280 /mnt/9bdec8cd-8e95-f476-3158-9f8e68a06280 linux_raid_member noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=9bdec8cd-8e95-f476-3158-9f8e68a06280 /mnt/9bdec8cd-8e95-f476-3158-9f8e68a06280 linux_raid_member noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=9bdec8cd-8e95-f476-3158-9f8e68a06280 /mnt/9bdec8cd-8e95-f476-3158-9f8e68a06280 linux_raid_member noatime,lazytime,rw,nofail,noauto,x-systemd.automount
#UUID=847b2756-5e7d-464c-9dcf-954e644f1fe3 /mnt/847b2756-5e7d-464c-9dcf-954e644f1fe3 ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount

lsblk

root@DietPi:/# lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda         8:0    0 111.8G  0 disk  
└─sda1      8:1    0 111.8G  0 part  /
sdb         8:16   0 931.5G  0 disk  
└─sdb1      8:17   0 931.5G  0 part  
  └─md127   9:127  0   2.7T  0 raid5 
sdc         8:32   0 931.5G  0 disk  
└─sdc1      8:33   0 931.5G  0 part  
  └─md127   9:127  0   2.7T  0 raid5 
sdd         8:48   0 931.5G  0 disk  
└─sdd1      8:49   0 931.5G  0 part  
  └─md127   9:127  0   2.7T  0 raid5 
sde         8:64   0 931.5G  0 disk  
└─sde1      8:65   0 931.5G  0 part  
  └─md127   9:127  0   2.7T  0 raid5

EDIT: Actually it looks like they only auto mount when accessed?

correct. the mount contain option x-systemd.automount. Means it is not mounted on reboot directly. It mounts as soon as someone is trying to access the directory.

I did a test on my VM and it’s working well

root@DietPiVM2:/mnt/raid# lsblk -o name,fstype,label,size,ro,type,mountpoint
NAME   FSTYPE            LABEL        SIZE RO TYPE  MOUNTPOINT
sda                                    10G  0 disk
└─sda1 ext4                            10G  0 part  /
sdb    linux_raid_member DietPiVM2:0   10G  0 disk
└─md0  ext4                            20G  0 raid5 /mnt/raid
sdc    linux_raid_member DietPiVM2:0   10G  0 disk
└─md0  ext4                            20G  0 raid5 /mnt/raid
sdd    linux_raid_member DietPiVM2:0   10G  0 disk
└─md0  ext4                            20G  0 raid5 /mnt/raid
sr0                                  1024M  0 rom
sr1                                  1024M  0 rom
root@DietPiVM2:/mnt/raid#



root@DietPiVM2:/mnt/raid#  cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid5 sdd[3] sdc[1] sdb[0]
      20953088 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>
root@DietPiVM2:/mnt/raid#

Is there a way to make it automount on reboot?

It looks like plex kinda makes it work that way without forcing it to, seeing plex accesses the drive on launch.

usually Plex should force the mount as soon as Plex is trying to access files on that device

Well done! I’ve attempted this several times but with mixed results. Do you have any tutorials, how to articles or so forth that could help me out?

That would be great as I have looked around and given it a go, but no luck.

maybe this could help https://www.linuxbabe.com/linux-server/linux-software-raid-1-setup

Interesting, thanks!

Weird how one of the drives gets removed / fails before the setup is completed.

Also interesting that this approach requires / relates to setting up from within an existing linux installation. I’ve always tried it from scratch. Have spent copious time in front of whiptail (I think!) installers trying to get it right!

At present have just the two drives with a fresh DietPi installed. Thanks to all the DietPi cool installer helpers, does not take much to get another install going though :slight_smile:

Maybe I’ll give that linuxbabe approach a go by booting DietPi off a USB stick and doing the install after creating the RAID array. Is that possible in that I guess I’ll have to ‘drop out’ or flip into a non-installer mode before. Does DietPi have the “Execute a shell”, AFAIK from the Debian installer Expert mode, or similar? I may have seen it but maybe not. Something like this:

Are you trying to boot the system from an attached raid? I’m not sure if this is possible as this is a software raid. Means you would need to have a system already booted to load the raid driver. Isn’t it?

I was wondering if I could boot a DietPi USB stick, Execute a shell, follow the linuxbabe RAID set up approach to get the two non-removable drives running in RAID1, then continue to install DietPi on the /dev/md0 RAID device.

If the RAID driver is not loaded into memory, or from the USB stick, I suppose this may not work although the linuxbabe article seems to suggest mdadm will need manual installing anyway so perhaps installing mdadm supplies the RAID driver with it?

Not really sure about any of this. Suspect a bit of semi-informed trial and error is necessary.

Best would be to boot dietpi from usb pen, attach your disk as own device/raid and use this is DietPi user data location.

I don’t think you could boot from a software raid but feel free and try out

Imagine you may well be correct there as - from very vague memory - I have usually got all the way up to the GRUB install phase and it’s usually failed there. I suppose I would be best off documenting my experiences to help me remember and relate them to others who might be able to help. How to take screenshots of whiptail interfaces though!? I’ll see if there’s any way and or rely on camera photos of the screen as a fallback.

yes if you don’t have SSH access or any remote solution, taking pictures would be easiest.

Always set up SSH, key based of course :slight_smile:

Is there a command line tool for screenshots that I’m not aware of? Perhaps some Ctrl + Alt + F* to switch to another console (much like multi desktops) and tell some tool to capture the console X where the setup is running? Or not. Sounds like a good idea if not :slight_smile:

Otherwise, I guess you may have been alluding to something like VNC? That wouldn’t work in console / terminal set up mode though, would it?

Always wanted a screenshot tool for documenting setup steps for posterity.

I don’t use any desktop or VNC as all my systems are headless. Therefore taking pictures from a SSH client is not an issue :wink: