this post was submitted on 15 Mar 2024
992 points (97.2% liked)

linuxmemes

20880 readers
13 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 173 points 7 months ago* (last edited 7 months ago) (6 children)

and you shouldn't be using any of those, since the order can and will change. The numbers are based on the order the devices and device drivers are initialized in, not based on physical location in the system. The modern approach (assuming you're using udev) is to use the symlinks in /dev/disk/by-id/ or /dev/disk/by-uuid/ instead, since both are consistent across reboots (and by-id should be consistent across reinstalls, assuming the same partitioning scheme on the same physical drives)

This is also why Ethernet devices now have names like enp0s3 - the numbers are based on physical location on the bus. The old eth0, eth1, etc. could swap positions between Linux upgrades (or even between reboots) since they were also just the order the drivers were initialized in.

[–] [email protected] 45 points 7 months ago (2 children)

I'm sure you know this, but to to supplement your comment for future readers, UUIDs are also a good solution for partitions.

[–] [email protected] 10 points 7 months ago (1 children)

Labels are better. IMO; they're semantic.

load more comments (1 replies)
[–] [email protected] 8 points 7 months ago (4 children)

I think OP's point was that UUIDs can still change, but the stuff that makes up the /by-id/ names cannot. Granted, those aren't applicable to partitions.

load more comments (4 replies)
[–] [email protected] 17 points 7 months ago (6 children)

Are UUIDs built into the hardware, or something your computer decides on based on the drive's serial number and shit?

[–] [email protected] 33 points 7 months ago (2 children)

Uuids are part of the gpt (table) on the disk.

[–] Supermariofan67 10 points 7 months ago

You're thinking of partuuid, regular uuids are part of the filesystem and made at mkfs time

load more comments (1 replies)
[–] [email protected] 28 points 7 months ago (1 children)

According to Arch Wiki they get generated and stored in the partition when it is formatted. So kinda like labels but automated and with (virtually) no collision risk.

[–] [email protected] 9 points 7 months ago (3 children)

I could have RTFM but you guys are more fun.

load more comments (3 replies)
load more comments (4 replies)
[–] [email protected] 15 points 7 months ago* (last edited 7 months ago) (2 children)

Back in my day, /dev/hda was the primary master, hdb was the primary slave, hdc was the secondary master and hdd was the secondary slave.

Nothing ever changed between reboots. Primary/secondary depended on which port the ribbon cable connected to on the motherboard, and ~~primary/secondary~~ master/slave was configured by a jumper on the drive itself.

load more comments (2 replies)
[–] [email protected] 11 points 7 months ago (3 children)

I have a hatred for the enp id thing as it isn't any better for me. It changes on me every time I add/remove a hard drive or enable/disable the WiFi card in the BIOS. For someone who is building up a server and making changes to it, this becomes a real pain. What happens if a drive dies? Do I have to change the network config yet again over this?

[–] [email protected] 7 points 7 months ago* (last edited 7 months ago) (2 children)

How is that happening? The number on the bus shouldn't change from adding or removing drives. I could imagine this with disabling a card in UEFI / BIOS if that basically stops reporting the bus entry completely. But drives?

Anyhow, if I'm not mistaken, you can assign a fixed name based on the reported MAC.

load more comments (2 replies)
load more comments (2 replies)
load more comments (2 replies)
[–] [email protected] 100 points 7 months ago* (last edited 7 months ago) (5 children)

Well it's sdx because they both use the SATA interface. The sdx convention actually comes from scsi though, and the fact that SATA and USB drives use it might point to some code reuse, or maybe a temporary solution that never got fixed due to breaking backwards compatibility.

Fun fact: IDE drives use the hdx naming convention.

[–] [email protected] 48 points 7 months ago

I still muscle-memory type /dev/hd[TAB] once in a while when looking for storage devices.

[–] [email protected] 15 points 7 months ago (3 children)

I thought they standardized on sd* even for IDE drive a few years back...

load more comments (3 replies)
load more comments (3 replies)
[–] [email protected] 96 points 7 months ago (5 children)

A yes, my beloved nvme1p2 partition that changes name every reboot

[–] [email protected] 59 points 7 months ago (1 children)

thats a reason to use the uuid in the fstab

[–] [email protected] 11 points 7 months ago* (last edited 7 months ago) (9 children)

Anyone else chuckle on the parallel in saying to use the UUID is no different than saying "just hardcore the IP bro"

I'm not hating on you, but it's an extremely flawed system where you are forced to use a direct ID mapping as a reference.

From what I'm understanding from people you can assign an alias to the UUID that sounds better?

load more comments (9 replies)
load more comments (4 replies)
[–] [email protected] 81 points 7 months ago* (last edited 7 months ago) (14 children)

https://wiki.archlinux.org/title/Solid_state_drive/NVMe

Namespaces are the construct in NVMe technology that hold user data. An NVMe controller can have multiple namespaces attached to it. Most NVMe SSDs today just use a single namespace, but multi-tenant applications, virtualization and security have use cases for multiple namespaces.

  device v
