[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mdadm -localhost problem



On Tue, Sep 4, 2012 at 2:45 PM, Ross Boylan <ross@biostat.ucsf.edu> wrote:
>
> Summary
>
> mdadm on squeeze rewrites the UUID I give it with the localhost, even
> if I do not specify localhost. I am trying to repair a RAID for use
> on lenny with an existing UUID. Is there a way to avoid the rewrite?
>
> Details
>
> A lenny host has two virtual machines, VM1 (lenny) and VM2 (squeeze).
> There are two virtual disks, VD0 and VD1, whose 3rd partition forms
> RAID1 (md1), intended for VM1. That same partition was in a RAID
> before, but I grew it and so there is no RAID superblock near the end
> anymore. I need to recreate the superblock without zapping the good data
> on the partition.
>
> From VM2:
> # mdadm --create /dev/md1 --uuid=6f05ff4e:b4d49c1f:7fa21d88:ad0c50a9
> --metadata=0.90 --level=mirror --raid-devices=2 /dev/sdb3 missing
> mdadm: array /dev/md1 started.
> # mdadm --examine /dev/sdb3
> /dev/sdb3:
> Magic : a92b4efc
> Version : 0.90.00
> UUID : 6f05ff4e:b4d49c1f:f1c4dd81:d9ca9b38 (local to host
> squeeze00)
>
> The man appears to say the UUID specified on the command line should
> govern(*), but it doesn't.
>
> Some possible fixes:
>
> 1) Get mdadm to use the UUID I specify.
>
> 2) Use the new UUID and edit the mdadm.conf for VM1 to match. Do I need
> to update the initramfs, and if so how? And will VM1 accept the new
> UUID, or do its own rewriting with its own hostname?
>
> 3) Use mdadm from the (lenny) host system, since the localhost stuff is
> new in squeeze. I don't know how to access the virtual disks outside of
> a VM to do this.
>
> 4) Find an appropriate rescue system image for lenny, start it in a VM,
> and run mdadm from there. I wonder if stopping VM1's startup while it's
> still in the initrd would be enough.
>
> (*) from man mdadm on squeeze:
>
> Also, using --uuid= when creating a v0.90 array will silently
> override any --homehost= setting.
>
> Technically I didn't specify --homehost; maybe I should try that in
> order to get the host ignored!

1) "I do not specify localhost" and "since the localhost stuff": you
must mean "homehost".

2) Once you recreate the metadata and update "mdadm.conf", run
"update-initramfs -u -k $(uname -r)" will update the initrd of the
current kernel using the hooks in
"/usr/share/initramfs-tools/hooks/mdadm".

3) I've never had to recreate the metadata of a running mdraid array
but I'm curious as to whether it's possible without being booted from
an initramfs or a live CD and runnning "mdadm --create ..." from
there.

4) For metadata v0.9, the hostname's hashed and included in the UUID.
The "homehost" corresponds to the "HOMEHOST" value in "mdadm.conf" and
it's "<system>" by default (which points to the hostname of the
system); unless you override it with "--homehost=..." when running
"mdadm --create ...". I have no idea how passing both "--uuid" and
"--homehost" when creating/assembling a v0.9 array will turn out,
sorry.


Reply to: