LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Newbie needs RAID help! (https://www.linuxquestions.org/questions/red-hat-31/newbie-needs-raid-help-112096/)

fclifton 11-03-2003 10:24 PM

Newbie needs RAID help!
 
I tried not to post, really I did. I read the Software RAID HOW-TO and a bunch of posts, but I can't get it to work:

Running RH9, with all OS already running on /dev/hda

Have 2 new HDs, /dev/hde & /dev/hdg with which I want to create a RAID 1 array. The new array will not have any OS stuff, it will stay on /dev/hda.

Partitioned the drives using fdisk:
used n to create the new partition using all available space
used t to change the partition ID to RAID auto (fd)

When I use the Hardware Browser I see the two drives, and the partition type is shown as 'software RAID component'

Created a /etc/raidtab as shown in the HOW-TO

Now I am confused as to what comes next. I tried

mkraid /dev/md0

which gives the response:

handling MD device /dev/md0
analyzing super-block
invalid chunk-size (0kB)
mkraid: aborted.

I don't know where to go from here. Did I do the fdisk wrong, or have I missed a step???

Help!

Thanks,
Frank

DavidPhillips 11-04-2003 03:04 AM

you can try mkraid -f /dev/md0

make sure the /etc/raidtab file is correct

Guru3 11-04-2003 07:21 AM

try #man mkraid. You may have left out a switch as it says "invalid chunk-size (0kB)". Check for a switch on chunk size...

fclifton 11-04-2003 12:08 PM

Thanks for the suggestions, but it hasn't helped. I did add a line to /proc/readitab that said:

chunk-size 8

That made mkraid do something. (But in my kernal log, I then see a warning that a RAID1 array doesn't need a chunk-size. So, I took the line out to get rid of the warning.) But during boot, the system tells me that there is a problem with hde and hdg and it can't import them, so it doesn't use md0. (Sorry I'm not at that machine, so I don't have exact text)

The filesystem I put on the drives is ext3. Should I have an ext2 filesystem to do RAID1?

DavidPhillips 11-04-2003 12:24 PM

no ext3 should be ok

mkraid should recreate the raid partitions when you create md0

whats in the /etc/raidtab file


does your kernel support RAID

fclifton 11-04-2003 02:25 PM

David, thanks for the assistance. Here is the contents of the /etc/raidtab file:

raiddev /dev/md0
raid-level 1
nr-raid-disks 2
persistent-superblock 1

device /dev/hde1
raid-disk 0
device /dev/hdg1
raid-disk 1

AFAIK the kernel supports RAID. It is RH9 and I can see from the kernel log that it is checking for auto RAID and other RAID things, so I assume all the support is there. Is there a way to check for sure?

One other thing - these two drives are on a SIIG PCI controller. I believe it is being correctly identified and used (I can fdisk the drives, add a fs, etc). I can send the kernel log if that would be any help.

Frank

DavidPhillips 11-04-2003 02:54 PM

I guess you need to try this

lsraid -a /dev/md0

you should see something like this

[dev 9, 0] /dev/md0 955E5224.08C9D222.1A09677B.BBCFE189 online
[dev 3, 2] /dev/hda2 955E5224.08C9D222.1A09677B.BBCFE189 good
[dev 3, 67] /dev/hdb3 955E5224.08C9D222.1A09677B.BBCFE189 good


now if it looks ok then run this to update your /etc/raidtab file

lsraid -R -a /dev/md0 > /etc/raidtab


the output goes to /etc/raidtab and looks like this..
lsraid -R -a /dev/md0
# This raidtab was generated by lsraid version 0.7.0.
# It was created from a query on the following devices:
# /dev/md0

# md device [dev 9, 0] /dev/md0 queried online
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 64

device /dev/hda2
raid-disk 0
device /dev/hdb3
raid-disk 1


for someone with multiple devices use it like this

lsraid -R -a /dev/md0 -a /dev/md1
# This raidtab was generated by lsraid version 0.7.0.
# It was created from a query on the following devices:
# /dev/md0
# /dev/md1

# md device [dev 9, 0] /dev/md0 queried online
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 64

device /dev/hda2
raid-disk 0
device /dev/hdb3
raid-disk 1

# md device [dev 9, 1] /dev/md1 queried online
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 64

device /dev/hda1
raid-disk 0
device /dev/hdb1
raid-disk 1

fclifton 11-04-2003 03:29 PM

David,

Thanks again for the help. Seems like I found the lsraid command and used it but I don't remember what it did (or even where in the process I used it...) I'll give it a try tonight.

It seems like when I used it, it told me that /dev/md0 was not online. And then I think I did a raidstart and tried it again and got an ok response. But at that point, the kernel still had a problem with - what would the term be, starting? - md0. But I'm not sure of that so I'll post again when I can try it again.

Frank

DavidPhillips 11-04-2003 03:45 PM

If the raid device is not there then try this

mdadm --create /dev/md0 --chunk=64 --level=raid1 --raid-devices=2 /dev/hde1 /dev/hdg1

mdadm --detail --scan >> /etc/mdadm.conf

DavidPhillips 11-04-2003 03:49 PM

so if /dev/md0 was there then I would issue these commands..


mke2fs -j /dev/md0

mkdir /somewhere

mount /dev/md0 /somewhere

mount | grep md0
/dev/md0 on /somewhere type ext3 (rw)




also maybe the array is still resyncing, try this to see..


cat /proc/mdstat

fclifton 11-05-2003 11:34 AM

Ok, I played around some more last night. I think the array is actually working. Here's what I did:

====================================================
[root@ServerPress root]# lsraid -a /dev/md0
lsraid: md device [dev 9, 0] /dev/md0 is offline: Please specify a disk to query
[root@ServerPress root]# mdadm --create /dev/md0 --chunk=64 --level=raid1 --raid-devices=2
/dev/hde1 /dev/hdg1
bash: mdadm: command not found
[root@ServerPress root]# /sbin/mdadm --create /dev/md0 --chunk=64 --level=raid1 --raid-devices=2 /dev/hde1 /dev/hdg1
bash: /sbin/mdadm: No such file or directory
[root@ServerPress root]# man mdadm
No manual entry for mdadm
[root@ServerPress root]# cat /proc/mdstat
Personalities :
read_ahead not set
unused devices: <none>
[root@ServerPress root]# mkraid /dev/md0
handling MD device /dev/md0
analyzing super-block
disk 0: /dev/hde1, 78148161kB, raid superblock at 78148096kB
disk 1: /dev/hdg1, 78148161kB, raid superblock at 78148096kB
[root@ServerPress root]#
[root@ServerPress root]# lsraid -a /dev/md0
[dev 9, 0] /dev/md0 83EBB493.4B4C15DB.28AAF54B.EA0920B8 online
[dev 33, 1] /dev/hde1 83EBB493.4B4C15DB.28AAF54B.EA0920B8 good
[dev 34, 1] /dev/hdg1 83EBB493.4B4C15DB.28AAF54B.EA0920B8 good

[root@ServerPress root]#lsraid -R -a /dev/md0 > /etc/raidtab
# This raidtab was generated by lsraid version 0.7.0.
# It was created from a query on the following devices:
# /dev/md0

# md device [dev 9, 0] /dev/md0 queried online
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
persistent-superblock 1
chunk-size 64

device /dev/hde1
raid-disk 0
device /dev/hdg1
raid-disk 1

[root@ServerPress root]# mke2fs -j /dev/md0
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9781248 inodes, 19537024 blocks
976851 blocks (5.00%) reserved for the super user
First data block=0
597 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
====================================================

As you can see, no mdadm program :,(
Also, I did cat /proc/mdstat and finally realized that it was resyncing, and that that process would take a long time (don't know why, there were no files on the disks)

Now after a reboot I get this:

(this message shows on the screen but does not show in any log file I can find)
Starting up RAID devices: md0(skipped)

[root@ServerPress root]# cat /proc/mdstat
Personalities :
read_ahead not set
unused devices: <none>
[root@ServerPress root]# lsraid -a /dev/md0
lsraid: md device [dev 9, 0] /dev/md0 is offline: Please specify a disk to query[root@ServerPress root]# raidstart /dev/md0
[root@ServerPress root]# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 hdg1[1] hde1[0]
78148096 blocks [2/2] [UU]

unused devices: <none>
[root@ServerPress root]# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 hdg1[1] hde1[0]
78148096 blocks [2/2] [UU]

unused devices: <none>
[root@ServerPress root]# mount /dev/md0 /SharedDocs
[root@ServerPress root]# ls /SharedDocs
lost+found
[root@ServerPress root]#


So, it looks like the RAID isn't starting during boot, but can be started manually. Any ideas as to how to get it start automatically? (and then once that works then I just put the mount info in /etc/fstab right?)

Thanks,
Frank

DavidPhillips 11-05-2003 12:20 PM

mdadm is not really necessary anyway, mkraid does basically the same thing except it requires a raidtab file, where all parameters are given with mdadm so no raidtab file is necessary to create the raid device.


I have this script in /etc/rc.d/rc.sysinit file, that's were your error is coming from...

# Add raid devices
if [ ! -f /proc/mdstat ]; then
modprobe md >/dev/null 2>&1
fi

if [ -f /proc/mdstat -a -f /etc/raidtab ]; then
echo -n $"Starting up RAID devices: "

rc=0

for i in `grep "^[^*]*raiddev" /etc/raidtab | awk '{print $2}'`
do
RAIDDEV=`basename $i`
RAIDSTAT=`grep "^$RAIDDEV : active" /proc/mdstat`
if [ -z "$RAIDSTAT" ]; then
# First scan the /etc/fstab for the "noauto"-flag
# for this device. If found, skip the initialization
# for it to avoid dropping to a shell on errors.
# If not, try raidstart...if that fails then
# fall back to raidadd, raidrun. If that
# also fails, then we drop to a shell
RESULT=1
NOAUTO=`grep "^$i" /etc/fstab | grep -c "noauto"`
if [ $NOAUTO -gt 0 ]; then
RESULT=0
RAIDDEV="$RAIDDEV(skipped)"
fi
if [ $RESULT -gt 0 -a -x /sbin/raidstart ]; then
/sbin/raidstart $i
RESULT=$?
fi
if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
/sbin/raid0run $i
RESULT=$?
fi
if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
/sbin/raidadd $i
/sbin/raidrun $i
RESULT=$?
fi
if [ $RESULT -gt 0 ]; then
rc=1
fi
echo -n "$RAIDDEV "
else
echo -n "$RAIDDEV "
fi
done
echo

# A non-zero return means there were problems.
if [ $rc -gt 0 ]; then
echo
echo
echo $"*** An error occurred during the RAID startup"
echo $"*** Dropping you to a shell; the system will reboot"
echo $"*** when you leave the shell."

PS1=$"(RAID Repair) \# # "; export PS1
sulogin

echo $"Unmounting file systems"
umount -a
mount -n -o remount,ro /
echo $"Automatic reboot in progress."
reboot -f
fi
fi



It looks like you just need to add the entry to /etc/fstab and it should work ok.

fclifton 11-05-2003 12:33 PM

That looks like that script will handle all types of RAID. I haven't done any scripts yet, so I can follow what you are doing but I'll have to look up all the command to see exactly what is going on.

Uh, is this PERL?

Also, when I last did fdisk I did not set the RAID flag on either HD. If I set the flag, will the auto function start the RAID? Or what benefit is having the flag set?

Thanks again for your help. I'll try this out tonight, and I think it will get me going.

(Now, about the remote administration from a WinXP desktop....)

Frank

DavidPhillips 11-05-2003 01:02 PM

the kernel will autodetect it, it should be set.

you have the script already on RH9.

if you set the raid audetect flag type fd and add the entry to /etc/fstab you shouldn't need to do anything else.

fclifton 11-05-2003 10:18 PM

David, Success! Many thanks :>)

Now that it is working, I have a couple of questions regarding use.

In /etc/fstab I have the entry:

/dev/md0 /SharedDocs ext3 rw 0 0

Previously I had:

/dev/md0 /SharedDocs ext3 defaults 0 0

which did not seem to work. Should it? Would I need to define the defaults somewhere?

Also, I want to make the /SharedDocs folder available to WinXP machines on the network. I have Samba running properly and have another folder (/tmp) shared. So I used the Samba config app to add /SharedDocs/Frank to the Samba shares, made it r/w, set it to only be available to frank.

I can see this directory and read it from my XP machine when logged in as Frank. But I can't write it. Do I have to set permissions somewhere?

Thanks so much for your time and patience!

Frank


All times are GMT -5. The time now is 03:00 PM.