999
submitted 4 months ago by [email protected] to c/[email protected]
top 50 comments
sorted by: hot top controversial new old
[-] [email protected] 174 points 4 months ago* (last edited 4 months ago)

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 4 months ago

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] 9 points 4 months ago

Labels are better. IMO; they're semantic.

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

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 4 months ago

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 4 months ago

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

[-] [email protected] 10 points 4 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] 29 points 4 months ago

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] 10 points 4 months ago

I could have RTFM but you guys are more fun.

load more comments (3 replies)
[-] [email protected] 6 points 4 months ago

No. Since each partition gets its own UUID, it means it's generated by the OS on creation, no matter the number of partitions. On boot kernel will scan all UUIDs and then mount and map according to them, which is sightly less efficient method than naming block device directly, but far easier for humans and allows you to throw your drives to whichever port you like.

load more comments (3 replies)
[-] JasonDJ 15 points 4 months ago* (last edited 4 months ago)

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 4 months ago

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 4 months ago* (last edited 4 months ago)

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] 101 points 4 months ago* (last edited 4 months ago)

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 4 months ago

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

[-] stoy 15 points 4 months ago

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 4 months ago

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

[-] [email protected] 59 points 4 months ago

thats a reason to use the uuid in the fstab

[-] [email protected] 11 points 4 months ago* (last edited 4 months ago)

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] 79 points 4 months ago* (last edited 4 months ago)

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] 34 points 4 months ago

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

[-] [email protected] 23 points 4 months ago* (last edited 4 months ago)

I can't chill ever

It's a curse

[-] [email protected] 9 points 4 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 4 months ago

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 4 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 4 months ago
load more comments (11 replies)
[-] [email protected] 57 points 4 months ago
[-] [email protected] 27 points 4 months ago* (last edited 4 months ago)

mmcblkxpy
(SD Card)

x = device number
y = partition number

[-] [email protected] 16 points 4 months ago

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] 57 points 4 months ago* (last edited 4 months ago)

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 4 months ago

So, EMMC is even worse

[-] [email protected] 51 points 4 months ago

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

load more comments (3 replies)
[-] [email protected] 46 points 4 months ago
[-] [email protected] 26 points 4 months ago

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 4 months ago

Different bus, different naming.

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

[-] [email protected] 9 points 4 months ago

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 4 months ago

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] 28 points 4 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 4 months ago

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

[-] [email protected] 25 points 4 months ago

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 :(

[-] [email protected] 11 points 4 months ago

Raises a glass in Debian 3.0

load more comments (2 replies)
[-] [email protected] 9 points 4 months ago

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] 8 points 4 months ago

Shouldn't that be

hdX, sdX, and nvmewtfisthisp1

load more comments (3 replies)
[-] [email protected] 8 points 4 months ago

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 (2 replies)
[-] [email protected] 7 points 4 months ago

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

[-] [email protected] 6 points 4 months ago

Also I'm quite sure /dev/hdx is a thing

load more comments (1 replies)
load more comments
view more: next ›
this post was submitted on 15 Mar 2024
999 points (97.3% liked)

linuxmemes

19849 readers
913 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