Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Make /dev/sda point to /dev/nvme0n1?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Thu Aug 31, 2017 3:26 pm    Post subject: Make /dev/sda point to /dev/nvme0n1? Reply with quote

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
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Thu Aug 31, 2017 6:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Thu Aug 31, 2017 6:56 pm    Post subject: Reply with quote

Better alias it.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Thu Aug 31, 2017 7:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Thu Aug 31, 2017 7:35 pm    Post subject: Reply with quote

I don't know, it was just an idea. You could create a symlink, they work reliably for /dev/sr*, so why not /dev/sd*. Or you could create udev rule and rename your device to sda.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Thu Aug 31, 2017 10:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Fri Sep 01, 2017 6:10 am    Post subject: Reply with quote

As DONAHUE says:
DONAHUE wrote:
...and/or use LABEL and PARTLABEL to work around the problem.

See https://wiki.gentoo.org/wiki/Removable_media.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri Sep 01, 2017 9:53 am    Post subject: Reply with quote

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
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Fri Sep 01, 2017 2:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri Sep 01, 2017 6:06 pm    Post subject: Reply with quote

Why not use /dev/disk/by-label/?
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Fri Sep 01, 2017 10:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum