Wayne Dawson on Tue, 18 Mar 2003 10:29:05 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] how to put partitions on RAID?


Thanks N-Tropy, I think it does help, despite the fact that I'm using mdadm instead of raidtools and I'm using grub instead of lilo. I have comments/questions, interspersed below.

At 09:57 PM 3/17/03 -0500, you wrote:
After reading your post a bit I decided to stop and just post useful info.

/dev/md0 is the partition.

make sure you have a superblock set up on your raid partitions.  you need
them if you want to run a total raid system.

I don't know precisely what a "superblock" is, but it seems to be data stored on the disk that relates to its participation in a raid. I believe this is created when I use mdadm to create an array.


after you create your raid partition format it and copy your data over to
it. Don't use it again as a seperate partition.

Right. I had a flash of inspiration last night that my befuddlement had led me to do things in a screwy way. I created /dev/md0 and was subdividing that using fdisk. I'm not a sysadmin, as you can no doubt see, so I don't know exactly how fdisk does it's thing; but it was creating partitions like /dev/md0p1, which no other software could see (apparently). Anyway, I realized, duh, I needed to back up and create separate partitions on /dev/sda and /dev/sdb and create /dev/md0, /dev/md1, etc. from them.


I have now done this, and here's the relevant part of /etc/mdadm.conf:
DEVICE /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda5 /dev/sda6 /dev/sda7
DEVICE /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdb5 /dev/sdb6 /dev/sdb7
ARRAY /dev/md1 devices=/dev/sda1,/dev/sdb1
ARRAY /dev/md2 devices=/dev/sda2,/dev/sdb2
ARRAY /dev/md3 devices=/dev/sda3,/dev/sdb3
ARRAY /dev/md5 devices=/dev/sda5,/dev/sdb5
ARRAY /dev/md6 devices=/dev/sda6,/dev/sdb6
ARRAY /dev/md7 devices=/dev/sda7,/dev/sdb7

md1 will be /boot
md2 will be /usr
md3 will be /home
md5 will be /
md6 will be /var
and md7 will be the swap partition

I modeled this after the auto generated partitions (on hda) created by the RH8 install program.

here is my /etc/raidtab

raiddev /dev/md0
        raid-level      1
        nr-raid-disks   2
        nr-spare-disks  0
        chunk-size     4
        persistent-superblock 1
        device          /dev/sda1
        raid-disk       0
        device          /dev/sdb1
        raid-disk       1
raiddev /dev/md1
        raid-level      1
        nr-raid-disks   2
        nr-spare-disks  0
        chunk-size     4
        persistent-superblock 1
        device          /dev/sda4
        raid-disk       0
        device          /dev/sdb4
        raid-disk       1
raiddev /dev/md2
        raid-level      1
        nr-raid-disks   2
        nr-spare-disks  0
        chunk-size     4
        persistent-superblock 1
        device          /dev/sda2
        raid-disk       0
        device          /dev/sdb2
        raid-disk       1

here is my mounted partitions
/dev/md1 on / type reiserfs (rw,errors=remount-ro)
/dev/md0 on /boot type ext2 (rw,errors=remount-ro)

Where should I put the commands to assemble my /dev/md* devices so that they can be seen and/or mounted at boot time?


md0 is boot
md1 is root
md2 is my swap ( is raid1 so that if 1 disc goes and swap is being used the system will stay up.)

Ok, a couple of comments here. You only have three partitions, instead of the five or so most people set up for Linux. Any particular reason for this? Does it have anything to do with using raid?


Also, you have your /boot on your raid. I had to recompile my kernel to get it to see my scsi devices and to handle software raid - that is, to have these capabilities built into the kernel, instead of being loaded via modules. How does the boot process work so that the computer boots from a software raid (scsi) device? I've been told that this can't be done.

My best guess is that really you can boot from the /boot partition on either of the 2 scsi devices (sda1 or sdb1, in my case), but not the /boot partition of the assembled md1 device, since the kernel (and other stuff?) has to be loaded before the md1 device can even *be* assembled.

Once my system is booted and md1 assembled, I can make changes to /boot and reboot from either one, as before. But by having md1 (/boot) assembled as a raid, I can keep the two /boot partitions in sync.

All of this will work, of course, only if my system is capable of booting from a scsi device. But I believe it is not a limitation of Linux that will prevent this setup from working.

Wayne

_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug