hard drives with "variable" device names - mdadm raid assembly options setup
Hi,
I notice on my system that the hard drives "device names" can change. Ie .
The hard drives are connected to the motherboard SATA connectors or to PCI SATA cards. They get different "names" /dev/sda or /dev/sdc depending how many of the cards are "active".
For instance the hard drives on the motherboard itself are called /dev/sde and /dev/sdf if there are hard drives on the 2 PCI cards and are called /dev/sda and /dev/sdb if there are none.
This is disconcerting, as I am setting up a remote site that I want to be able to visit rarely. I want to leave the "extra" hard drives on the PCI cards "off" for a few months, and am worried of FUD (fear uncertainty and doubt) when I zoom in - to adjust the system - in a few months time when I come to connect the additional drives.
(Note: I am completely confused by udev which makes my raid life difficult - and I completely removed it so I am working with a static /dev/ directory :) )
I notice that there is a -u option based on the fixed uuid mdadm -A /dev/md0 -u ?????
now I read in the man page:
If precisely one device is listed, but --scan is not given, then mdadm
acts as though --scan was given and identify information is extracted from the configuration file.
The identity can be given with the --uuid option, with the --super- minor option, can be found in the config file, or will be taken from the super block on the first component-device listed on the command line.
Now I am confused: unfortunately this does not seem to help me:
if it relys on the configuration file /etc/mdadm/mdadm.conf this config file - i create with the aid of mdadm --detail --scan seems to still have the (problematic) "variable" device names in it. I want only to use the uuid and not the "device name" which may change. How can I deal effectively with my problem?
I want to set up my assemble line in my startup script so that all I need to do is
1) connect the additional hard drives and
2) uncomment a line in a startup script that will refer to the new hard drives only by their uuid so that I can be assured that the new device /dev/md1 will be the new drives and not a switcheroo?
Thanks!
Mitchell
Mitchell Laks <[email protected]> writes:
G'day Mitchell.
Quoted 9 lines
I notice on my system that the hard drives "device names" can change.
The hard drives are connected to the motherboard SATA connectors or to PCI SATA cards. They get different "names"
/dev/sdaor/dev/sdcdepending how many of the cards are "active".For instance the hard drives on the motherboard itself are called
/dev/sdeand/dev/sdfif there are hard drives on the 2 PCI cards and are called/dev/sdaand/dev/sdbif there are none.
Well, one solution is udev, but since you prefer to avoid that...
[...]
Quoted 4 lines
Now I am confused: unfortunately this does not seem to help me:
if it relys on the configuration file/etc/mdadm/mdadm.confthis config file - i create with the aid of mdadm --detail --scan seems to still have the (problematic) "variable" device names in it.
...you can simply remove the 'device names' variable, and list the theoretically possible devices for MD stuff in the configuration:
DEVICE /dev/hd*
DEVICE /dev/sd*
That will include all the IDE and SCSI disks (including SATA), so they will be scanned at an appropriate time.
Then, list your arrays:
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=529d70fa:e5fe992b:ceb05593:bfcc6c25
That will cause mdadm to scan all those device entries (all the disks and partitions) looking for an array with the right UUID, and assemble it from all the components it finds.
Regards,
Daniel
Quoted 29 lines · Daniel Pittman
Mitchell Laks <[email protected]> writes:
G'day Mitchell.
Quoted 9 lines
I notice on my system that the hard drives "device names" can change.
The hard drives are connected to the motherboard SATA connectors or to PCI SATA cards. They get different "names"
/dev/sdaor/dev/sdcdepending how many of the cards are "active".For instance the hard drives on the motherboard itself are called
/dev/sdeand/dev/sdfif there are hard drives on the 2 PCI cards and are called/dev/sdaand/dev/sdbif there are none.Well, one solution is udev, but since you prefer to avoid that...
[...]
Quoted 1 line
Now I am confused: unfortunately this does not seem to help me: if it relys on the configuration file
/etc/mdadm/mdadm.confthis config file - i create with the aid of mdadm --detail --scan seems to still have the (problematic) "variable" device names in it....you can simply remove the 'device names' variable, and list the theoretically possible devices for MD stuff in the configuration:
DEVICE
/dev/hd*
DEVICE/dev/sd*That will include all the IDE and SCSI disks (including SATA), so they will be scanned at an appropriate time.
Quoted 7 lines
Then, list your arrays:
ARRAY
/dev/md2level=raid1 num-devices=2 UUID=529d70fa:e5fe992b:ceb05593:bfcc6c25That will cause mdadm to scan all those device entries (all the disks and partitions) looking for an array with the right UUID, and assemble it from all the components it finds.
I am trying to do this with my 8 (currently only 7 since /dev/hdk is off line being replaced) disk raid5 array. mdadm --detail /dev/md0 gives :
"/dev/md0:
Version : 00.90.02
Creation Time : Sat Aug 6 10:18:41 2005
Raid Level : raid5
Array Size : 976804480 (931.55 GiB 1000.25 GB)
Device Size : 195360896 (186.31 GiB 200.05 GB) Raid Devices : 6
Total Devices : 7
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sat Dec 31 12:35:32 2005
State : clean
Active Devices : 6
Working Devices : 7
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
UUID : 15bfec75:595ac793:0914f8ee:862effd8
Events : 0.838124
Number Major Minor RaidDevice State
0 33 0 0 active sync /dev/hde
1 34 0 1 active sync /dev/hdg
2 56 0 2 active sync /dev/hdi
3 8 0 3 active sync /dev/sda
4 8 16 4 active sync /dev/sdb
5 8 32 5 active sync /dev/sdc
6 8 48 - spare /dev/sdd
"
I am confused why there are only 4 UUIDs, when there are 7 devices listed...what should I put in my mdadm.conf file, which is currently :
"
DEVICE /dev/hd[egik] /dev/sd[abcd]
ARRAY /dev/md0 level=raid5 num-devices=6 spares=1 devices=/dev/hde,/dev/hdg,/dev/hdi,/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd "
What do I put for UUIDs for the 7 devices?
Max.
Quoted 3 lines · Daniel Pittman
DEVICE
/dev/hd*
DEVICE/dev/sd*
i really find
DEVICE partitions
to be more useful than shell patterns.
L.
Signature · 6 lines
Luca Berra -- [email protected] Communication Media & Services S.r.l. /"\ \ / ASCII RIBBON CAMPAIGN X AGAINST HTML MAIL / \
On Sat, Dec 31, 2005 at 11:44:32AM +1100, Daniel Pittman wrote:
} Mitchell Laks <[email protected]> writes:
}
} G'day Mitchell.
}
} > I notice on my system that the hard drives "device names" can change. } >
} > The hard drives are connected to the motherboard SATA connectors or to } > PCI SATA cards. They get different "names" /dev/sda or /dev/sdc } > depending how many of the cards are "active".
} >
} > For instance the hard drives on the motherboard itself are called } > /dev/sde and /dev/sdf if there are hard drives on the 2 PCI cards and } > are called /dev/sda and /dev/sdb if there are none.
}
} Well, one solution is udev, but since you prefer to avoid that... [...]
I have an 8-tray SCSI hotswap rack, and I had a similar problem. I use scsidev, from the scsitools package (under Debian, at least), to create appropriately named block devices at boot before mdadm starts any md devices. My /etc/scsi.alias:
id=0, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack0 id=1, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack1 id=2, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack2 id=3, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack3 id=8, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack4 id=9, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack5 id=10, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack6 id=11, hostname="Adaptec AIC7XXX", devtype=disk, alias=rack7
Now, this is just matching by SCSI id (and SCSI host) since I don't want to have to reconfigure on hotswap and the tray position controls the SCSI id, but it can match by any combination of manufacturer, serial_number, model, rev, wwid, lun, chan, hostname, hostid, and hostnum. Running scsidev -f will create block devices in /dev/scsi; I have /dev/scsi/rack[0-7]. Then my /etc/mdadm/mdadm.conf looks like this:
DEVICE /dev/scsi/rack[01234567]
ARRAY /dev/md0 devices=/dev/scsi/rack0,/dev/scsi/rack1,/dev/scsi/rack2,/dev/scsi/rack3,/dev/scsi/rack4,/dev/scsi/rack5,/dev/scsi/rack6,/dev/scsi/rack7
Very simple, very easy. The scsitools package includes scsiinfo, which should work on SATA (or ieee1394, or USB) drives to retrieve serial numbers.
} Regards,
} Daniel
--Greg
Quoted 2 lines · Max Waterman
Quoted 1 line · Daniel Pittman
Mitchell Laks <[email protected]> writes:
[...]
Quoted 9 lines
Quoted 6 lines
Then, list your arrays:
ARRAY/dev/md2level=raid1 num-devices=2 UUID=529d70fa:e5fe992b:ceb05593:bfcc6c25
That will cause mdadm to scan all those device entries (all the disks and partitions) looking for an array with the right UUID, and assemble it from all the components it finds.I am trying to do this with my 8 (currently only 7 since
/dev/hdkis off line being replaced) disk raid5 array. mdadm --detail/dev/md0gives :
[...]
Quoted 1 line
UUID : 15bfec75:595ac793:0914f8ee:862effd8
[...]
Quoted 2 lines
I am confused why there are only 4 UUIDs, when there are 7 devices listed...what should I put in my mdadm.conf file, which is currently
You surely are confused, but there is only *one* UUID there, not four.
The UUID is presented as four blocks, with a ':' between them, by mdadm for some reason beyond my understanding, but it is really just one string.
Also, the UUID is per *MD* device, not per compontent (hda, sda) device.
So, you list the UUID for the array that mdadm told you as-is.
Daniel
Quoted 2 lines · Daniel Pittman
The UUID is presented as four blocks, with a ':' between them, by mdadm for some reason beyond my understanding
Human beings cannot remember 32 hex digits all at once, so if you ever need to type the thing (or just compare them) it's helpful to have some structure, even if arbitrary.
Signature · 4 lines
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Duckies are fun!