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

Re: RAID in Linux (was Re: SCSI and EIDE)



> Hi guys,
> 
> starting a new thread about the subject... ;-)
> 
> I'm still trying to get a grip on this...
> 
> Few questions:
> 1. can raid0/raid1 be done on either scsi or ide or both?
> 2. what's the difference between raid0 and raid1?
> 3. what exactly does it do? Does it mirror data accross multiple devices, 
> and if so, how does it maintain the data in all devices?
> 4. How does one go about "creating" an md device? Would it automatically 
> mirror a "non-md" drive into the multiple devices?

Please read the manpage for the 'mdcreate' utility.  It answers all of these
questions.  That said, I'll attemt to exlain it in my own words.

raid0/raid1/linear are currently functional raid personalities that can be
used for any block device.  floppy+ide+scsi+zipdrive+whatever.  I don't know
if you could use a ramdisk, but I wouldn't be surprised.  ANY BLOCK DEVICE.

So, for my computer, I have:
/dev/hda hda1(1mb)  hda2(90mb)  hda3(50mb) hda4(60mb)
/dev/sda sda1(45mb) sda2(265mb) sda3(7mb)
/dev/sdb sdb1(45mb) sdb2(265mb) sdb3(7mb)

Long story on the reasoning behind this, but anyway, /etc/mdtab contains:

   /dev/md0 raid0,4k,0,72e5f713 /dev/sdb1 /dev/hda6 /dev/sda1
   /dev/md1 raid0,4k,0,7b8942ce /dev/sdb2 /dev/sda2

Which gets me an output of 'df' as follows:

   LightHouse~:$ df
   Filesystem     1024-blocks  Used Available Capacity Mounted on
   /dev/hda2          89183   79028     5550     93%   /
   /dev/md0          149794  131671    18123     88%   /home
   /dev/md1          515289  458539    30134     94%   /usr

(the 50mb partition on ide is swap).

Notice I am creating a /usr partition that is bigger than any one of my
drives alone, and also am using ide + scsi on the /home partition.

[ a note to those who would suggest I'm crazy to swap on ide when I have
  scsi-->  my ide is 2x faster than my scsi disks because they are VERY old ]
[ a note to those who wonder about the 2 unused 7mb partitions on my scsi
  disks--> the 2nd scsi disk has problems reading the last 7mb of the drive
  and causes lockups.  So I decided to partition the drives around the 'bad'
  blocks. ]

Anyway, raid (or multiple device, md) in linux has 3 personalities availble
at this time:
   linear = appending all the block devices together.  So if you had
             md0 = /dev/hda1 + hdb3 + sda, the blocks would be accessed
              in this order:

              /dev/hda1 = { block1, block2, block3 }
              /dev/hdb3 = { block4, block5 }
              /dev/sda  = { block6, block7, block8 }

   raid0 = software disk striping.  So if you had
             md0 = /dev/hda1 + hdb3 + sda, the blocks would be accessed
               in this order:

              /dev/hda1 = { block1, block4, block7 }
              /dev/hdb3 = { block2, block5 }
              /dev/sda  = { block3, block6, block8 }

   raid1 = software disk striping + recovery; I am not certain of the block
             layout but it is similar to raid0 with not as much physical space
             available due to some data redundancies

So, when I was booting off /dev/hda2 on my machine, I simply typed:

mdcreate raid0 /dev/md0 /dev/sdb1 /dev/hda6 /dev/sda1
mdcreate raid0 /dev/md1 /dev/sdb2 /dev/sda2

And now, upon bootup, I simply type:
mdadd -ar

Which activates the md devices.  At this point in time I am able to fsk and
mount the /dev/md* just as if they were hd*'s or sd*'s.  They are a block
device, like any other.

Honestly, you will get the idea when you toy around and start planning to do
your own raid'ing.  Especially when you grab the md utils and compile them,
while they compile you can read the man pages and you should have no problem.

It is actually fairly simple to use.
--
Todd Fries .. todd@miango.com



Reply to: