Skip to contentSkip to conversation

Request for help with "1st time through" RAID array renaming

DISCUSSION [email protected] 2 participants 5 messages Aug 14, 2013 – Aug 16, 2013 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi all!

I inherited a bunch of servers with RAID arrays. I'm doing a bunch of housekeeping/cleanup, documentation, etc.

In this step I want to get RAID array naming straightened out.

I read the mdadm manpage for

	[create, build, grow]
	-N, --name=

and I _think_ that to set an array name, and also to REname it?, I need to do

	sudo mdadm --assemble <array device> --name=NewName
	--update=OldName <array's drives>

I'm a bit sketchy on the exact steps to do that though. Well, the exact steps to do that AND to NOT! screw things up!

Do I have to boot from a different disk, unmounting the arrays? Disassembling them? etc?

I'd like to learn how to do this right.

Here's an example of what's running on one server. The OS is Opensuse.

	uname -a
		Linux arieltest.local 3.7.10-1.16-desktop #1 SMP PREEMPT
		Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64
		x86_64 GNU/Linux
	rpm -q mdadm
		mdadm-3.2.6-3.4.1.x86_64

Its got three arrays attached.

	v0.90 RAID-1  <-- "/boot"
	v1.00 RAID-1  <-- ROOT
	v1.02 RAID-10 <-- storage

I can't say why these were configured that way (that admin's long gone :-( ). Once I get things all cleaned up around here, I'll start with a next-gen plan from scratch. But for the time being, this is what I'm working with.

This system boots OK. The arrays report as

	mdadm --detail --scan
	  ARRAY /dev/md0         metadata=0.90                
	  UUID=xxx...
	  ARRAY /dev/md126       metadata=1.00 name=Rescue:1  
	  UUID=yyy...
	  ARRAY /dev/md2         metadata=1.02 name=server:md2
	  UUID=zzz...

	mdadm -D -s
	  ARRAY /dev/md0         metadata=0.90                
	  UUID=xxx...
	  ARRAY /dev/md/Rescue:1 metadata=1.0  name=Rescue:1  
	  UUID=yyy...
	  ARRAY /dev/md2         metadata=1.2  name=server:md2
	  UUID=zzz...

Not sure why the devices are different between the two, or if that's a problem.

The config file is

	cat /etc/mdadm.conf
		CREATE owner=root group=disk mode=0660 auto=yes
		DEVICE /dev/disk/by-id/ata-[DISK1]-part2
		/dev/disk/by-id/[DISK2]-part2
		DEVICE /dev/disk/by-id/ata-[DISK1]-part1
		/dev/disk/by-id/[DISK2]-part1 
		DEVICE /dev/disk/by-id/ata-[DISK3]-part1
		/dev/disk/by-id/ata-[DISK4]-part1
		/dev/disk/by-id/ata-[DISK5]-part1
		/dev/disk/by-id/ata-[DISK6]-part1
		ARRAY /dev/md0  level=raid1  num-devices=2 metadata=0.90
		UUID=xxx...
		ARRAY /dev/md1  level=raid1  num-devices=2 metadata=1.00
		UUID=yyy...
		ARRAY /dev/md2  level=raid10 num-devices=4 metadata=1.02
		name=server:md2 UUID=zzz...

I want to end up with

	boot ARRAY,    device == /dev/md0, name == server1_boot
	ROOT ARRAY,    device == /dev/md1, name == server1_root
	storage ARRAY, device == /dev/md2, name == server1_storage

and have

	mdadm --detail --scan
	mdadm -D -s

both report a consistent story.

To "get there", I need to 1st boot from another drive, right? Like a LiveCD, and -- at least -- unmount the arrays?

Do I need to 'break' or disassemble them?

Guess I'm looking for a little hand-holding on this once through.

Thanks a lot for any help!

Ariel

#1 lore raw

Doing 'my homework', to my read, this is what I think needs to be done. Am I right?

In general

(1) Boot from a LiveCD
(2) stop the arrays
(3) make changes

The details should look like this.

1st checking

	cat /proc/mdstat  | grep ^md
		md0 : active raid1 sda1[0] sdb1[1]
		md1 : active raid1 sdb2[2] sda2[0]
		md2 : active raid10 sdc1[0] sdf1[3] sde1[2] sdd1[1]

??? QUESTION: Why does the 'md1' line refer to "[2]" & "[0]"? Why
is there no "[1]" instead of "[2]"? Is this a problem that needs fixing?

For

	mdadm --detail --scan
		ARRAY /dev/md0         metadata=0.90                
		UUID=xxx...
		ARRAY /dev/md/Rescue:1 metadata=1.0  name=Rescue:1  
		UUID=yyy...
		ARRAY /dev/md2         metadata=1.2  name=server:md2
		UUID=zzz...

