All Categories


How to Rename a mdadm Raid Device (quick method)

Sometimes a software raid device may have the wrong name, typically the default /dev/md127. When this happens how do we rename the array back to something useful like /dev/md2 ?


STEP#1 Find UUID of Raid Array /dev/md127

 

Execute Command: mdadm --detail /dev/md127

[root@us ~]# mdadm --detail /dev/md127
/dev/md127:
        Version : 1.1
  Creation Time : Mon Feb 25 21:34:38 2013
     Raid Level : raid10
     Array Size : 959859712 (915.39 GiB 982.90 GB)
  Used Dev Size : 479929856 (457.70 GiB 491.45 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Fri Sep 26 21:53:01 2014
          State : active 
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : near=2
     Chunk Size : 512K

           Name : us.hostdnsserver.com:2  (local to host us.hostdnsserver.com)
           UUID : 1e4872b5:e4d38a6d:9ee1be63:b2a49125
         Events : 962261

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3
       5       8       35        2      active sync   /dev/sdc3
       4       8       51        3      active sync   /dev/sdd3
[root@us ~]#
From this we find the UUID = 1e4872b5:e4d38a6d:9ee1be63:b2a49125

STEP#2 Add entry to /etc/mdadm.conf

 

Open /etc/mdadm.conf with editor of your choice

[root@us ~]# cat /etc/mdadm.conf
# mdadm.conf written out by anaconda
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md0 level=raid1 num-devices=4 UUID=d1e77d94:50a86867:7de907ed:6726f094
ARRAY /dev/md1 level=raid10 num-devices=4 UUID=23c7d068:deb02b3b:14fc01b7:f6b5a384
[root@us ~]#
Add line:
ARRAY /dev/md2 level=raid10 num-devices=4 UUID=1e4872b5:e4d38a6d:9ee1be63:b2a49125
So final version of file will appear as:
# mdadm.conf written out by anaconda
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md0 level=raid1 num-devices=4 UUID=d1e77d94:50a86867:7de907ed:6726f094
ARRAY /dev/md1 level=raid10 num-devices=4 UUID=23c7d068:deb02b3b:14fc01b7:f6b5a384
ARRAY /dev/md2 level=raid10 num-devices=4 UUID=1e4872b5:e4d38a6d:9ee1be63:b2a49125
Save and exit, then test by rebooting PC / server.



About the Author

Administrator

Most Viewed - All Categories