Thread (11 messages) 11 messages, 3 authors, 2023-03-20

Re: Renaming md raid and moving md raid to a different machine.

From: Ram Ramesh <hidden>
Date: 2023-03-19 23:29:45

On 3/19/23 17:51, Wol wrote:
On 19/03/2023 18:58, Ram Ramesh wrote:
quoted
Hi,

   My primary DVR is old and I need to move it to more recent 
hardware. I have two md raids (a raid1 and another raid6) called 
/dev/md0 and /dev/md1. I plan to have root on the new machine on raid1 
and thus I like to rename my /dev/md0 to /dev/md1 in the old machine 
before I move it to the new machine. After that I want to move the 
disks in the most recommended way to minimize the chance of loss.
Do you have an mdadm.conf, or do the arrays auto-assemble without one?
I have mdadm.conf and each md is named in that file.

ARRAY /dev/md/1 metadata=1.2 name=zym:md1 
UUID=0e9f76b5:4a89171a:a930bccd:78749144
ARRAY /dev/md2  metadata=1.2 name=zym:2 
UUID=d4e30060:d6395b41:dde52d2e:35ffa6fd
quoted
   Since the data is large and usually contains recordings and videos 
that have backup on Hulu/Ultraviolet, I worry less about backup. Still 
it will be big task to repopulate all my data from the source and 
therefore prefer not to do stupid things and loose the data.

  Online search showed me a way to rename using just mdadm.conf and 
that did not work at all. In fact it messed up my raid6 that I had a 
panic for a short time. Luckily, I got everything back working 
normally. So, I am not sure which one of the online instructions to 
follow to rename my /dev/md0 to /dev/md1 before the move. So, I 
thought best to ask here.
Your raid shouldn't be named md0 (md1) at all. By default they now count 
down from md127 (I think ...)
They are named md0, md1, md2 etc because I created them that way, I 
think. Once created, they are entered into mdadm.conf and they keep 
their name.

I usually image copy system disk from old machine to new machine to 
bootstrap the system. Thus mdadm.conf will go there. That is why I 
cannot have /dev/md0 in the old machine as that name is already taken in 
the new machine. Without image copy, it is difficult to get mythtv 
package to keep its database and recordings in order.
If you're going to give it a name, give it a name like "root", or 
"data", or "home". But I've found that very tricky post-facto - it's 
best done when the array is first created.
quoted
   Also, once I renamed /dev/md0 to /dev/md1, I want to move all 6 
disks in raid6 to the new machine. What is the correct procedure so 
that after the movement, I will be able to reboot both the old machine 
without raid6 (ie /dev/md1)and the new machine with the moved disks as 
/dev/md1? Ideally, I like to teach my old machine to forget /dev/md1 
that I want to move and not touch the disks. If I do not do that, I am 
afraid my reboot (of the old machine) will get stuck at some point 
trying to look for the missing disks/md. All online tutorial talks 
about how to assemble on new machine. Does not talk about gracefully 
removing an md from an old machine. I want to know if there is any 
trick to this other than shutting down and pulling all disks and 
rebooting.

   Old host runs debian bullseye (linux 5.19, mdadm v4.1) and new will 
run debian testing/bookworm (linux 6.1,  mdadm v4.2).  Let me know if 
you need anymore information.
Old host, new host ...

Sounds to me like the best way to move the raid would simply be to 
transfer the disks across. The new system should just recognise the 
array. If it doesn't you can just put the disks back in the old system.

What I would NOT do is put the old disks in the new system and then 
build it. Make sure the new system is up and running before you move the 
disks across. (There have been reports of 
installers/updates/stuff-like-that not recognising raids and trashing 
them.)
Ok, I will try this. I am more worried about old host not booting after 
I yank the disks and it does not find them to assemble md that 
mdadm.conf has. I am going to comment out the line for the md (and 
update-initramfs for a good measure) that I plan to transfer. This way, 
I should be safe.
quoted
Thanks and Regards
Ramesh
https://raid.wiki.kernel.org/index.php/Linux_Raid
I thought I looked there first before searching online. I do not believe 
you have any section for renaming md device after its creation.

I also did not find any instructions on how to not assemble array upon 
reboot and leave the component disks untouched. This will make the 
transfer seamless.
Dunno where you looked on-line, but this is the best place. Any 
improvements you think of, let me know.

Cheers,
Wol
Thanks for taking interest in my situation. Just helping me to think 
differently itself is great help and I appreciate that help.

Regards
Ramesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help