How to create persistent /dev/md1
Is there a way to set up md1 to be persistent like md0?
Any help is appreciated.
LEC
5 Replies
Assuming your home machine
I had this problem when I first installed CentOS 5 on my server; some of the disks (those created by the installer) were coming up but the manually created raid disks weren't. That's when I learnt the type had to be set
md arrays are auto-detected by the kernel and boot process as long as the partition type is set to "fd" ("Linux raid autodetect")
eg on my machine at home:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 60801 488384001 fd Linux raid autodetect
/dev/sdb2 * 1 60801 488384001 fd Linux raid autodetect
/dev/sdc3 * 1 60801 488384001 fd Linux raid autodetect
/dev/sdd4 * 1 60801 488384001 fd Linux raid autodetect
The /dev entries are maintained by udev, so you can't manually create them.
I created the arrays on the disk level and therefore there are no partitions that fdisk would recognize. I did this because some of the drives are slightly different sizes and wanted Linux to figure out how to build the array instead of me trying to match the partition sizes. Here are the commands I used to create my arrays:
mdadm -C /dev/md0 -l1 -n2 /dev/hd[ij]
mdadm -C /dev/md1 -l5 -n4 /dev/hd[efgh]
And my mdadm.conf:
#/dev/md0 - Documents (RAID1 Mirror)
DEVICE /dev/hdi /dev/hdj
ARRAY /dev/md0 devices=/dev/hdi,/dev/hdj level=1
#/dev/md1 - Storage (RAID5)
DEVICE /dev/hde /dev/hdf /dev/hdg /dev/hdh
ARRAY /dev/md1 devices=/dev/hde,/dev/hdf,/dev/hdg,/dev/hdh level=5
They seem to be working fine:
[root@LECBackup dev]# mount /dev/md0 /shares/documents
[root@LECBackup dev]# mount /dev/md1 /shares/storage
[root@LECBackup documents]# ls -al /shares/documents/
total 28
drwxr-xr-x 3 lec smbusers 4096 Dec 27 15:27 .
drwxr-xr-x 4 lec smbusers 4096 Dec 27 11:14 ..
drwx------ 2 lec smbusers 16384 Dec 27 08:08 lost+found
[root@LECBackup documents]# ls -al /shares/storage/
total 28
drwxr-xr-x 3 lec smbusers 4096 Dec 27 11:49 .
drwxr-xr-x 4 lec smbusers 4096 Dec 27 11:14 ..
drwx------ 2 lec smbusers 16384 Dec 27 11:49 lost+found
But fdisk says:
Disk /dev/hde: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hde doesn't contain a valid partition table
Disk /dev/hdf: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hdf doesn't contain a valid partition table
Disk /dev/hdg: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hdg doesn't contain a valid partition table
Disk /dev/hdh: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hdh doesn't contain a valid partition table
Disk /dev/hdi: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk /dev/hdi doesn't contain a valid partition table
Disk /dev/hdj: 122.9 GB, 122942324736 bytes
16 heads, 63 sectors/track, 238216 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk /dev/hdj doesn't contain a valid partition table
Disk /dev/md0: 122.9 GB, 122942259200 bytes
2 heads, 4 sectors/track, 30015200 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/md1: 750.1 GB, 750177681408 bytes
2 heads, 4 sectors/track, 183148848 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md1 doesn't contain a valid partition table
What I don't understand is what's so special about md0 that it works while the other ones don't. Also, not sure how to assign type if I have no partitions.
I strongly recommend you partition each disk with a single partition of type 'fd' and use /dev/hd[efghi]1 as the devices.
Why is /dev/md0 created automatically? Probably it happens when the md module loads.