I'd do this?

	mdadm --stop /dev/md0
	mdadm --stop /dev/md/Rescue:1
	mdadm --stop /dev/md2

	mdadm --uuid=xxx... --update=super-minor --assemble /dev/md0
	/dev/sd[ab]1
	mdadm --uuid=yyy... --update=super-minor --assemble /dev/md1
	/dev/sd[ab]2
	mdadm --uuid=zzz... --update=super-minor --assemble /dev/md2
	/dev/sd[cdef]1

	mdadm --stop /dev/md0
	mdadm --stop /dev/md1
	mdadm --stop /dev/md2

	mdadm --uuid=xxx... --update=name --name=server1_boot   
	--homehost="<none>" --assemble /dev/md0  /dev/sd[ab]1
	mdadm --uuid=yyy... --update=name --name=server1_root   
	--homehost="<none>" --assemble /dev/md1  /dev/sd[ab]2
	mdadm --uuid=zzz... --update=name --name=server1_storage
	--homehost="<none>" --assemble /dev/md2  /dev/sd[cdef]1

Then EDIT

/etc/mdadm.conf
+ HOMEHOST <ignore>

		CREATE owner=root group=disk mode=0660 auto=yes
		DEVICE /dev/disk/by-id/ata-[DISK1]-part2
		/dev/disk/by-id/[DISK2]-part2
		DEVICE /dev/disk/by-id/ata-[DISK1]-part1
		/dev/disk/by-id/[DISK2]-part1
		DEVICE /dev/disk/by-id/ata-[DISK3]-part1
		/dev/disk/by-id/ata-[DISK4]-part1
		/dev/disk/by-id/ata-[DISK5]-part1
		/dev/disk/by-id/ata-[DISK6]-part1

- ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90
UUID=xxx...
- ARRAY /dev/md1 level=raid1 num-devices=2 metadata=1.00
UUID=yyy...
- ARRAY /dev/md2 level=raid10 num-devices=4 metadata=1.02
name=server:md2 UUID=zzz...
+ ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90
name=server1_boot UUID=xxx...
+ ARRAY /dev/md1 level=raid1 num-devices=2 metadata=1.00
name=server1_boot UUID=yyy...
+ ARRAY /dev/md2 level=raid10 num-devices=4 metadata=1.02
name=server1_storage UUID=zzz...

and finally,

mkinitrd
reboot

How's that look?

Ariel

#2 lore raw
Quoted 35 lines · On Wed, 14 Aug 2013 10:27:18 -0700 [email protected] wrote:

Doing 'my homework', to my read, this is what I think needs to be done. Am I right?

In general

(1) Boot from a LiveCD
(2) stop the arrays
(3) make changes

The details should look like this.

1st checking

	cat /proc/mdstat  | grep ^md
		md0 : active raid1 sda1[0] sdb1[1]
		md1 : active raid1 sdb2[2] sda2[0]
		md2 : active raid10 sdc1[0] sdf1[3] sde1[2] sdd1[1]

??? QUESTION: Why does the 'md1' line refer to "[2]" & "[0]"? Why
is there no "[1]" instead of "[2]"? Is this a problem that needs fixing?

For

	mdadm --detail --scan
		ARRAY /dev/md0         metadata=0.90                
		UUID=xxx...
		ARRAY /dev/md/Rescue:1 metadata=1.0  name=Rescue:1  
		UUID=yyy...
		ARRAY /dev/md2         metadata=1.2  name=server:md2
		UUID=zzz...

I'd do this?

Quoted 10 lines
	mdadm --stop /dev/md0
	mdadm --stop /dev/md/Rescue:1
	mdadm --stop /dev/md2

	mdadm --uuid=xxx... --update=super-minor --assemble /dev/md0
	/dev/sd[ab]1
	mdadm --uuid=yyy... --update=super-minor --assemble /dev/md1
	/dev/sd[ab]2
	mdadm --uuid=zzz... --update=super-minor --assemble /dev/md2
	/dev/sd[cdef]1

As the man page says, super-minor is only relevant for 0.90 metadata, and updating it is automatic for 2.6 and later. So this step is not needed.

Quoted 11 lines
	mdadm --stop /dev/md0
	mdadm --stop /dev/md1
	mdadm --stop /dev/md2

	mdadm --uuid=xxx... --update=name --name=server1_boot   
	--homehost="<none>" --assemble /dev/md0  /dev/sd[ab]1
	mdadm --uuid=yyy... --update=name --name=server1_root   
	--homehost="<none>" --assemble /dev/md1  /dev/sd[ab]2
	mdadm --uuid=zzz... --update=name --name=server1_storage
	--homehost="<none>" --assemble /dev/md2  /dev/sd[cdef]1

