LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Howto RAID Automount? (https://www.linuxquestions.org/questions/slackware-14/howto-raid-automount-651636/)

WindowBreaker 06-25-2008 02:08 PM

Howto RAID Automount?
 
I have a RAID-1 mirror setup with 2 external USB drives. The drives are only powered on just before a backup, and powered off when I'm done.

How do I configure linux to automatically assemble the RAID and mount the drives when they are powered up.

The manual process I follow is:
1. Power on the drives.
2. Determine the device files with
Code:

fdisk -l | grep raid
/dev/sdc1              1      60801  488384001  fd  Linux raid autodetect
/dev/sdd1              1      60801  488384001  fd  Linux raid autodetect

3. Assemble the array with
Code:

mdadm --assemble /dev/md0 /dev/sdc1 /dev/sdd1
4. Finally, I mount the array with
Code:

mount /dev/md0 /mnt/md0
I tried using UDEV rules to create specific device files. However, the mdadm utility complains that the files don't have valid superblock. So mdadm only works with the actual device file as listed above.

I could easily write a script to do this for me. However, the script would only work after both drives have powered on an initialized. Usually, it takes 20 seconds after powering them on, before I can see the drives with 'fdisk -l'.

Any ideas?

Alien Bob 06-25-2008 03:12 PM

Instead of using fdisk to determine your RAID partitions, and then running a full mdadm command with these partitions, why not let mdadm do the scanning and assembling?
Code:

mdadm -Es > /etc/mdadm.conf
mdadm -As

Equivalent to
Code:

mdadm --examine --scan > /etc/mdadm.conf
mdadm --assemble --scan

Maybe this link will help too: http://slackware.osuosl.org/slackwar...EADME_RAID.TXT

Eric


All times are GMT -5. The time now is 03:21 AM.