openSUSE 13.2 Laptop HDD device-id changes if usb flash drivesplugged in...

…when booting up OS. I would like to have laptop hdd be always
identified as sda and not as sdb or sdc.

With no usb devices plugged in at boot up, I get correct id as sda
and a Mint 17.1 (hfce) install on another partition works as I would
like it to.

My openSUSE 13.2 OS is KDE x64 and Laptop is a HP ProBook 6550b.
Using Bios mode and openSUSE Grub2 on MBR (triple boot with Win 7
and Mint 17.1). Hdd is standard 2.5" 1 GB x 5400rpm Momentus Sata
type with 4 primary partitions (1 extended where my linux logical
partitions reside on).

Everything seems to work fine regardless of hdd device id but,
IMHO, it is more practical to have a definite sda id for my only
hdd.

Any advice in correcting this hdd id issue would be appreciated.

Cheers,
Peter

I’m not sure if I completely understand you, but your opening post reads like you’re a bit confused about block device naming schemes. The (kernel) device names can change at boot depending on what is connected at the time, and so persistent naming is used to uniquely identify given devices/partitions.

Explained here nicely
https://wiki.archlinux.org/index.php/Persistent_block_device_naming

Not possible in general. Names are assigned sequentially in order devices are discovered. Discovery order is not predictable. That’s why there are multiple links based on various persistent device properties which hopefully remain stable even though kernel name changes.

On 16/12/15 18:06, arvidjaar wrote:
>
> Peter_Abc;2743140 Wrote:
>> …when booting up OS. I would like to have laptop hdd be always
>> identified as sda and not as sdb or sdc.
>
> Not possible in general. Names are assigned sequentially in order
> devices are discovered. Discovery order is not predictable. That’s why
> there are multiple links based on various persistent device properties
> which hopefully remain stable even though kernel name changes.
Thanks for your readvice.ply and

When I am in Mint or my openSuse installs on other (old) laptop,
it always shows my hdd as /dev/sda regardless of what was/is plugged in.
Thus I think this is a strange issue for me.

To clarify what I mean/need, when I do fdisk -l it should show up as
sda. I have used hddtemp to check hdd temperature for years and I just
use the arrow keys with the bash history to do the checks. But
now I have to either use fdisk-l or see what else is plugged in (and
assume it will be ided after usb drives) and then pick the right id to
check. I don’t like it as it is now and does not seem as normal
behaviour, IMHO.

On 16/12/15 18:06, arvidjaar wrote:
>
> Peter_Abc;2743140 Wrote:
>> …when booting up OS. I would like to have laptop hdd be always
>> identified as sda and not as sdb or sdc.
>
> Not possible in general. Names are assigned sequentially in order
> devices are discovered. Discovery order is not predictable. That’s why
> there are multiple links based on various persistent device properties
> which hopefully remain stable even though kernel name changes.
Thanks for your reply and advice. (Fixing a typo in previous post).

On 16/12/15 17:46, deano ferrari wrote:
>
> I’m not sure if I completely understand you, but your opening post reads
> like you’re a bit confused about block device naming schemes. The
> (kernel) device names can change at boot depending on what is connected
> at the time, and so persistent naming is used to uniquely identify given
> devices/partitions.
It is a fresh install and I am pretty sure I took the default settings in
openSUSE 13.2 DVD installation setup (But I had Win 7 issues with the
Grub default install on the extended partition and changed that to MBR
and all is ok now), i.e. fstab is using uuid and and all labelled
partitions show up as such in Dolphin file browser (which is not my
issue here).

> Explained here nicely
> https://wiki.archlinux.org/index.php/Persistent_block_device_naming
I does not help me much in solving my issue and is a bit to technical
for me.

Thanks for your reply and advice.

Cheers,
Peter

It wasn’t provided to solve your issue but to educate you. The /dev/sd* naming is not persistent as you’ve discovered and we’ve tried to explain already, hence the persistent naming schemes that are available.

On 16/12/15 19:46, deano ferrari wrote:
>
> Peter_Abc;2743151 Wrote:
>>
>>> Explained here nicely
>>> https://wiki.archlinux.org/index.php/Persistent_block_device_naming
>> I does not help me much in solving my issue and is a bit to technical
>> for me.
>>
>> Thanks for your reply and advice.
>>
>> Cheers,
>> Peter
> It wasn’t provided to solve your issue but to educate you. The /dev/sd*
> naming is not persistent as you’ve discovered and we’ve tried to explain
> already, hence the persistent naming schemes that are available.

