Bohumil Chalupa ����� Linux RAID ���ꥹ�Ȥؤ���Ƥǡ�RAID1, 5 �Ǥ� mdstop ������β�����ˡ�Ǥ���������ˡ�Ǥϡ�����åȥ�����λ��� RAID �ǥХ���������Ƥ����ǽ�������ꤷ�Ƥ��ޤ������ǡ�ɮ�Ԥ��֡� �Ȼ�������ʻ��ȥ��ơ��������ñ����Ӥ���褦�ˤ��ޤ���������ˤ�ꡤ ���쥤�˰۾郎����Ȥ������ڥ졼����Ĵ�����뤳�Ȥ��Ǥ��ޤ�������ˤĤ� �Ƥξܺ٤���ʸ��ǽҤ٤Ƥ��ޤ���
> From: Bohumil Chalupa <bochal@apollo.karlov.mff.cuni.cz> > > initrd �� linuxrc ��Ȥä�RAID1 ���쥤��ư���������줫�� root �� > /dev/md0 �ˤ��ޤ����ؤ��뤳�ȤǤ��ޤ����� > > �����������쥤������� *�ߤ��* ��ˡ�Ϥ狼��ޤ���
����Ǥϡ��䤬���������ޤ��礦 :-)
> Date: Mon, 29 Dec 1997 02:21:38 -0600 (CST) > From: Edward Welbon <welbon@bga.com> > Subject: Re: dismounting root raid device > > RAID0 �ʳ��� md �ǥХ����ˤĤ��Ƥϡ����Ƥν��ߤ���λ���Ƥ��뤳�� > ���Τ뤿��˥��ơ���������¸����Ȼפ��ޤ�����������Τ褦�ʥ��ơ� > �����ϥ�ɥ����ǥޥ���Ȥ����롼�ȥե����륷���ƥ�ˤĤ��Ƥ� > ��¸����ޤ����Τ褦�ʾ�硤��ɥ����Υ롼�ȥե����륷���� > ��˽��߲�ǽ�ʥե����륷���ƥ� "X" ��ޥ���Ȳ�ǽ�ǡ�"X" �˽� > ���ߤ��Ǥ��ʤ��ƤϤʤ�ޤ���("����"�����Ǥ⤳���Ԥ��ޤ��������� > ��ϼ�ư�����ǤϤ���ޤ���)�� > > �ե����륷���ƥ� "X" �� RAID(initrd ��ͳ�� linuxrc ���¹�)��������ơ� > �������������֡��ȥǥХ����Ȳ��ꤷ�ޤ������� raid0 �ϥ��ơ������� > �����ߤ�ɬ�פ�����ޤ���(mdstop �θ�� mdtab �˥����å������� > �����Ȥ��Ǥ���д��ΤǤ���)�� > �Ȥꤢ����������äƤߤޤ�����"devil" ����� "details" �˴ޤޤ� > �ޤ��������Ϥʤ������Ǥ���
�����Ǥ��͡� ���Ʊ�������ǥ�����ͤ��Ƥ����ΤǤ���������֤�����ޤ���Ǥ����� ����ǡ�������äƤߤ��Ȥ��������ޤ�ư���ޤ�����
������ RAID1(�ߥ顼)�Ǥϡ������å������RAID�Υ����ѡ��֥��å��Υǡ��� ����¸�ϹԤäƤ��ޤ���"�º�"�Υ֡��ȥѡ��ƥ������ξ��Ĥޤ�롼 �Ȥ˳�����Ƥ� md �ܥ�塼�ब����åȥ�������˥�ɥ����Ǻƥޥ� ��Ȥ��줿���Ȥ�������¸���Ƥ��ޤ��������ơ���ư���� linuxrc ������� �Ȥ����ξ���Ĥ���� mkraid --only-superblock ��¹Ԥ������줬���� ����ʤ���� ckraid ��¹Ԥ��ޤ��� �ĤޤꡤRAID �Υ����ѡ��֥��å�����ϥ���åȥ�������ˤϹ������줺�� ��ư���˹�������ޤ��� ���ޤꤹ�ä��ꤷ����ˡ�Ǥʤ��ΤǤ����� :-( ư���ƤϤ��ޤ���
���RAID�ǥХ�����롼�Ȥˤ��Ƶ�ư���뤿��� Edward Welbon ����� initrd.md �� Slackware ���ȹ礻��ȤäƤ��ޤ��� ��γФ��Ƥ���¤�Ǥϡ����������ե������ mkdisk, linuxrc �ȥ���å� �������ѤΥ�����ץ� /etc/rc.d/rc.6 �����Ǥ��� ������� lilo.conf �Ͻ������ޤ����� ���פ���ʬ�����ź�դ��Ƥ����ޤ��� Bohumil Chalupa --------------- my.linuxrc follows ----------------- #!/bin/sh # we need /proc /bin/mount /proc # start up the md0 device. let the /etc/rc.d scripts get the rest of them # we should do as little as possible here # ________________________________________ # root raid1 shutdown test & recreation # /start must be created on the rd image in my.mkdisk echo "preparing md0: mounting /start" /bin/mount /dev/sda2 /start -t ext2 echo "reading saved md0 state from /start" if [ -f /start/root.raid.ok ]; then echo "raid ok, modyfying superblock" rm /start/root.raid.ok /sbin/mkraid /etc/raid1.conf -f --only-superblock else echo "raid not clean, runing ckraid --fix" /sbin/ckraid --fix /etc/raid1.conf fi echo "unmounting /start" /bin/umount /start # _________________________________________ # echo "adding md0 for root file system" /sbin/mdadd /dev/md0 /dev/sda1 /dev/sdb1 echo "starting md0" /sbin/mdrun -p1 /dev/md0 # tell kernel we want to switch to /dev/md0 as root device, the 0x900 value # is arrived at via 256*major_device_number + minor_device number. echo "setting real-root-dev" /bin/echo 0x900>/proc/sys/kernel/real-root-dev # unmount /proc so that the ram disk can be deallocated. echo "unmounting /proc" /bin/umount /proc /bin/echo "We are hopefully ready to mount /dev/md0 (major 9, minor 0) as root" exit --------------- end of my.linuxrc ---------------------------------- ----------- extract from /etc/rc.d/rc.6 follows ----------------- # Turn off swap, then unmount local file systems. echo "Turning off swap." swapoff -a echo "Unmounting local file systems." umount -a -tnonfs # Don't remount UMSDOS root volumes: if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then mount -n -o remount,ro / fi # Save raid state echo "Saving RAID state" /bin/mount -n /dev/sda2 /start -t ext2 touch /start/root.raid.ok /bin/umount -n /start -------------- end of excerpt from rc.6 ------------------------ ------------------ part of my.mkdisk follows ---------------------- # # now we have the filesystem ready to be populated, we need to # get a few important directories. I had endless trouble till # I created a pristine mtab. In my case, it is convenient that # /etc/mdtab is copied over, this way I can activate md with # a simple "/sbin/mdadd -ar" in linuxrc. # cp -a $ROOT/etc $MOUNTPNT 2>cp.stderr 1>cp.stdout rm -rf $MOUNTPNT/etc/mtab rm -rf $MOUNTPNT/etc/ppp* rm -rf $MOUNTPNT/etc/termcap rm -rf $MOUNTPNT/etc/sendmail* rm -rf $MOUNTPNT/etc/rc.d rm -rf $MOUNTPNT/etc/dos* cp -a $ROOT/sbin $ROOT/dev $ROOT/lib $ROOT/bin $MOUNTPNT 2>>cp.stderr 1>>cp.stdout # _____________________________________________________________________ # RAID: will need mkraid and ckraid cp -a $ROOT/usr/sbin/mkraid $ROOT/usr/sbin/ckraid $MOUNTPNT/sbin 2>>cp.stderr 1>>cp.stdout # --------------------------------------------------------------------- # it seems that init wont come out to play unless it has utmp. this can # probably be pruned back alot. no telling what the real bug was 8-). # mkdir $MOUNTPNT/var $MOUNTPNT/var/log $MOUNTPNT/var/run $MOUNTPNT/initrd touch $MOUNTPNT/var/run/utmp $MOUNTPNT/etc/mtab chmod a+r $MOUNTPNT/var/run/utmp $MOUNTPNT/etc/mtab ln -s /var/run/utmp $MOUNTPNT/var/log/utmp ln -s /var/log/utmp $MOUNTPNT/etc/utmp ls -lstrd $MOUNTPNT/etc/utmp $MOUNTPNT/var/log/utmp $MOUNTPNT/var/run/utmp # # since I wanted to change the mount point, I needed this though # I suppose that I could have done a "mkdir /proc" in linuxrc. # mkdir $MOUNTPNT/proc chmod 555 $MOUNTPNT/proc # # ------------------------------------------------------ # we'll mount the real boot device to /start temporarily # to check the root raid state saved at shutdown time # mkdir $MOUNTPNT/start # ------------------------------------------------------- # # need linuxrc (it is, after all, the point of this exercise). # if [ -x ./my.linuxrc ]; then cp -a ./my.linuxrc $MOUNTPNT/linuxrc chmod 777 $MOUNTPNT/linuxrc else ln -s /bin/sh $MOUNTPNT/linuxrc fi # ----------------- part of my.mkdisk ends -----------------