This should work and do what you expect, though "--assemble" needs to come first.
And if you are explicitly listing the devices (/dev/sd[ab]1), then giving the uuid as well is fairly pointless (though it doesn't hurt).

Quoted 27 lines

Then EDIT

/etc/mdadm.conf
+ HOMEHOST <ignore>

		CREATE owner=root group=disk mode=0660 auto=yes
		DEVICE /dev/disk/by-id/ata-[DISK1]-part2
		/dev/disk/by-id/[DISK2]-part2
		DEVICE /dev/disk/by-id/ata-[DISK1]-part1
		/dev/disk/by-id/[DISK2]-part1
		DEVICE /dev/disk/by-id/ata-[DISK3]-part1
		/dev/disk/by-id/ata-[DISK4]-part1
		/dev/disk/by-id/ata-[DISK5]-part1
		/dev/disk/by-id/ata-[DISK6]-part1

- ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90
UUID=xxx...
- ARRAY /dev/md1 level=raid1 num-devices=2 metadata=1.00
UUID=yyy...
- ARRAY /dev/md2 level=raid10 num-devices=4 metadata=1.02
name=server:md2 UUID=zzz...
+ ARRAY /dev/md0 level=raid1 num-devices=2 metadata=0.90
name=server1_boot UUID=xxx...
+ ARRAY /dev/md1 level=raid1 num-devices=2 metadata=1.00
name=server1_boot UUID=yyy...
+ ARRAY /dev/md2 level=raid10 num-devices=4 metadata=1.02
name=server1_storage UUID=zzz...

Quoted 6 lines

and finally,

mkinitrd
reboot

How's that look?

Mostly good.

NeilBrown

Quoted 6 lines

Ariel
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Neil

Quoted 2 lines

As the man page says, super-minor is only relevant for 0.90 metadata, and updating it is automatic for 2.6 and later. So this step is not needed.

Okay. I wan't sure what that meant :-/

Quoted 9 lines
Quoted 6 lines
	mdadm --uuid=xxx... --update=name --name=server1_boot   
	--homehost="<none>" --assemble /dev/md0  /dev/sd[ab]1
	mdadm --uuid=yyy... --update=name --name=server1_root   
	--homehost="<none>" --assemble /dev/md1  /dev/sd[ab]2
	mdadm --uuid=zzz... --update=name --name=server1_storage
	--homehost="<none>" --assemble /dev/md2  /dev/sd[cdef]1

This should work and do what you expect, though "--assemble" needs to come first.

Yeah, I got that figured out :-) Need to set the mode.

Quoted 2 lines

And if you are explicitly listing the devices (/dev/sd[ab]1), then giving the uuid as well is fairly pointless (though it doesn't hurt).

Now that I think about it, makes sense.

Quoted 2 lines
Quoted 1 line

How's that look?

Mostly good.

Okay. So I took a swipe at it with the corrections you suggested.

After mkinitrd and shutdown -r now I've now gotten an "md127" in there?

	cat /proc/mdstat | grep md
		md0 :   active raid1  sda1[0] sdb1[1]
		md127 : active raid1  sda2[0] sdb2[2]
		md2 :   active raid10 sdc1[0] sdf1[3] sde1[2] sdd1[1]

	mdadm -D -s
		ARRAY /dev/md0   metadata=0.90                          
		 UUID=xxx
		ARRAY /dev/md127 metadata=1.0  name=<none>:server_root  
		 UUID=yyy
		ARRAY /dev/md2   metadata=1.2 
		name=<none>:server_storage UUID=zzz

Where my

cat /etc/mdadm.conf

	...
	HOMEHOST <ignore>
	ARRAY /dev/md0 level=raid1  num-devices=2 metadata=0.90         
	                  UUID=xxx
	ARRAY /dev/md1 level=raid1  num-devices=2 metadata=1.00
	name=<none>:server_root    UUID=yyy
	ARRAY /dev/md2 level=raid10 num-devices=4 metadata=1.02
	name=<none>:server_storage UUID=zzz

So the process seems to NOT blow things up. That's filed away now!

And, "/dev/md0" and "/dev/md2" seem to be properly named/reporting in the mdadm, but not "/dev/md1".

Did I screw up the mdadm.conf? And SHOULD I have set a HOMEHOST to begin with ? (Fuzzy on when that's useful)

Ariel

#4 lore raw

I've tried redoing this a bunch of times, and just can't get the naming to behave in an organized, predictable way.

Is this broken, and I'm spinning my wheels? Or, more likely, am I still doing something wrong here?

Ariel