Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-01-2017, 04:14 AM
|
#1
|
LQ Newbie
Registered: Aug 2017
Posts: 6
Rep:
|
Name of disk
Hello, when I use fdisk -l I get a list of all disks currently plugged in. These disks are given names such as /dev/sda, /dev/sdb, /dev/sdc, etc... However I noticed that the same disk does not always come with the same name, for example I have an 80GB disk which sometimes comes up as /dev/sdd, and sometimes as /dev/sde,
Is this normal? What determines the name given to a drive?
Also is there a better method than looking at the size of the disk to determine which name corresponds to which physical disk?
|
|
|
09-01-2017, 04:53 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,271
|
yes, most probably it is normal.
The detection process itself will give the names, this reflects to the order of the detection.
You can name your partitions, and you can use partitions by their names or by their uuids. They will not be changed at all.
see /dev/disk
|
|
|
09-01-2017, 05:12 AM
|
#3
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
Normal == Yes
It's kind of determined by which powers up first and gets recognized by the OS. I have an older system with PATA and SATA drives and the /dev/ names flip flop all the time. So use LABELs or UUIDs in your /etc/fstab and bootloader.
|
|
|
09-01-2017, 06:30 AM
|
#4
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,468
|
Quote:
Also is there a better method than looking at the size of the disk to determine which name corresponds to which physical disk?
|
Try running 'blkid' with root privileges.
|
|
|
09-01-2017, 09:05 PM
|
#5
|
LQ Newbie
Registered: Aug 2017
Posts: 6
Original Poster
Rep:
|
I formatted all my disks and deleted all partitions, how can I force the OS to always recognise my Toshiba disk as /dev/sda and my WD disks as /dev/sdb, etc?
Is there an example I can follow?
Quote:
Originally Posted by Shadow_7
Normal == Yes
It's kind of determined by which powers up first and gets recognized by the OS. I have an older system with PATA and SATA drives and the /dev/ names flip flop all the time. So use LABELs or UUIDs in your /etc/fstab and bootloader.
|
|
|
|
09-02-2017, 06:30 AM
|
#7
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
$ cat /etc/fstab
Code:
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
UUID=22222222-2222-2222-2222-222222222222 / ext4 defaults,noatime 0 1
$ cat /boot/grub/grub.cfg | grep UUID
Code:
linux /boot/vmlinuz-linux root=UUID=22222222-2222-2222-2222-222222222222 acpi=force acpi_backlight=vendor modeset
Various means to "customize" your UUIDs. tune2fs, xfs_admin, ... Or set it at the point of creation. I tend to use a YYYYMMDD-HH00-PPPP-PPPP-PPPPPPPPPPPP format where YYYY is year, M month, D day, H hour, and P is the partition number. It makes it easier to type if I have to type it manually in grub.cfg or from grubs command line mode "c". Plus a visual reference of how LONG AGO I did this install. Basically replace /dev/AAA# with a UUID=..., as long as the fstab and boot loader know what's up, it just works. Caveat, install grub AFTER you setup /etc/fstab. Or you might find yourself updating grub.cfg a bit too much manually. And re-install grub if you change the UUID.
As far as customizing /dev/ names to device, udev kind of does that. But if you can't boot linux in the first place, you don't get to udev to customize things. So relatively useless for booting names.
|
|
|
09-02-2017, 06:53 AM
|
#8
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,271
|
Quote:
Originally Posted by sim085
I formatted all my disks and deleted all partitions, how can I force the OS to always recognise my Toshiba disk as /dev/sda and my WD disks as /dev/sdb, etc?
Is there an example I can follow?
|
we were trying to explain, it is not possible, you need to use UUID or labels instead of /dev/sda /dev/sdb ...
But probably there is a way (I don't know about).
|
|
|
09-02-2017, 10:30 AM
|
#9
|
Senior Member
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950
|
Usually sda corresponds to SATA1, sdb corresponds to SATA2 etc.
But it's not gauranteed.
Code:
ls -l /dev/disk/by-uuid
should give something like
Code:
lrwxrwxrwx 1 root root 10 Sep 2 12:09 11169433-051f-4b3b-bd05-7c31c85f0d47 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Sep 2 12:09 2549555d-63e6-48fc-b2d1-3072ef81c4d6 -> ../../sda4
lrwxrwxrwx 1 root root 10 Sep 2 12:09 5A8C-B187 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 2 12:09 7081860c-6dd6-41d2-9fdb-0734b73b8c47 -> ../../sdb3
lrwxrwxrwx 1 root root 10 Sep 2 12:09 7197cd12-815e-4190-b552-c3d6c0c2f24c -> ../../sda2
lrwxrwxrwx 1 root root 10 Sep 2 12:09 91B7-FE06 -> ../../sda1
lrwxrwxrwx 1 root root 10 Sep 2 12:09 b554d17c-7d66-477b-b8a2-1e0233ef1329 -> ../../sda3
lrwxrwxrwx 1 root root 10 Sep 2 12:09 fd2d39a7-5feb-48c5-ad61-a1a361e18bd8 -> ../../sda5
Note that UUID's are given in UUID sequence & that UUID's of FAT partitions are much shorter.
|
|
|
09-02-2017, 11:56 AM
|
#10
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
Quote:
Originally Posted by JeremyBoden
Usually sda corresponds to SATA1, sdb corresponds to SATA2 etc.
But it's not gauranteed.
|
And, it can change just because you happened to have a USB drive connected while booting. It's just not reliable, and can bite you in very bad ways (e.g., booting with your backup drive connected and then writing to the wrong drive because the drive designations were different from usual).
|
|
|
All times are GMT -5. The time now is 12:35 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|