View previous topic :: View next topic |
Author |
Message |
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Thu Aug 31, 2017 3:26 pm Post subject: Make /dev/sda point to /dev/nvme0n1? |
|
|
My new laptop uses /dev/nvme0n1 instead of /dev/sda but in order to use my management script (which I use across a lot of Gentoo systems), I need to be able to address the disk as /dev/sda. Can I make /dev/sda point to /dev/nvme0n1 such that low-level tools like /etc/fstab will make the connection? |
|
Back to top |
|
|
DONAHUE Watchman
Joined: 09 Dec 2006 Posts: 7651 Location: Goose Creek SC
|
Posted: Thu Aug 31, 2017 6:54 pm Post subject: |
|
|
If there is another (or more) non-nvme disk on the machine the /dev/sda designation will be assigned already. _________________ Defund the FCC. |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Thu Aug 31, 2017 7:15 pm Post subject: |
|
|
There is no other disk in the machine and I can confirm no /dev/sd* at all.
Also don't want to run into trouble when I plug in a USB stick.
How can I alias it? |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
DONAHUE Watchman
Joined: 09 Dec 2006 Posts: 7651 Location: Goose Creek SC
|
Posted: Thu Aug 31, 2017 10:49 pm Post subject: |
|
|
Quote: | Also don't want to run into trouble when I plug in a USB stick. | USB plugged in after the nvme is renamed/symlinked as sda might not be a problem. If a usb flash drive is in at boot time it will be /dev/sda.
I'd try adding some if-then type code to the script and/or use LABEL and PARTLABEL to work around the problem. _________________ Defund the FCC. |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Fri Sep 01, 2017 9:53 am Post subject: |
|
|
I would consider using a udev rule to create the SDA node, this way the machine needed to legitimately make SDA it would caused sdb _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Fri Sep 01, 2017 2:04 pm Post subject: |
|
|
Instead of /dev/sda why not symlink to some higher disk letter that will not be reached with all sata ports and usb ports used? After all, 26 letters are available. I like /dev/sdn since it includes a hint to the NVME drive. As the fourteenth letter, that accommodates 8 SATA drives and 5 USB sticks. If you use a udev rule, it doesn't conflict with any kernel assigned name. You don't have to boot from sda. On my dualboot machine, Gentoo boots from /dev/sdb. You might have to use the nvme name on the kernel line in grub or whatever, but by the time /etc/fstab is consulted, the /dev/sdn name will be valid.
EDIT: I forgot your script. Can it be modified to accept either sda or sdn? Perhaps try sdn and fallback to sda. Something like "if exists /dev/sdn else ..." Of course you could do that with the navme name too. The third alternative is to find the spot in the kernel where the letters are assigned (I found that once) and patch it to start with sdb instead of sda, thus reserving sda for your symlink. UUID would require modifying your script a lot more wouldn't it? |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Fri Sep 01, 2017 6:06 pm Post subject: |
|
|
Why not use /dev/disk/by-label/? |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Fri Sep 01, 2017 10:59 pm Post subject: |
|
|
Can anyone point me in the right direction for having udev rename /dev/nvme0n1 to /dev/sda? I use this for USB network devices which works great:
Code: | SUBSYSTEM=="net", ACTION=="add", ENV{ID_NET_NAME_PATH}=="enp0s20f0u1u1u1", NAME="net0" |
This didn't seem to do it:
Code: | SUBSYSTEM=="block", ACTION=="add", KERNEL=="nvme0n1", NAME="sda" |
|
|
Back to top |
|
|
|