Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Dec 27, 2007 2:14 pm 
Offline
Junior Member

Joined: Sat Sep 24, 2005 9:10 am
Posts: 39
I'm trying to set up software raid on CentOS 5.1 and having a hard time with md1. By default /dev/md0 exists but not md1 so I Googled the problem and found that I can use MAKEDEV to create it. All is well until I reboot when md1 disappears. I checked man MAKEDEV to see if I can make it persistent but didn't find any options that would do that.

Is there a way to set up md1 to be persistent like md0?

Any help is appreciated.

LEC


Top
   
 Post subject:
PostPosted: Thu Dec 27, 2007 2:33 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Is this on a linode or on your own machine?

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:
Code:
   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.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Thu Dec 27, 2007 4:35 pm 
Offline
Junior Member

Joined: Sat Sep 24, 2005 9:10 am
Posts: 39
Thank you Stephen for your quick answer. Yes, this is on my home computer although I did check my Linode too and it too has only md0 by default.

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:
Code:
mdadm -C /dev/md0 -l1 -n2 /dev/hd[ij]
mdadm -C /dev/md1 -l5 -n4 /dev/hd[efgh]

And my mdadm.conf:
Code:
#/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:
Code:
[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:
Code:
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. :)


Top
   
 Post subject:
PostPosted: Thu Dec 27, 2007 6:34 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Ugh, you're using raw devices rather than partitions. I don't think the auto-build routines will work then (but I've never tried) and I guess that you'll probably need to mdadm --assemble at boot time to get the devices found.

I strongly recommend you partition each disk with a single partition of type 'fd' and use /dev/hd[efghi]1 as the devices.

_________________
Rgds

Stephen

(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Thu Dec 27, 2007 8:00 pm 
Offline
Senior Member

Joined: Sun Nov 30, 2003 2:28 pm
Posts: 245
I'm 95% sure that md will figure out how to match the partition sizes, just as is does the raw disks. So on each disk, create as large a partition as fdisk will allow, and let mdadm figure it out.

Why is /dev/md0 created automatically? Probably it happens when the md module loads.

_________________
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world.
-- seen on the net


Top
   
 Post subject:
PostPosted: Fri Dec 28, 2007 12:06 pm 
Offline
Junior Member

Joined: Sat Sep 24, 2005 9:10 am
Posts: 39
Thank you guys for the response. I ended up switching the two arrays and left the 4 drives without partitions in RAID5 to be md0 since that already worked and then created partitions on the two 120GB drives. Everything works now. :) Thanks again.

LEC


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group