Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In my PC running Ubuntu 12.04 LTS I have installed three SATA hard drives. Two of them are installed near a cooler. I want to physically switch two drives (one that is not near the fan should be moved near the fan). How would Ubunutu deal with the switch? The device names in fstab, are they in any way relying on the sata port that they are connected to on my motherboard?

EDIT:

This is my /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc                                       /proc             proc  nodev,noexec,nosuid  0  0  
# / was on /dev/sda1 during installation
UUID=f04e6038-4412-46c4-b58d-67bfe3f8eddd  /                 ext4  errors=remount-ro    0  1  
# /Volumes/Backup was on /dev/sdb1 during installation
UUID=dc25bafb-adbc-4a65-845c-02c9253a795e  /Volumes/Backup   ext4  defaults             0  2  
# /Volumes/Storage was on /dev/sdc1 during installation
UUID=74867f3e-acda-4efc-a6aa-7d21484d64a4  /Volumes/Storage  ext4  defaults             0  2  
/dev/sdc2                                  /Volumes/Storage  ext4  defaults             0  0  
#/dev/sdc1                                  /media/sdc1       swap  sw                   0  0 
/dev/sdc1        none        swap        defaults        0        0 

EDIT (changed /etc/fstab according to comments):

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system>                            <mount point>             <type>  <options>            <dump>  <pass>
proc                                       /proc                     proc    nodev,noexec,nosuid  0       0  
UUID=f04e6038-4412-46c4-b58d-67bfe3f8eddd  /                         ext4    errors=remount-ro    0       1  
UUID=dc25bafb-adbc-4a65-845c-02c9253a795e  /Volumes/Backup           ext4    defaults             0       2  
UUID=74867f3e-acda-4efc-a6aa-7d21484d64a4  /Volumes/Storage          ext4    defaults             0       2   
UUID=88ee73e8-7556-40fa-b696-fbc15161036b  none                      swap    defaults             0       0 
share|improve this question
2  
Why are you mounting /Volumes/Storage twice? –  Karlson Sep 18 '12 at 14:15
    
I have no clue. I did not put it there myself. The only thing I added is the swap partition. Any tips on pruning my fstab file would be welcome. –  Vincent Sep 18 '12 at 15:26
add comment

1 Answer

up vote 6 down vote accepted

The UUIDs don't change when you reorder the drives. However, your sdc? entries might change. It's best practice not to rely on the sd? numbering. Better use UUIDs or LABELs to address your partitions.

Find the UUID or LABEL

as root:

blkid -o list -c /dev/null

Change the entries

Change the entries that use the /dev/sd? syntax (in your case /dev/sdc1) to use either the UUID or the LABEL, if the file system has one. Use the values from the blkid output.

UUID=24467f3e-bcda-5efc-a6aa-7d21384d64a4
LABEL=swap
share|improve this answer
    
So what would you suggest me to change in my /etc/fstab file before I switch the drives? –  Vincent Sep 18 '12 at 15:25
    
I edited my question to make it clear. And remove the redundant mount (the line starting with /dev/sdc2). –  Marco Sep 18 '12 at 15:36
    
can I also remove the lines starting with # [...] was on [...] during installation ? –  Vincent Sep 18 '12 at 15:45
    
I followed directions (i think) and came up with an improved fstab file (see my original post). Does it look ok to you? –  Vincent Sep 18 '12 at 15:55
2  
That is a beautiful and well-written fstab. Now you can safely reorder the disks. –  Marco Sep 18 '12 at 16:10
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.