1 |
>>>> My new laptop uses /dev/nvme0n1 instead of /dev/sda which conflicts |
2 |
>>>> with the script I use to manage about 12 similar laptops running |
3 |
>>>> Gentoo. Is there a udev method for renaming the disk that will work |
4 |
>>>> well with any USB disks that happen to also be attached? |
5 |
>>> |
6 |
>>> I'm not certain what you mean by that, but I would guess that you want |
7 |
>>> the nvme disk to show up as /dev/sda, and the USB disk(s) to show up |
8 |
>>> as /dev/sd[b-z]. |
9 |
>>> |
10 |
>>> It is not possible to accomplish this using udev; the kernel owns the |
11 |
>>> /dev/sdX device namespace, and will sequentially create devices nodes |
12 |
>>> for SCSI-like block devices using that namespace. There is no way to |
13 |
>>> change that using a udev rule. |
14 |
>> |
15 |
>> |
16 |
>> Can I rename /dev/sda to /dev/sd[b-z] if it's attached via USB, and |
17 |
>> then rename /dev/nvme0n1 to /dev/sda if /dev/nvme0n1 exists? |
18 |
>> |
19 |
>> Alternatively, can I rename /dev/sda to /dev/sd[b-z] if /dev/sda and |
20 |
>> /dev/nvme0n1 exist, and then rename /dev/nvme0n1 to /dev/sda if |
21 |
>> /dev/nvme0n1 exists? |
22 |
> |
23 |
> You might technically be able to do it, but I would guess it would |
24 |
> cause some nasty race conditions between the kernel and udev. It's a |
25 |
> bad idea. |
26 |
|
27 |
|
28 |
Is it the conditionals that cause this to be a bad idea? Because I |
29 |
believe udev has functionality designed to rename devices exactly like |
30 |
this. |
31 |
|
32 |
- Grant |