From: Grant <emailgrant@gmail.com>
To: Gentoo mailing list <gentoo-user@lists.gentoo.org>
Subject: Re: [gentoo-user] Rename /dev/nvme0n1 to /dev/sda
Date: Mon, 4 Sep 2017 12:22:40 -0700 [thread overview]
Message-ID: <CAN0CFw2y3UPA15tsdewYsDLn-egjrS0YLgQ=_brA5Z3wFdE3Uw@mail.gmail.com> (raw)
In-Reply-To: <CAJ0EP41Ttb4pxRKm6aJPjnzr31J8bhtiVtUw4forCQObL2Z4Sg@mail.gmail.com>
>>>>>>>> My new laptop uses /dev/nvme0n1 instead of /dev/sda which conflicts
>>>>>>>> with the script I use to manage about 12 similar laptops running
>>>>>>>> Gentoo. Is there a udev method for renaming the disk that will work
>>>>>>>> well with any USB disks that happen to also be attached?
>>>>>>>
>>>>>>> I'm not certain what you mean by that, but I would guess that you want
>>>>>>> the nvme disk to show up as /dev/sda, and the USB disk(s) to show up
>>>>>>> as /dev/sd[b-z].
>>>>>>>
>>>>>>> It is not possible to accomplish this using udev; the kernel owns the
>>>>>>> /dev/sdX device namespace, and will sequentially create devices nodes
>>>>>>> for SCSI-like block devices using that namespace. There is no way to
>>>>>>> change that using a udev rule.
>>>>>>
>>>>>>
>>>>>> Can I rename /dev/sda to /dev/sd[b-z] if it's attached via USB, and
>>>>>> then rename /dev/nvme0n1 to /dev/sda if /dev/nvme0n1 exists?
>>>>>>
>>>>>> Alternatively, can I rename /dev/sda to /dev/sd[b-z] if /dev/sda and
>>>>>> /dev/nvme0n1 exist, and then rename /dev/nvme0n1 to /dev/sda if
>>>>>> /dev/nvme0n1 exists?
>>>>>
>>>>> You might technically be able to do it, but I would guess it would
>>>>> cause some nasty race conditions between the kernel and udev. It's a
>>>>> bad idea.
>>>>
>>>>
>>>> Is it the conditionals that cause this to be a bad idea? Because I
>>>> believe udev has functionality designed to rename devices exactly like
>>>> this.
>>>
>>> udev doesn't provide any functionality to rename device nodes. You can
>>> adjust their permissions, and create symlinks, but there is no direct
>>> way to rename them.
>>
>>
>> I use stuff like this to rename my USB devices and it works perfectly:
>>
>> SUBSYSTEM=="net", ACTION=="add", ENV{ID_NET_NAME_PATH}=="enp0s20u2u1",
>> NAME="net0"
>>
>> Isn't this a true rename of the device node?
>
> Network devices don't have device nodes. They have interface names,
> which are a different concept entirely.
OK I'll take your advice and change the script to detect /dev/nvme0n1.
- Grant
prev parent reply other threads:[~2017-09-04 19:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 16:10 [gentoo-user] Rename /dev/nvme0n1 to /dev/sda Grant
2017-09-02 2:58 ` R0b0t1
2017-09-02 6:48 ` Andrew Savchenko
2017-09-02 13:14 ` Canek Peláez Valdés
2017-09-03 17:59 ` Grant
2017-09-03 18:11 ` Canek Peláez Valdés
2017-09-04 4:26 ` J. Roeleveld
2017-09-04 5:08 ` Canek Peláez Valdés
2017-09-02 14:35 ` Mike Gilbert
2017-09-03 18:11 ` Grant
2017-09-03 22:24 ` Mike Gilbert
2017-09-03 22:41 ` Grant
2017-09-04 1:26 ` Mike Gilbert
2017-09-04 1:38 ` Rich Freeman
2017-09-04 14:58 ` Grant
2017-09-04 15:00 ` Grant
2017-09-04 15:33 ` J. Roeleveld
2017-09-04 15:40 ` Mike Gilbert
2017-09-04 19:22 ` Grant [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN0CFw2y3UPA15tsdewYsDLn-egjrS0YLgQ=_brA5Z3wFdE3Uw@mail.gmail.com' \
--to=emailgrant@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox