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

Re: [linux-lvm] Re: raid 1 on a single disk



On Sat, Nov 13, 2004 at 04:11:08PM +0530, ashwin chaugule wrote:
> yes i know its silly ... im doing what im told to do :p
>
> ok so, i also do know, its performance is going to suck !
> but i was under the impression that RAID 1 works on more that one disks only.
>
> so you mean to say that, the linux RAID / md tools support raid 1 on
> multiple partitiions of the same disk ?
>
> Regards,
> Ashwin
>
>

As people have already said, the software really doesn't care.

Here's a really sick/pointless example to prove it:

dd if=/dev/zero of=/var/tmp/fake1 bs=1M count=16
dd if=/dev/zero of=/var/tmp/fake2 bs=1M count=16
dd if=/dev/zero of=/var/tmp/fake3 bs=1M count=16
dd if=/dev/zero of=/var/tmp/fake4 bs=1M count=16

losetup /dev/loop1 /var/tmp/fake1
losetup /dev/loop2 /var/tmp/fake2
losetup /dev/loop3 /var/tmp/fake3
losetup /dev/loop4 /var/tmp/fake4

mdadm --create -l 5 /dev/md10 -n 4 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4

cat /proc/mdstat

md10 : active raid5 loop4[4] loop3[2] loop2[1] loop1[0]
      48960 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_]
      [================>....]  recovery = 81.2% (14080/16320) finish=0.0min speed=1083K/sec

raidstop -c /dev/null /dev/md10

mdadm --create -l mirror  /dev/md10 -n 4 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4

cat /proc/mdstat

md10 : active raid1 loop4[3] loop3[2] loop2[1] loop1[0]
      16320 blocks [4/4] [UUUU]
      [=============>.......]  resync = 68.7% (12160/16320) finish=0.0min speed=1105K/sec


What this has done is created a 48MB (roughly) raid5 set based on 4 16MB files in /var/tmp.  Obviously this won't be recreated automatically on a reboot (since it's done using files), but it's to show what you can do if you are feeling sick enough.  I've then created it as a mirror to show that works too.

Your command (to setup the mirror) will be something like:

mdadm --create -l mirror -n 4 /dev/hdd1 /dev/hdd2 /dev/hdd3 /dev/hdd4

And since thoswe are real disk partitions, if you set them to type "fd" in fdisk, they will be re-attached on a reboot.

Graham

P.S. I'd be really tempted to talk to the person asking you to do this, and ask them what they hope to achieve...


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