linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Raid array name by mdadm
@ 2015-10-28 18:43 Sheng Yang
  2015-10-28 19:56 ` Dragan Milivojević
  0 siblings, 1 reply; 5+ messages in thread
From: Sheng Yang @ 2015-10-28 18:43 UTC (permalink / raw)
  To: linux-raid

Hi guys,

I am trying to find a way to make mdadm create /dev/md/<devicename>
instead of /dev/mdnn only. I found it seems possible from the manual
of mdadm(http://linux.die.net/man/8/mdadm). It said:

If the md device name is in a 'standard' format as described in DEVICE
NAMES, then it will be created, if necessary, with the appropriate
device number based on that name. If the device name is not in one of
these formats, then a unused device number will be allocated. The
device number will be considered unused if there is no active array
for that number, and there is no entry in /dev for that number and
with a non-standard name. Names that are not in 'standard' format are
only allowed in "/dev/md/".

I tried to create a raid using:

# mdadm --create device-123 --verbose --level=mirror --raid-devices=2
--name=device-123 /dev/sda /dev/sdb
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/device-123 started.

But what I got in the end is only /dev/md127. The directory of
/dev/md/ doesn't exist.

Though the detail showed the correct name

# mdadm --detail --scan
ARRAY /dev/md127 metadata=1.2 name=98abb2346b83:device-123
UUID=6a31df29:adec4bff:e8867610:c0e10723

It's much more convenient if I could use the name of
/dev/md/device-123 instead of /dev/md127. I've tried google for hours
without success.

# mdadm --version
mdadm - v3.3 - 3rd September 2013

If anyone can shed some light on it, I would be appreciate!

Thanks!

--Sheng

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Raid array name by mdadm
  2015-10-28 18:43 Raid array name by mdadm Sheng Yang
@ 2015-10-28 19:56 ` Dragan Milivojević
  2015-10-28 21:40   ` Sheng Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Dragan Milivojević @ 2015-10-28 19:56 UTC (permalink / raw)
  To: Sheng Yang; +Cc: linux-raid

> I tried to create a raid using:
>
> # mdadm --create device-123 --verbose --level=mirror --raid-devices=2
> --name=device-123 /dev/sda /dev/sdb
> mdadm: Defaulting to version 1.2 metadata
> mdadm: array /dev/md/device-123 started.
>
> But what I got in the end is only /dev/md127. The directory of
> /dev/md/ doesn't exist.


try mdadm --create /dev/md/device-123,

for example:

truncate -s 512M disk0
truncate -s 512M disk1

losetup /dev/loop0 disk0
losetup /dev/loop1 disk1

mdadm --create /dev/md/device-123 --verbose --level=mirror
--raid-devices=2 /dev/loop0 /dev/loop1

[root@eos ~]# ll /dev/md/device-123
lrwxrwxrwx 1 root root 8 Oct 28 20:53 /dev/md/device-123 -> ../md127

[root@eos ~]# mdadm --detail --scan
ARRAY /dev/md/device-123 metadata=1.2 name=device-123
UUID=03ba5df7:7c5cc933:367e19ef:384665c5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Raid array name by mdadm
  2015-10-28 19:56 ` Dragan Milivojević
@ 2015-10-28 21:40   ` Sheng Yang
  2015-10-28 22:01     ` Sheng Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Sheng Yang @ 2015-10-28 21:40 UTC (permalink / raw)
  To: Dragan Milivojević; +Cc: linux-raid

On Wed, Oct 28, 2015 at 12:56 PM, Dragan Milivojević
<galileo@pkm-inc.com> wrote:
>> I tried to create a raid using:
>>
>> # mdadm --create device-123 --verbose --level=mirror --raid-devices=2
>> --name=device-123 /dev/sda /dev/sdb
>> mdadm: Defaulting to version 1.2 metadata
>> mdadm: array /dev/md/device-123 started.
>>
>> But what I got in the end is only /dev/md127. The directory of
>> /dev/md/ doesn't exist.
>
>
> try mdadm --create /dev/md/device-123,
>
> for example:
>
> truncate -s 512M disk0
> truncate -s 512M disk1
>
> losetup /dev/loop0 disk0
> losetup /dev/loop1 disk1
>
> mdadm --create /dev/md/device-123 --verbose --level=mirror
> --raid-devices=2 /dev/loop0 /dev/loop1
>
> [root@eos ~]# ll /dev/md/device-123
> lrwxrwxrwx 1 root root 8 Oct 28 20:53 /dev/md/device-123 -> ../md127
>
> [root@eos ~]# mdadm --detail --scan
> ARRAY /dev/md/device-123 metadata=1.2 name=device-123
> UUID=03ba5df7:7c5cc933:367e19ef:384665c5

