Difference between revisions of "Software projects/OS/Slackware/Advanced usage/RAID"

From Pandora Wiki
Jump to: navigation, search
(WIP WIP WIP HURRAID)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
= WIP WIP WIP HURRAID =
 
= WIP WIP WIP HURRAID =
* Need to properly rebuild one array while completing.
+
* Need to properly rebuild one array while completing this Wiki section.
 
* For now, don't try this incomplete tutorial unless you have some RAID knowledge
 
* For now, don't try this incomplete tutorial unless you have some RAID knowledge
 
* Once finished and this warning removed, go for it.
 
* Once finished and this warning removed, go for it.
Line 42: Line 42:
  
 
= Finalizing card 1 setup =
 
= Finalizing card 1 setup =
 +
* If you don't know how to use cfdisk, please read [http://pandorawiki.org/Software_projects/OS/Slackware/Advanced_usage/Partitioning_and_formatting this] first.
 
* As root:
 
* As root:
 
  cfdisk
 
  cfdisk

Latest revision as of 02:11, 28 November 2012

WIP WIP WIP HURRAID

  • Need to properly rebuild one array while completing this Wiki section.
  • For now, don't try this incomplete tutorial unless you have some RAID knowledge
  • Once finished and this warning removed, go for it.

RAID

  • http://en.wikipedia.org/wiki/RAID
  • We will use the robust native Linux software RAID.
  • It's a feature that can be used on the Pandora, so let's have fun with it
  • I will cover here only a RAID 1 (mirror) on two SD cards, as it should be the more interesting for a server usage because under read load, you should reach about 27MB/s against 16MB/s on one card.
  • A SD + USB drive can also work although untested. Same with a two SD + USB drive configuration.
  • This array will be mounted as /srv , the standard server folder.

Partitioning

  • So you have to partition your system SD card a bit differently than the default SL4P setup.
  • In this example, we will use the recommended minimal 8G card for the slot 1.
  • You can use a different sized card for the right slot. To keep thing interesting, the minimum size is 4G for this second card, and we will use 4G in this example.
  • The RAID 1 partitions must have the same exact size.

Card 1

  • Partition that way:
6G ext2 for the system.
256M for the swap.

That's all for now, the third partition will be created under Slackware, and will be:

1.5G RAID.
  • We will left 256M free. NEVER fill an entire drive with a RAID array. Drives, ie. all 8G, doesn't necessary offer the same exact capacity, so you can get in trouble if you add a drive 32MB short.

Card 2

256M for the swap. Having swap on two different cards is a good thing.

That's all for now, the other partitions will be created under Slackware, and will be:

1.5G unformated RAID.
2G unused. Do what you want with it.

Install SL4P

  • Uncompress the rootfs on the first SD card, first partition, put the card in your OP, and boot it.
  • Log in.

Backup /srv

  • As root:
mkdir /srv-save
mv /srv/* /srv-save/

Finalizing card 1 setup

  • If you don't know how to use cfdisk, please read this first.
  • As root:
cfdisk

Finalizing card 2 setup

  • As root:
cfdisk

Create the RAID 1 array

  • Load module ?
  • The RAID devices names are md0, md1, md2 etc..
mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/mmcblk0p3 /dev/mmcblk1p2

Format the RAID array

  • As usual, we choose the Linux extended 2 filesystem.
mkfs.ext2 /dev/md0

Make the RAID configuration permanent

mdadm --scan > /etc/mdadm.conf

Edit /etc/fstab and add these lines:

/dev/mmcblk1p1   swap   swap   defaults           0  0
/dev/md0         /srv   auto   defaults,noatime   1  1

Final step

  • As root:
mount/dev/md0
mv /srv-save/* /srv/
rm -rf /srv-save/
  • That's it, you have now a RAID 1 array on your Pandora :^).

Some Practice

  • If you want to know how to repair a RAID array, let's simulate a failure.

Remove a drive from the array

  • It's likely to be the one in the right SD slot.
  • Unmount the swap:
swapoff /dev/mmcblk1p1

Repair the array

  • Depending the size of your RAID partition and he data on it, it can take a while.
  • Mount the swap:
swapon /dev/mmcblk1p1