/dev/nvme0n1p1 < partition
namespace  ^

There are two types of people: Those who are able to identify gaps in their knowledge and actively seek to fill them... and whatever this meme is.

[–] [email protected] 35 points 7 months ago (4 children)

Dude, chill, it's a funny take on naming conventions.

[–] [email protected] 24 points 7 months ago* (last edited 7 months ago) (2 children)

I can't chill ever

It's a curse

[–] [email protected] 9 points 7 months ago

It's like you're sucking the fun out of us... Wait a minute

load more comments (1 replies)
[–] [email protected] 15 points 7 months ago (3 children)

We can enjoy the meme and also use it as a learning opportunity :)

I for one didn't know about NVMe namespaces.

load more comments (3 replies)
load more comments (2 replies)
[–] [email protected] 10 points 7 months ago

Oh god damn it I came here to look at memes and now I friggin learned something that's going to make my life easier

[–] [email protected] 7 points 7 months ago
[–] [email protected] 7 points 7 months ago

Interesting. I learned something. Again.

load more comments (10 replies)
[–] [email protected] 57 points 7 months ago* (last edited 7 months ago) (1 children)

https://superuser.com/questions/1449499/why-does-linux-list-nvme-drives-as-dev-nvme0-instead-of-dev-sda#1449520

In short; sd stands for SCSI Disk and SSD and USB all use the SCSI protocol. While SD-cards/emmc (flash-on-CPU) are named emmcblkpX for emmc block device, partition X. And NVME have additionally namespaces, which is the nX part.

[–] [email protected] 11 points 7 months ago

So, EMMC is even worse

[–] [email protected] 56 points 7 months ago (6 children)
[–] [email protected] 27 points 7 months ago* (last edited 7 months ago)

mmcblkxpy
(SD Card)

x = device number
y = partition number

[–] [email protected] 16 points 7 months ago (2 children)

NVMe device names follow this pattern: nvme n , where: is an integer that is assigned by Linux during the boot process. The first NVMe device that is detected is assigned 0

load more comments (2 replies)
load more comments (4 replies)
[–] [email protected] 51 points 7 months ago (3 children)

It’s called that because it’s Never the Value you Might Expect.

load more comments (3 replies)
[–] [email protected] 46 points 7 months ago (1 children)
[–] Supermariofan67 26 points 7 months ago (2 children)

That one hasn't been around for a long time, since the Linux kernel started using a SCSI abstraction layer above many of the other storage protocols. Really cool stuff: https://upload.wikimedia.org/wikipedia/commons/thumb/f/fb/The_Linux_Storage_Stack_Diagram.svg/1161px-The_Linux_Storage_Stack_Diagram.svg.png

load more comments (2 replies)
[–] [email protected] 30 points 7 months ago (1 children)

Different bus, different naming.

Now, memory kinda hazy, but weren't ide devices /dev/hdX?

[–] [email protected] 9 points 7 months ago (3 children)

Yeah, they used to be, but they switched a few years back to consistently call all block devices sdx.

load more comments (3 replies)
[–] [email protected] 28 points 7 months ago (2 children)

I'm guessing it's for some shit to make sure some ridiculous setup with two gazillion drives doesn't have conflicts

load more comments (2 replies)
[–] [email protected] 27 points 7 months ago

No one mentioned the Solaris convention yet ?

/dev/cXtXdXsX

The letters mean controller, SCSI target, disk and slice (Solaris equivalent to a partition).

I always thought this was the most elegant naming scheme in the Unix world.

[–] [email protected] 25 points 7 months ago (3 children)

Back in the olden times the Linux kernel had a dedicated parallel-ATA subsystem with /dev/hda devices. It was then rolled up in to the scsi subsystem to simplify maintaining drivers (everything using the same library for disk access). I'm old :(

[–] Tja 11 points 7 months ago

Raises a glass in Debian 3.0

load more comments (2 replies)
[–] [email protected] 25 points 7 months ago

Mine is easy - /dev/nvme[tab][tab][tab]

[–] [email protected] 9 points 7 months ago (5 children)

Kinda miss the Wild West days where you'd recompile and suddenly there'd be a whole new device naming convention.

load more comments (5 replies)
[–] [email protected] 9 points 7 months ago (6 children)

It's a lot better than the system that just randomly throws in your USB drives with your SCSI/SAS/SATA/PATA drives. Or the systems that calls everything a SCSI drive when it usually isn't a SCSI drive.

load more comments (6 replies)
[–] [email protected] 8 points 7 months ago (3 children)

Shouldn't that be

hdX, sdX, and nvmewtfisthisp1

load more comments (3 replies)
[–] [email protected] 7 points 7 months ago (3 children)

You mean Linux? Other Unixes don't necessarily use this naming convention.

load more comments (3 replies)
load more comments
view more: next ›