Mdadm

From Noah.org
Jump to: navigation, search


single disk from md array won't mount

This is the scenario: you pulled a single drive from a RAID-1 mdarray and you plug it into your SATA-to-USB dock. Running `fdisk -l` shows the device you expect, "/dev/sdb1", but when you try to mount `mount /dev/sdb1 /media/adhoc" you get an error saying, "mount: special device /dev/sdb1 does not exist". This seems odd since `fdisk -l` shows it and running `fdisk /dev/sdb1` lets you look at the partition.

The problem seems to be due to mdadm interfering with mounting of the drive. It seems that the configuration in mdadm.conf of a drive with the same UUID will make it so that you cannot mount that drive in a stand-alone configuration. The solution is to tell mdadm to stop looking at the UUID. So far, it seems that this requires a reboot. I was not able to get around this problem simply by running `/etc/init.d/mdadm restart`.


steps to mounting md device as a stand-alone drive

Edit "/etc/mdadm/mdadm.conf" and comment out the section on "definitions of existing MD arrays". These are the lines that start with "ARRAY". For example:

ARRAY /dev/md0 level=raid1 num-devices=2 UUID=1ff76218:082fcad3:f6c29b18:18f830a8

Reboot. Now you should be able to mount the drive. Note that you must still specify the filesystem type.

mount -t ext3 /dev/sdb1 /media/adhoc

You can verify that the problem was with /etc/mdadm/mdadm.conf by examining the superblock on an array component (the drive you just mounted). Note that the superblock for this entire drive is in /dev/sdb, not /dev/sdb1.

mdadm --examine /dev/sdb

The UUID below should match the line that you commented out in /etc/mdadm/mdadm.conf.

/dev/sdb:
          Magic : a92b4efc
        Version : 00.90.00
           UUID : 1ff76218:082fcad3:f6c29b18:18f830a8
  Creation Time : Sun Jun 22 18:38:20 2008
     Raid Level : raid1
  Used Dev Size : 732574464 (698.64 GiB 750.16 GB)
     Array Size : 732574464 (698.64 GiB 750.16 GB)
   Raid Devices : 2
  Total Devices : 1
Preferred Minor : 0

    Update Time : Wed Oct  8 14:39:29 2008
          State : clean
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0
       Checksum : 9e03a277 - correct
         Events : 0.4


      Number   Major   Minor   RaidDevice State
this     1       8       16        1      active sync   /dev/sdb

   0     0       0        0        0      removed
   1     1       8       16        1      active sync   /dev/sdb

permanently make drive a stand-alone non-RAID device

After you are able to get the drive to mount you can remove the RAID superblock and the drive will look like an ordinary drive to Linux.

mdadm --zero-superblock /dev/sdb1