Thanks for the pointers but I am still looking for a simple practical
solution here. Please see if you can help me do that.

I have the fstab entries for Mint and openSUSE below and they both use
uuid and Mint install does what I want and openSUSE does not. How can
we make 13.2 do what Mint does? :slight_smile:

fstab Mint 17.1

<file system> <mount point> <type> <options> <dump> <pass>

/ was on /dev/sda14 during installation

UUID=5d91b96a-668d-40c4-99b2-xxxxxxxxxxxx / ext4 errors=remount-ro 0 1

swap was on /dev/sda5 during installation

UUID=1ad7c4c9-1475-44c7-xxxx-xxxxxxxxxxxx none swap sw 0 0

fstab openSSUSE 13.2
UUID=1ad7c4c9-1475-44c7-b620-xxxxxxxxxxxx swap swap defaults 0 0
UUID=5ced964e-091a-4f73-b4e3-xxxxxxxxxxxx / ext4 acl,user_xattr 1 1
UUID=57663842-8e7e-4039-9b4d-xxxxxxxxxxxx /home ext3 acl,user_xattr 1 2

Cheers,
Peter

PS: I am an openSUSE user since 2007 but looks like I have been copying
the same fstab file (on my older laptop) and have avoided running into
this problem earlier (or I have forgotten if I did). Btw, I am using
fstab option “Device ID” on the other laptop and might try that on this
one and see how it pans out.

UUID is a random number generated when a partition is created used to uniquely mark a partition. It is persistent but may not be if you move partition between drives depending how you move stuff.

Not sure what you want since Mint is using the exact same UUID syntax as openSUSE. Anything that starts with a # is a note not a command

/dev/sdX# naming is NOT persistent it depends on the order that the BIOS sees the drives and is not in any way under control of the OS it is a BIOS function

I have an older laptop. A few years ago, I installed Fedora along with opensuse (I think it was 11.4 at that time).

Fedora saw the hard drive as “/dev/sdb” if there was a USB flash drive, and otherwise saw it as “/dev/sda”. Opensuse did not have that “problem”.

There really isn’t a way to force the device name.

What you instead need to do, is use a permanent name with “hddtemp”.

Here’s an example. On my current system, the partitions on “/dev/sda” have device id of the form:

/dev/disk/by-id/ata-WDC_WD10EZEX-75ZF5A0_WD-WCC1S1730155-part2

where that final digit (“2” in the example) is the partition number.

