How to rename RAID1 /dev/md127 to /dev/md2 ?

General support questions
Post Reply
hapx
Posts: 11
Joined: 2011/09/06 08:09:25

How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by hapx » 2019/07/28 09:31:52

Hello,

I installed RAID1 with two disks in my VMware virtual machine (GPT disk with BIOS).
I would like to change /dev/md127 to /dev/md2 for consistency with my server.

How could I do that? Thank you.

Code: Select all

# cat /proc/mdstat
Personalities : [raid1]
md127 : active raid1 sda2[0] sdb2[2]
      30407680 blocks super 1.2 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>

# mdadm --detail /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Sat Jul 20 13:17:36 2019
        Raid Level : raid1
        Array Size : 30407680 (29.00 GiB 31.14 GB)
     Used Dev Size : 30407680 (29.00 GiB 31.14 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Sun Jul 28 11:23:07 2019
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : vm7raid.example.com:root  (local to host vm7raid.example.com)
              UUID : 14d0e2d8:d5b35fab:af0aaa25:84cab7ee
            Events : 345

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       2       8       18        1      active sync   /dev/sdb2


User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by TrevorH » 2019/07/28 12:31:38

You're RAIDing an already RAIDed device in a VM?

Edit /etc/mdadm.conf and set it up so the device is called what you want. Running mdadm --examine --scan will produce a line that reflects your current array and then you can take that and edit it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hapx
Posts: 11
Joined: 2011/09/06 08:09:25

Re: How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by hapx » 2019/07/28 13:21:21

@TrevorH

Thank you for your answer. The output of the command is:

Code: Select all

mdadm --examine --scan
ARRAY /dev/md/root  metadata=1.2 UUID=14d0e2d8:d5b35fab:af0aaa25:84cab7ee name=vm7raid.example.com:root
And current content of /etc/mdadm.conf:

Code: Select all

# cat /etc/mdadm.conf
# mdadm.conf written out by anaconda
MAILADDR root
AUTO +imsm +1.x -all
ARRAY /dev/md/root level=raid1 num-devices=2 UUID=14d0e2d8:d5b35fab:af0aaa25:84cab7ee
Do you mean I have just to edit /etc/mdadm.conf, and change "root" in /dev/md/root to "/dev/md/md2"? Then maybe just reboot? Or I have also to redo grub2-install to both /dev/sda and /dev/sdb ? Or maybe simply execute "update-initramfs -u" then reboot?

Thank you.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by TrevorH » 2019/07/28 15:10:05

AUTO +imsm +1.x -all
Is this FakeRAID?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hapx
Posts: 11
Joined: 2011/09/06 08:09:25

Re: How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by hapx » 2019/07/28 15:38:36

I don't know about FakeRAID. As I said, I create a virtual machine in VMWare workstation with two disks and run CenOS 7 setup with RAID and GPT support.
That line "AUTO +imsm +1.x -all" was created automatically.

I saw also this:

Code: Select all

# ls -l /dev/md/*
lrwxrwxrwx 1 root root 8 Jul 28 15:27 /dev/md/root -> ../md127

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to rename RAID1 /dev/md127 to /dev/md2 ?

Post by TrevorH » 2019/07/28 16:03:06

Then I would make sure you can boot alternative media like the install media in rescue mode then change it and see what happens. If it breaks then boot in rescue mode and change it back.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply