DaemonForums  

Go Back   DaemonForums > Other Operating Systems > Other BSD and UNIX/UNIX-like

Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 28th January 2023
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 85
Default /dev/sd disk blockdevices randomly ordered at every boot

I've been using Devuan 2 for 4 years and it consistently detected my drives as this:
/dev/sda: primary SSD where the system resides
/dev/sdb: secondary SSD where i back up the system with rsync regularly
/dev/sdc: secondary HDD where i back up the data with rsync regularly
/dev/sdd: primary HDD where the data resides
This order was constant, it never changed. This is the same order as the disks are plugged into the motherboard. Clean, obvious, logical. Working.

A few days ago i've upgraded to Devuan 4 and now the order is entirely random. At every boot.
I tried to check how can i set up a persistent order, but all i found is how to write fstab entries by disk id; but this is not a partition problem, it is a disk blockdevice detecting order problem, it cannot be solved from fstab.

Any tips on this?
Reply With Quote
  #2   (View Single Post)  
Old 29th January 2023
bsd-keith bsd-keith is offline
Real Name: Keith
Open Source Software user
 
Join Date: Jun 2014
Location: Surrey/Hants Border, England
Posts: 348
Default

Drives get labelled as they get found by the O/S on boot up, normally, you use labels or UUID in fstab to mount them at certain points on the filesystem - I don't think it is possible to make them be found in a specific order.
__________________
Linux since 1999, & also a BSD user.
Reply With Quote
  #3   (View Single Post)  
Old 29th January 2023
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 467
Default

Quote:
Originally Posted by TCH View Post
I tried to check how can i set up a persistent order, but all i found is how to write fstab entries by disk id; but this is not a partition problem, it is a disk blockdevice detecting order problem, it cannot be solved from fstab.
It is not a "problem" at all. It is the expected behaviour, as bsd-keith notes.

The block devices are assigned by (e)udev asynchronously so a specific order cannot be guaranteed. I am very surprised that the devices were consistently ordered under Devuan ASCII, that is unusual.

Just use UUIDs, LABELs, PARTUUIDs[1] or PARTLABELs[1] in /etc/fstab, that is the recommended approach.

[1] Only for disks with a GUID partition table.

Last edited by Head_on_a_Stick; 29th January 2023 at 10:05 AM.
Reply With Quote
  #4   (View Single Post)  
Old 29th January 2023
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 85
Default

Guys, you did not get it: this has nothing to do with partitions and fstab; i need the blockdevices in this order!
Reply With Quote
  #5   (View Single Post)  
Old 29th January 2023
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 467
Default

That is not possible. Why do you think you "need" the devices in that order? Why does editing /etc/fstab and substituting UUID=$uuid not solve your problem?
Reply With Quote
  #6   (View Single Post)  
Old 29th January 2023
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 85
Default

Because this has nothing to do with fstab, as i said twice already. I don't even use fstab for backup.

I have a script which mounts the partitions of the two SSD-s and the two HDD-s and rsyncs the alive system and data to the backup ones.
Sure, i could do mounting by UUID-s, but if the partition table is changed, because i rearrange/resize/format them (this happened in the past several time), then the UUIDs are changed and i need to modify the script to change the wired in UUID-s. The same applies for disklabels. As for /dev/disk/by-id/ that only works, until i need to change one of the disks again. (Once one of my backup HDD-s became faulty. No data loss, but the device was needed to be replaced.)

The only method which worked for years is the blockdevices detected by the order of how they are plugged into the motherboard. During that time and with that method it did not matter what changed in the partition table or what device got replaced.

Are you 100% sure, that it is imposible? Because now, that i recall, it was not Devuan 2 only which did it. Debian 8 also did the same for 4 years. Debian 7 for half a year. And Ubuntu 10.04 for 2 years (but without SSD-s).
Reply With Quote
  #7   (View Single Post)  
Old 29th January 2023
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 467
Default

Quote:
Originally Posted by TCH View Post
Sure, i could do mounting by UUID-s, but if the partition table is changed, because i rearrange/resize/format them (this happened in the past several time), then the UUIDs are changed
I think the PARTUUID would be consistent in that case. Needs a GPT disk though but you should be using that anyway because MS-DOS ("MBR" type) partition tables are inferior.

The same PARTUUID can be recreated if you swap a new drive in:
https://bbs.archlinux.org/viewtopic.php?id=215541

Quote:
Originally Posted by TCH View Post
Are you 100% sure, that it is imposible?
Yes but I'm not an expert. Perhaps somebody here will correct me.
Reply With Quote
  #8   (View Single Post)  
Old 29th January 2023
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 85
Default

Quote:
Originally Posted by Head_on_a_Stick View Post
I think the PARTUUID would be consistent in that case.
If a partition is removed, or a device is replaced, it is the same.
Quote:
Originally Posted by Head_on_a_Stick View Post
Needs a GPT disk though but you should be using that anyway because MS-DOS ("MBR" type) partition tables are inferior.
I agree, but unfortunately my SSD-s use the MBR type. Cannot remember why, but IIRC i tried some BSD-s and they did not know the GPT type, just the BSD and MBR.
Quote:
Originally Posted by Head_on_a_Stick View Post
The same PARTUUID can be recreated if you swap a new drive in:
https://bbs.archlinux.org/viewtopic.php?id=215541
Thanks, but if i have to change things after modification anyway, then it is more easier to simply change the UUID-s in the script...
Reply With Quote
  #9   (View Single Post)  
Old 3rd February 2023
TCH TCH is offline
Shell Scout
 
Join Date: Mar 2017
Posts: 85
Default

In the end, partition labels was chosen for solution: https://dev1galaxy.org/viewtopic.php?id=5508#p40687
Reply With Quote
Reply

Tags
blockdevice, disk, order, random

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
openbsd, fsck at boot, repair files without disk hd77 OpenBSD General 1 5th June 2022 02:17 AM
OpenBSD OpenBSD 4.8 can now be pre-ordered! ocicat News 0 8th September 2010 08:17 PM
OpenBSD randomly wedging lebbers OpenBSD General 2 22nd June 2010 02:19 AM
FreeBSD 7.0 hanging up randomly - again lumiwa FreeBSD General 6 6th September 2008 05:24 PM
FreeBSD 7.0 hanging up randomly mc_i2020 FreeBSD General 22 28th August 2008 11:20 AM


All times are GMT. The time now is 12:13 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick