http://www.davidhunt.ie/raid-pi-raspberry-pi-as-a-raid-file-server/
also useful:
http://ubuntuforums.org/showthread.php?t=408461
http://en.wikipedia.org/wiki/RAID
http://en.wikipedia.org/wiki/Mdadm
ingredients
- 2 1-TB western digital drives
- USB hub with power supply for these
- Edit: make sure it has enough power to power the drives! My initial one (pictured below) did not and I suspect it was drawing power from the pi causing it to crash
- raspberry pi
- USB power supply for this (separate from above)
- 8 GB sandisk microSD card
- for use in raspberry pi
- microSD card reader
- cables to connect all
Steps:
- download and install raspbian wheezy on in the microSD card, using the microSD card reader attached to your PC
- recommend using the torrent to download, it was very fast once it got going
- put the microSD card in the pi, attach a keyboard, monitor and ethernet cable attached to your router. plug in the power to the pi
- should see the linux boot sequence on your monitor
- configure the raspberry pi - here are the options I used:
- boot to command line
- change password of default user (username = pi)
- advanced option: make sure SSH is enabled
- reboot the pi, log in to confirm everything seems to be in order
- (at this point I switched to using my laptop / ssh instead of the keyboard attached to the pi. I disconnected the monitor)
- connect drives to USB hub, connect hub to pi
- I mounted each of the drives to make sure they were working, and copied the readme pdf off of one out of curiosity / to actual test a disk op
- (I partitioned and formatted each of the disks at this step, but realized later this was not necessary)
- became super user: sudo su
- install the tool to create / manage the RAID array:
- apt-get instal mdadm
- create the array:
- mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
- (note the double dashes for the options - the linked blog above only used single dashes. Some man pages only use 1 dash, that's what I tried initially and it did not recognize the options)
- check the array:
- cat /proc/mdstat
- partition the array
- fdisk /dev/md0
- format the array
- mkfs.ext4 /dev/md0p1
- mount & test the array
- mkdir temp
- mount /dev/md0p1 temp
- echo hello RAID > temp/test
- cat temp/test
- unmount the array
- umount temp
- declare victory, go home
I should point out the contents of /proc/mdstat initially indicated that the initial sync would take ~16 hours, but that with the array mounted, that slowed down to almost 4 days! Based on reading this:
I unmounted the array, and then watched the sync speed climb up back to where it was before.
Also useful for when you have to start over:
ReplyDeletehttps://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s2-raid-manage-removing.html