LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-16-2014, 04:37 AM   #1
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Rep: Reputation: 15
Drives keep getting reversed.


Ever since the other day, every time I reboot the server (running OpenSuSe 11.4)after any updates, the fstab entry for mounting the 2nd SATA drive and the main OS drive are reversed,,,EG

OS drive (sda) should be in fstab:-

Code:
/dev/disk/by-id/ata-ST3100011A_4LH0PWJC-part1 swap                 swap       d$
/dev/disk/by-id/ata-ST3100011A_4LH0PWJC-part2 /                    ext4       a$
/dev/disk/by-id/ata-ST3100011A_4LH0PWJC-part3 /home                ext4       a$
and the 2nd SATA drive should be:-

Code:
/dev/sdb1            /home/usalabs/drive1 ext4       user,acl,user_xattr     1 0
/dev/sdb2            swap                 swap       defaults                0 0
But every time the server is rebooted, the /dev/disk/by-id drive's ID is reversed to be sdb not sda as it should be, and the mounted dev sdb points to the main drive and not the 2nd drive, I have to manually edit fstab and change /dev/sd?1 and /dev/sd?2 to either a or b depending on what has happened.

How can I force Linux to always use sda for it's primary drive? then I can use sdb for the second drive in fstab
 
Old 08-16-2014, 08:23 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Is that your actual fstab entries? Have you tried using /dev/by-Id for your 2nd drive like the OS?
 
Old 08-16-2014, 08:37 AM   #3
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696
drives swapping

Have you considered adding a label to your partitions and mounting by label? IT bypasses this problem.
(So does mounting by UUID, but that is terribly ugly!)
 
Old 08-16-2014, 12:10 PM   #4
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by michaelk View Post
Is that your actual fstab entries? Have you tried using /dev/by-Id for your 2nd drive like the OS?
Yes it's partially from the current fstab,,, there are more entries, but I only posted what was relevant to the problem.
 
Old 08-16-2014, 12:15 PM   #5
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 158

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by wpeckham View Post
Have you considered adding a label to your partitions and mounting by label? IT bypasses this problem.
(So does mounting by UUID, but that is terribly ugly!)
Hmmmm, labels,,,, do you mean a volume label? If so, how is the second drive mounted just by it's label?

I always thought mounting had to be done using the device located in /dev

michaelk suggested I try mounting using device-by-id, is that better than mounting by label?

I also noticed the symlinks within /dev/disk/by-id change too,,,, EG

Currently the OS drive (primary) ID = ata-ST3100011A_4LH0PWJC which points to ../../sdb (/dev/sdb) which shouldn't,, because the primary drive should be sda and it's ID should point to ../../sda

The second drive's ID = ata-WDC_WD5000AACS-00ZUB0_WD-WCASU3669592 which currently points to ../../sda, as can be seen the symlinks are reversed,,,, the ST drive should be sda, and the WDC should be sdb.

Now, performing a reboot, the primary drive ID symlink changes back to sda, but rebooting again, changes to sdb, the symlinks change with every reboot from sda to sdb and back again and so on, which seems to mess up fstab.

Last edited by Usalabs; 08-16-2014 at 12:36 PM.
 
Old 08-16-2014, 01:37 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Support for opensuse 11.4 ended on Nov. 5 2012

there should not be "updates" for it
and if you used "evergreen"
that support ended back in July
so there are no evergreen updates ether to install

If you need "evergreen"
please install the current 13.1
 
Old 08-16-2014, 03:10 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Nope, there are many ways to identify file systems in /etc/fstab these days. /dev/sdxy is only one method.

As you have discovered depending on how devices are discovered /dev/sdx may not point to the same drive every boot. Using persistent names solves this problem. The /dev directory is virtual i.e. only exists in memory and created at boot time which is why the links may change.

There are several ways to use a persistent name in /etc/fstab to identify a filesystem:
UUID, By-ID, and file system labels. I'm not aware that one method is better then the other, each should be unique.
 
Old 08-21-2014, 02:10 PM   #8
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 102

Rep: Reputation: 31
nowadays any *nix os should do the job using UUID in fstab , not /dev/sd* ,, using sdX allways gets OS confused
run in terminal .. blkid and should see UUID associated with theis respective /sdX drive

in fstab tune that accordingly ..

example :
insert a usb dribe and run fsdik -l
should see that usb under let's say sdg sg1
insert a second usb drive
should see it as sdh sdh1
now remove first one and run again fdisk -l ,, now sdh become sdg
that confuses OS
instead , using UUID allways new (old drives) remains in the same possition , BUT if running fdisk /dev /sdX just for repartition uuid would be changed , therefore use carefully , in my oppinion best sollution is to write manually an unique value in all drives like making a folder named 1-drive-kinkston-8gb-purchase-moment , and run a root script that would mount all new drives and search for that folder ,, afterwards alter fstab as searching gets that value.. it is ugly but it works

Sometimes my english sounds as bad as it is , more infos can be achieved here as requested


my server uses 2 kinkston usb flash drives just for boot but cloned ones , and from there it runs raid mirror mdadm drives , in this way i can rebooot either one boot drive is dammaged , either one raid (2 TB ) [UU] is dammaged.
mixing /dev/sdx would compromising server at once if not carefull.

Last edited by yo8rxp; 08-22-2014 at 03:18 AM.
 
Old 08-22-2014, 07:19 AM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,631

Rep: Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696Reputation: 2696
well sure, why not....

"Hmmmm, labels,,,, do you mean a volume label? If so, how is the second drive mounted just by it's label?"

you need to try google, it is a wondeful search tool.
In this case the man page for Tune2fs may help. You can Label partitions and mount them by label. It is easy, far more readable than using UUID, and avlids all kinds of troubles. What device it gets mapped to becomes irrelevent, as mount searches all detected devices for the one with the proper label to do the mount.

You may want to read something like this: http://www.cyberciti.biz/faq/rhel-ce...rtition-label/
found using google, or this: https://wiki.archlinux.org/index.php/fstab for greater detail and links to related documents in the wonderful Arch community.

Easiest to follow, a great first HOW-TO for reference is at http://www.nslu2-linux.org/wiki/HowTo/MountDisksByLabel
and the classic Debian style (my second love) at https://wiki.debian.org/fstab

Reading any ONE of these shuld answer that question, as well as several you had not yet thought to ask.
 
  


Reply



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
Joystick axis reversed miner49er Linux - Hardware 0 01-19-2007 06:36 AM
Scrollwheel is reversed (wacom) rutgerw Linux - Hardware 2 01-15-2007 04:34 PM
Remote X11, but reversed. Is it possible ? suger Linux - Networking 4 12-13-2005 01:44 PM
Some keyboard letters reversed tck Linux - Newbie 2 10-12-2004 03:21 PM
reversed cp command chandan Linux - Newbie 1 03-19-2003 07:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:39 PM.

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