Thank Dragan! It works!

Seems it's mdadm itself create the link rather than do through kernel,
which gave me a little trouble. :D

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Raid array name by mdadm
  2015-10-28 21:40   ` Sheng Yang
@ 2015-10-28 22:01     ` Sheng Yang
  2015-10-30 12:32       ` Anugraha Sinha
  0 siblings, 1 reply; 5+ messages in thread
From: Sheng Yang @ 2015-10-28 22:01 UTC (permalink / raw)
  To: Dragan Milivojević; +Cc: linux-raid

On Wed, Oct 28, 2015 at 2:40 PM, Sheng Yang <sheng@yasker.org> wrote:
> On Wed, Oct 28, 2015 at 12:56 PM, Dragan Milivojević
> <galileo@pkm-inc.com> wrote:
>>> I tried to create a raid using:
>>>
>>> # mdadm --create device-123 --verbose --level=mirror --raid-devices=2
>>> --name=device-123 /dev/sda /dev/sdb
>>> mdadm: Defaulting to version 1.2 metadata
>>> mdadm: array /dev/md/device-123 started.
>>>
>>> But what I got in the end is only /dev/md127. The directory of
>>> /dev/md/ doesn't exist.
>>
>>
>> try mdadm --create /dev/md/device-123,
>>
>> for example:
>>
>> truncate -s 512M disk0
>> truncate -s 512M disk1
>>
>> losetup /dev/loop0 disk0
>> losetup /dev/loop1 disk1
>>
>> mdadm --create /dev/md/device-123 --verbose --level=mirror
>> --raid-devices=2 /dev/loop0 /dev/loop1
>>
>> [root@eos ~]# ll /dev/md/device-123
>> lrwxrwxrwx 1 root root 8 Oct 28 20:53 /dev/md/device-123 -> ../md127
>>
>> [root@eos ~]# mdadm --detail --scan
>> ARRAY /dev/md/device-123 metadata=1.2 name=device-123
>> UUID=03ba5df7:7c5cc933:367e19ef:384665c5
>
> Thank Dragan! It works!
>
> Seems it's mdadm itself create the link rather than do through kernel,
> which gave me a little trouble. :D

Hi Dragan,

One more question if you don't mind:

When you do

mdadm --stop /dev/md/device-123

Would mdadm remove the broken link file /dev/md/device-123 automatically?

I found I have to remove the link file manually later...

--Sheng
>
> --Sheng
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Raid array name by mdadm
  2015-10-28 22:01     ` Sheng Yang
@ 2015-10-30 12:32       ` Anugraha Sinha
  0 siblings, 0 replies; 5+ messages in thread
From: Anugraha Sinha @ 2015-10-30 12:32 UTC (permalink / raw)
  To: Sheng Yang, Dragan Milivojević; +Cc: linux-raid

Hi Sheng,

On 10/29/2015 7:01 AM, Sheng Yang wrote:
> On Wed, Oct 28, 2015 at 2:40 PM, Sheng Yang <sheng@yasker.org> wrote:
>> On Wed, Oct 28, 2015 at 12:56 PM, Dragan Milivojević
>> <galileo@pkm-inc.com> wrote:
>>> mdadm --create /dev/md/device-123 --verbose --level=mirror
>>> --raid-devices=2 /dev/loop0 /dev/loop1
>>>
>>> [root@eos ~]# ll /dev/md/device-123
>>> lrwxrwxrwx 1 root root 8 Oct 28 20:53 /dev/md/device-123 -> ../md127
>>>
>>> [root@eos ~]# mdadm --detail --scan
>>> ARRAY /dev/md/device-123 metadata=1.2 name=device-123
>>> UUID=03ba5df7:7c5cc933:367e19ef:384665c5
>>
>> Thank Dragan! It works!
>>
>> Seems it's mdadm itself create the link rather than do through kernel,
>> which gave me a little trouble. :D
>
> Hi Dragan,
>
> One more question if you don't mind:
>
> When you do
>
> mdadm --stop /dev/md/device-123
>
> Would mdadm remove the broken link file /dev/md/device-123 automatically?
>
> I found I have to remove the link file manually later...
>

You stopped the array. You might want to assemble it once again saying
mdadm --assemble /dev/md/device-123 /dev/loop0 /dev/loop1
Then, it would just create a new /dev/md*number* and create the link 
with /dev/md/device-123.

This is my logical thought, havent looked at the mdadm code though to 
confirm this.

Regards
Anugraha
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-30 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 18:43 Raid array name by mdadm Sheng Yang
2015-10-28 19:56 ` Dragan Milivojević
2015-10-28 21:40   ` Sheng Yang
2015-10-28 22:01     ` Sheng Yang
2015-10-30 12:32       ` Anugraha Sinha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).