I can refer to the disk itself as “/dev/disk/by-id/ata-WDC_WD10EZEX-75ZF5A0_WD-WCC1S1730155” (I just removed the “-part2” from the end of the name.

If I use “ls” to check that device identifier, I get:


% ls -l /dev/disk/by-id/ata-WDC_WD10EZEX-75ZF5A0_WD-WCC1S1730155
lrwxrwxrwx 1 root root 9 Dec 14 15:37 /dev/disk/by-id/ata-WDC_WD10EZEX-75ZF5A0_WD-WCC1S1730155 -> ../../sda

so you can see that it is a link to “/dev/sda”. But the device ID path won’t change if a USB is plugged in.

Your solution is to find the appropriate device id, and use that in your “hddtemp” command. Having used it once, you can then go back to using bash history. Or you could create a bash alias or a shell script that uses the device ID.

To find the ID, use the following command:


ls -l /dev/disk/by-id/* | grep -v .-part

then look for the lines that contain “…/…/sda” (or “…/…/sdb” depending on the current name). You may find that there are several possible choices, so just pick one.

You can blacklist usb drivers (at least usb-storage) from being included in initrd. I do not remember whether 13.2 used dracut already or still mkinitrd to give “simple practical advice” :slight_smile:

Thus I think this is a strange issue for me.

It is not. It is absolutely normal.

But
now I have to either use fdisk-l or see what else is plugged in

No, you do not. Have you ever looked under /dev/disk/by-* directories? Those links are based on various disk or filesystem properties that are usually stable.

I don’t like it as it is now and does not seem as normal
behaviour, IMHO.

You have to accept that not everything that you do not like is not normal.

On 17/12/15 04:46, arvidjaar wrote:
> Peter_Abc;2743147 Wrote:
>> >
>> >
>> >When I am in Mint or my openSuse installs on other (old) laptop,
>> >it always shows my hdd as /dev/sda regardless of what was/is plugged in.
> You can blacklist usb drivers (at least usb-storage) from being included
> in initrd. I do not remember whether 13.2 used dracut already or still
> mkinitrd to give “simple practical advice” :slight_smile:
Thanks for your advice, arvidjaar. I thought at first that I might have
stuffed up my install by removing packages I don’t use/like and it is
good to know that it is all " absolutely normal".

>> >Thus I think this is a strange issue for me.
> It is not. It is absolutely normal.
Whilst it may be as you say, I have now “fixed it” (on a new install
on spare partition) by using fstab option “Device Id” in Yast
Partitioner module (exactly as I had in the old laptop installs).
Please advise if there any downsides to this option.

>> >But
>> >now I have to either use fdisk-l or see what else is plugged in
> No, you do not. Have you ever looked under /dev/disk/by-* directories?
> Those links are based on various disk or filesystem properties that are
> usually stable.
I did and /dev/disk/by-id has about six + versions of each partition and
I was not sure which one to use.

>> >I don’t like it as it is now and does not seem as normal
>> >behaviour, IMHO.
> You have to accept that not everything that you do not like is not
> normal.
True but now I think I can have a win here. :slight_smile:

Cheers,
Peter

All the different ID names are just links to a /dev/sdX# file. (note all things in Linux are files) they are set at run time and because they use persistent drive/partition ID characteristics they are persistent and stable, even if the actual /dev/sdX# file may not be since it comes form the BIOS and the order which it enumerates the drives . You can also use labels but on any given system all labels must be unique to the partition.

On 17/12/15 00:26, gogalthorp wrote:
>
> UUID is a random number generated when a partition is created used to
> uniquely mark a partition. It is persistent but may not be if you move
> partition between drives depending how you move stuff.
>
> Not sure what you want since Mint is using the exact same UUID syntax as
> openSUSE. Anything that starts with a # is a note not a command
>
> /dev/sdX# naming is NOT persistent it depends on the order that the BIOS
> sees the drives and is not in any way under control of the OS it is a
> BIOS function

Sorry for not responding earlier but I was busy and any spare time I had
I used to try out a couple of OS installs.

I did an extra openSUSE 13.2 install and I (thought I) had it working
as I wanted but could have been a timing issue (I installed Grub2 on
/ partition as I did not see an option not to install) and it might
have been looping through the other Grub install config settings (I
noticed that it had altered /etc/default/grub). Anyhow, once I
installed (thinking I found the solution/workaround) Grub2 to MBR from
there, it did the same as the first one. I since upgraded (via zypper
dup) to Leap 42.1 but it is the same story with it as well (though I
now can try it out/get familiar with it).

Secondly, I went into the laptop bios previously and disabled ALL
boot options except hdd and I still got the usb sticks/4g modem (with
and without micro sc card) recognised before hdd in 13.2.

Lastly, I just installed Centos 6.5 (without any boot manager) and it
always (I did 4 or 5 reboots) shows hdd as sda. It too is using uuids
in the fstab.

I think I will leave it at this and just live with it (except for my 4g
modem, I don’t normally have usb sticks plugged in very often).

Thanks to everyone that responded and tried to help me to understand
the issue and find a workaround. I appreciate your efforts and I read
the forums regularly and pick up a lot of tips and solutions from here.

Cheers,
Peter

On 16/12/15 18:06, arvidjaar wrote:
>
> Peter_Abc;2743140 Wrote:
>> …when booting up OS. I would like to have laptop hdd be always
>> identified as sda and not as sdb or sdc.
>
> Not possible in general. Names are assigned sequentially in order
> devices are discovered. Discovery order is not predictable. That’s why
> there are multiple links based on various persistent device properties
> which hopefully remain stable even though kernel name changes.

Hi arvidjaar,
I would like to report that I am now getting consistent /dev/sda id on
my single mbr hdd on this laptop regardless of how many usb sticks are
plugged in at boot time.

Not long after the discussion in this thread ended, I discovered a
simple workaround by plugging in a usb hub (later I semi-permanently
attached a monitor with USB hub built-in) and I was happy enough with
that. But now I have just recently discovered that I don’t need this
workaround any more. I am not sure what the fix was but the only thing
different to previous tests is that my Grub2 is now installed on the
Extended (Sda3) partition (which is also set as active) and numerous
system updates.

Cheers