Difference between revisions of "Software projects/OS/Slackware/Advanced usage/RAID"
From Pandora Wiki
Linux-SWAT (talk | contribs) (Created page with "= WIP WIP WIP HURRAID = * Need to properly rebuild one array while completing. = RAID = * http://en.wikipedia.org/wiki/RAID * We will use the robust native Linux software RAID. ...") |
Linux-SWAT (talk | contribs) (→WIP WIP WIP HURRAID) |
||
(7 intermediate revisions 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 | ||
+ | * Once finished and this warning removed, go for it. | ||
= RAID = | = RAID = | ||
* http://en.wikipedia.org/wiki/RAID | * http://en.wikipedia.org/wiki/RAID | ||
* We will use the robust native Linux software RAID. | * We will use the robust native Linux software RAID. | ||
− | * It's a feature that can be used on the Pandora, | + | * 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 | + | * 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. | + | * 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 = | = Partitioning = | ||
− | * So you have to partition your system SD card differently than the default SL4P setup. | + | * 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. | * 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. | + | * 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. | * The RAID 1 partitions must have the same exact size. | ||
= Card 1 = | = Card 1 = | ||
* Partition that way: | * Partition that way: | ||
− | 6G ext2 for the system | + | 6G ext2 for the system. |
− | 256M for the swap | + | 256M for the swap. |
− | 1.5G | + | That's all for now, the third partition will be created under Slackware, and will be: |
− | * We 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. | + | 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 = | = Card 2 = | ||
− | 256M for the swap | + | 256M for the swap. Having swap on two different cards is a good thing. |
− | 1.5G unformated RAID | + | That's all for now, the other partitions will be created under Slackware, and will be: |
− | 2G unused. Do what you want with it. | + | 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 [http://pandorawiki.org/Software_projects/OS/Slackware/Advanced_usage/Partitioning_and_formatting this] first. | ||
+ | * As root: | ||
+ | cfdisk | ||
+ | |||
+ | = Finalizing card 2 setup = | ||
+ | * As root: | ||
+ | cfdisk | ||
= Create the RAID 1 array = | = 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 | ||
− | = Make the RAID permanent = | + | = 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 = | = Remove a drive from the array = | ||
* It's likely to be the one in the right SD slot. | * It's likely to be the one in the right SD slot. | ||
+ | * Unmount the swap: | ||
+ | swapoff /dev/mmcblk1p1 | ||
= Repair the array = | = Repair the array = | ||
* Depending the size of your RAID partition and he data on it, it can take a while. | * Depending the size of your RAID partition and he data on it, it can take a while. | ||
+ | * Mount the swap: | ||
+ | swapon /dev/mmcblk1p1 | ||
+ | |||
+ | |||
+ | [[Category:Slackware]] | ||
+ | [[Category:Software]] | ||
+ | [[Category:System]] |
Latest revision as of 02:11, 28 November 2012
Contents
- 1 WIP WIP WIP HURRAID
- 2 RAID
- 3 Partitioning
- 4 Card 1
- 5 Card 2
- 6 Install SL4P
- 7 Backup /srv
- 8 Finalizing card 1 setup
- 9 Finalizing card 2 setup
- 10 Create the RAID 1 array
- 11 Format the RAID array
- 12 Make the RAID configuration permanent
- 13 Final step
- 14 Some Practice
- 15 Remove a drive from the array
- 16 Repair the array
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