Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an Ubuntu machine (10.04 but had the same problem in 8.04) with a bunch of drives that I use as a file server:

  • 1 SATA that I boot off of
  • 2 IDE in RAID1
  • 2 SATA in RAID1

The problem is the drives that I have in RAID1 change device names on reboot.

This is a problem because the in my mdadm.conf a reference to /dev/sda1, for example, might not work the next time I reboot because /dev/sda1 could be a disk from another array.

/etc/mdadm/mdadm.conf looks like this:

ARRAY /dev/md0 level=raid1 num-devices=2 metadata=00.90 UUID=c3d6f9e1:b8096c45:c9e2b015:e64a66e3
    devices=/dev/sdd1,/dev/sde1
ARRAY /dev/md1 level=raid1 num-devices=2 metadata=00.90 UUID=e3b0837c:b53a5846:70fdb0c1:78e75d0a
    devices=/dev/sda1,/dev/sdb1
MAILADDR MOOF@MOOF.net

Any help getting around this would be appreciated.

share|improve this question
    
is this a home file server or a file server for your company that you manage? That is where the distinction between the two sites lie. –  MDMarra May 10 '10 at 2:19
    
Can you post the contents of your /etc/mdadm/mdadm.conf? Have you specified your array by UUID or by listing devices? –  Zoredache May 10 '10 at 2:52
    
I think this question is slightly better on SF since it is a server. I deleted the SU question. –  Jeff Atwood May 10 '10 at 3:03
    
Zoredache, I added the contents of /etc/mdadm/mdadm.conf to the question. Thanks. -Mike –  Mike May 10 '10 at 15:03
    
Everything seems fine now that I got a newer version of mdadm. Previously I had the apt version which is: mdadm - v2.6.7.1 - 15th October 2008 Was thrown off because it's been on the machine for years and the problems don't seem to have corresponded with any changes made on the machine. Very glad it's working, thanks. –  Mike May 12 '10 at 5:08

2 Answers 2

up vote 1 down vote accepted

Thanks to @Zoredache's comment (he stated that mdadm should be able to rebuild the array even if the device names changed) I started to think about it as a rebuilding problem enabling more effective research.

First I found this:

http://www.uluga.ubuntuforums.org/showthread.php?p=9202425

Which led me to this:

Newbies can only post one hyperlink (ha) so you'll have to find the link yourself on page linked above. Or maybe someone can get it in here for me?

The solution was to compile mdadm from source and abandon the apt version.

-Mike

share|improve this answer
1  
I believe another solution would have been to remove the ARRAY definitions from mdadm.conf and rely solely on mdadm --auto-detect –  ptman May 12 '10 at 7:50
    
Cool, how does it know which drives belong in an array? When it syncs them it makes a record somewhere? -Mike –  Mike May 12 '10 at 14:40

Use the UUID in /etc/fstab.

# /dev/sda2
UUID=b1a9ff81-5382-40ef-b159-61cd48a6a91e /               ext3    relatime,errors=remount-ro 0       1

You can find the UUID by doing:

$ sudo blkid

which will print a list of the device names and their UUIDs.

It can also be useful to do one or more of the following:

$ ls -l /dev/disk/by-uuid
$ ls -l /dev/disk/by-id
$ ls -l /dev/disk/by-label
$ ls -l /dev/disk/by-path

Another useful command for matching devices is findfs.

share|improve this answer
    
I am using UUID's in fstab to mount the arrays but the problem is mdadm can't assemble the raid because the devices names are changing. –  Mike May 10 '10 at 1:39
1  
mdadm should be able to assemble the RAID by looking at the drives. It doesn't need to the drive names to be consistent at all. –  Zoredache May 10 '10 at 2:49
    
UUIDs is the right idea, but I suspect he needs to be updating his mdadm.conf not the fstab. –  Zoredache May 10 '10 at 2:53
    
Zoredache, I'm intrigued by this... any idea what might be causing my arrays to not rebuild? If I restart over and over until the device names are the same as the ones in /etc/mdadm.conf it will eventually work. When the drive names are change the machine doesn't boot all the way because it gets held up trying to mount the arrays in /etc/fstab –  Mike May 10 '10 at 14:57
    
@Mike: You have to address users other than the one whose question or answer your comment is attached to using an "@" to make sure they get a notification of your message. @Zoredache: Mike has a question for you. –  Dennis Williamson May 10 '10 at 15:37

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.