On Sun, Sep 3, 2017 at 7:59 PM, Grant <emailgr...@gmail.com> wrote: > > >> My new laptop uses /dev/nvme0n1 instead of /dev/sda which conflicts > >> with the script I use to manage about 12 similar laptops running > >> Gentoo. Is there a udev method for renaming the disk that will work > >> well with any USB disks that happen to also be attached? > >> > >> crw------- 1 root root 252, 0 Aug 31 11:34 /dev/nvme0 > >> brw-rw---- 1 root disk 259, 0 Aug 31 11:34 /dev/nvme0n1 > >> brw-rw---- 1 root disk 259, 1 Aug 31 11:34 /dev/nvme0n1p1 > >> brw-rw---- 1 root disk 259, 2 Aug 31 11:34 /dev/nvme0n1p2 > > > > Isn't so much easier to use labels? Those are automatically available on > > /dev/disk/by-label, and you can use them in basically any type of partition, > > including Windows (NTFS and vfat) and swaps. > > > Do labels work with root= in grub and stuff like dd, fdisk, and mkfs?
The label by itself works at boot since it's just another kernel parameter; for example in my latop (that uses NVME, by the way) uses the following in the kernel command line: "root=LABEL=Dell". For all the other utilities you mention the label by itself probably doesn't work, but the links in /dev/disk/by-label are just symlinks to the corresponding disks and partitions, so every single Unix utility works with them. My links are like so: dell ~ # ll /dev/disk/by-label/ total 0 lrwxrwxrwx 1 root root 15 Aug 29 06:20 Dell -> ../../nvme0n1p2 lrwxrwxrwx 1 root root 15 Aug 29 06:20 EFI -> ../../nvme0n1p1 lrwxrwxrwx 1 root root 15 Aug 29 06:20 Swap -> ../../nvme0n1p3 And so /dev/disk/by-label/Dell is just the second partition of the first NVME disk (or chip, or wathever). They work with anything, execept with fdisk because there are no labels for whole disks, only for partitions. Regards. -- Dr. Canek Peláez Valdés Profesor de Carrera Asociado C Departamento de Matemáticas Facultad de Ciencias Universidad Nacional Autónoma de México