Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

It took me a while to notice, but here's what happens. I have 2 disks on my computer.

On startup, Ubuntu's Disk Utility tells me one is sda and the other sdb. On restart it switches them and on another restart, switches again. It's impossible for me to set my /etc/fstab with the OS randomly switching my disks. I am not changing any settings in BIOS.

How can I make this stop?

share|improve this question
add comment

2 Answers

Use the device mapper. Instead of mounting, say, /dev/sda1, mount by ID. This is how the respective line from fstab would look like:

UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx  / ext3 relatime,error=remount-ro  0  1

You can find out what the id's are with blkid:

/dev/sda3: UUID="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx" TYPE="ext3"

The above UUID is what you should use in the fstab entry above.

From the fstab man page:

Instead of giving the device explicitly, one may indicate the (ext2 or xfs) filesystem that is to be mounted by its UUID or volume label (cf. e2label(8) or xfs_admin(8)), writing LABEL= or UUID=, e.g., 'LABEL=Boot' or 'UUID=3e6be9de-8139-11d1-9106-a43f08d823a6'. This will make the system more robust: adding or removing a SCSI disk changes the disk device name but not the filesystem volume label.

share|improve this answer
2  
Ubuntu is using UUID for a long while now. I assume he already has this enabled by default –  Anwar Shah Sep 26 '12 at 15:12
    
Solved! Thank you! –  Flavian Sep 26 '12 at 15:21
    
@Anwar I assumed he meant a secondary drive added after the installation. –  January Sep 26 '12 at 16:19
1  
@Flavian if it solved the question, please mark the answer as accepted answer by clicking on the gray icon at the top left side of the answer. –  Anwar Shah Sep 26 '12 at 16:22
add comment

This is why Grub uses UUID-s instead of old-fashion /dev/sd* reference. The UUID is unique, and it doesn't matter in which order is seeing the OS the disks. So, update your /etc/fstab to use UUID-s, and you sould not worry about it anymore. (More info here.)

The reason for switching should be a BIOS error (this needs some more investigation).

share|improve this answer
1  
Solved! thank you:) –  Flavian Sep 26 '12 at 15:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.