LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 09-01-2017, 03:14 AM   #1
sim085
LQ Newbie
 
Registered: Aug 2017
Posts: 6

Rep: Reputation: Disabled
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?
 
Old 09-01-2017, 03:53 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,484

Rep: Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530
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
 
Old 09-01-2017, 04:12 AM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
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.
 
Old 09-01-2017, 05:30 AM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,627

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
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.
 
Old 09-01-2017, 08:05 PM   #5
sim085
LQ Newbie
 
Registered: Aug 2017
Posts: 6

Original Poster
Rep: Reputation: Disabled
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 View Post
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.
 
Old 09-01-2017, 08:30 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,836

Rep: Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370
https://wiki.archlinux.org/index.php..._device_naming

I assume your distro will have some data on these types of naming schemes. What is your distro?

Last edited by jefro; 09-01-2017 at 08:31 PM.
 
Old 09-02-2017, 05:30 AM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
$ 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.
 
Old 09-02-2017, 05:53 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,484

Rep: Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530
Quote:
Originally Posted by sim085 View Post
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).
 
Old 09-02-2017, 09:30 AM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,885

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
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.
 
Old 09-02-2017, 10:56 AM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,547

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by JeremyBoden View Post
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Polipo cache to disk, cannot activate disk caching, different browsers redownload con Trauma Linux - Software 8 12-07-2013 11:13 AM
How to change disk size by editing disk information on the hard disk? xptchina Linux - Virtualization and Cloud 2 12-16-2010 08:12 AM
Problem with freeing disk space on a two hard disk Fedora Core 4 box favadalikhan Linux - Server 1 04-29-2008 09:04 PM
Disk Error with Promise ultra133TX2 Controller and UDMA 120 GB Maxtor Disk samudhanar Linux - Hardware 3 06-13-2006 06:14 PM
floppy only reads first disk, if new disk is inserted data from first disk is shown. lakosked Debian 3 02-18-2006 08:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration