Linux - NewbieThis 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.
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.
The installer of your distribution creates that file. That file is never created on the fly by anything in the system. It may be that your device-names change, but not the fstab. Usually you can avoid problems with changing device names whith using labels or UUIDs instead, bu often all you need is to attach the disks in proper order to the SATA connectors on your mainboard (for example, make sure that /dev/sda is attached to the first port, ...).
It is a configuration file, usually created during an installation.
After installation, it is maintained by the administrator to add/remove entries for filesystems that are to be included as part of the system.
You can't prevent the changing device names. This is due to the way disks are identified - the order is determined by spin up time... Thus adding a disk will/can cause the names to change (especially if it spins up faster...)
What you can do is not use device names in the /ect/fstab file. Filesystems to mount can be identified in one of three ways:
1) by device name - and as you have found out, this isn't reliable.
2) by partition/filesystem UUID - this is reliable as once a partition is created and has a filesystem on it, it is given a unique UUID. Use the command "blkid" to list all filesystems and their associated UUID (it also lists the current device names).
3) by partition label - this is similar to the UUID but is set by the administrator.
In both #2 and #3 problems occur if you create backups by using disk cloning techniques - this causes the duplicated filesystem to also have the same UUID/label, and that will confuse the system boot. Now if these are on removable media, and that media is removed during boot, then there is no problem.
If you want to set a label, you can use e2label (see manpage) for ext2/3/4 filesystems, or tune2fs (see manpage), also for ext2/3/4.
The installer of your distribution creates that file. That file is never created on the fly by anything in the system. It may be that your device-names change, but not the fstab. Usually you can avoid problems with changing device names whith using labels or UUIDs instead, bu often all you need is to attach the disks in proper order to the SATA connectors on your mainboard (for example, make sure that /dev/sda is attached to the first port, ...).
Doesn't always work... It depends on the spin up time for the disks... If you have two sata controllers and for disks, you can get 8 different names... AB CD (order installed), ACBD, BACD, DABC (D happens to be really fast...).
I currently have 4 disks.. A and B are the same type disk, same manufacturer... But the third is much newer (and happens to be on the second controller), the fourth is really really old (a 40GB drive on PATA it always comes up as either C or D depending on the home disk being installed). I nearly always get ACB order. When I had five, I got ACDBE (the CD disks were both newer than the AB...The PATA disk always comes up last with four newer it came up E) and I have no idea why A is so consistent.
Doesn't always work... It depends on the spin up time for the disks... If you have two sata controllers and for disks, you can get 8 different names... AB CD (order installed), ACBD, BACD, DABC (D happens to be really fast...).
I currently have 4 disks.. A and B are the same type disk, same manufacturer... But the third is much newer (and happens to be on the second controller), the fourth is really really old (a 40GB drive on PATA it always comes up as either C or D depending on the home disk being installed). I nearly always get ACB order. When I had five, I got ACDBE (the CD disks were both newer than the AB...The PATA disk always comes up last with four newer it came up E) and I have no idea why A is so consistent.
For me the names didn't even change when temporary connecting a SSD between two other disks, so it may indeed be up to the hardware in use. Of course the proper way to circumvent that issues is to use labels or UUIDs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.