Like many other people, I bought WD20EARS drive for an array and thought I would just toss them into my server and set up an array and would be done by sun down. And like many people, I was dead wrong. What was supposed to be a one-night deal turned into a month long battle with RMA's (newegg is pretty fast) and filed SATA cards, bad drives, bad cables, and bad SATA controllers on my old motherboard. So after all this crap, I still had to deal with figuring out how to align partitions on a WD20EARS with a GPT partition table (since the drives have 4KB sectors), and kept finding guides that said to use 0 or 1 or 64 for the sectors to start your partitions with. Well I tried those, and got ridiculously low speeds for syncing the array.
So I read somewhere that Windows 7 knew how to align them properly, so i popped one into my windows 7 box and created a partition on it. It started at sector 2048! (1MB into the disk). So i make an ext4 partition in its place with the same start and ending sectors, and then struggled with that a bit and it kept locking up as the sync got to about 93.2% and then two of the drives would fail out of the array and another would be turned into a spare.
After a week of trying different methods of this i tried setting pins 7 and 8 on the drives, well that failed too, the box wouldn't even boot. I read somewhere that it messed with the controller. So i gave up on that for a few days until i decided to do the same thing but put the disk into my win7 box, and the windows 7 worked fine, i made a new GPT table and did the same with the rest of the disks. I noticed it still didnt get very good read/write performance. I decided to go ahead and try and align the partitions manually even with the 7+8 pins jumped.
Suffice it to say that after some serious trial and error I cam up with a configuration that worked. I have pin 7+8 jumpered on all 4 drives, I created and formatted XFS partitions starting at sector 2048 and ending on sector 3907029134 on each drive. I then "forced" a raid5 creation. And I am currently waiting for that to finish, but am getting GREAT sync speeds, of around 70-90MB/s.
So here are the steps:
- Physical preparation: Ensure pints 7+8 are jumpered (if you don't have jumpers you can buy them are most computer stores or online)
- Download and install the necessary software.
Code:sudo apt-get install xfsprogs
- Change user to root.
- Create the partitions on EACH drive (replace sda with whatever drive you are doing).
Code:parted /dev/sda mklabel gpt yes unit s mkpart xfs 2048 3907029134 quit
- Format the partitions. Do the following for each drive. (again, replace sda with whatever drive you are doing)
- Create the array with the following command (change the number of drives as required and be sure that the devices are correct):
Code:mdadm --create /dev/md0 --chunk=2048 --force --level=5 --raid-devices=4 /dev/sdb1 /dev/sdd1 /dev/sdc1 /dev/sde1
- Create your /etc/mdadm/mdadm.conf file, without this it will fail to recognize the array after you reboot! Execute the following commands:
Code:sudo echo "DEVICE partitions" > /etc/mdadm/mdadm.conf sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
- Wait for the array to finish syncing. You can reboot while it is going, but DO NOT CONTINUE WITH THIS GUIDE (OR ATTEMPT TO PARTITION /dev/md0)UNTIL IT IS COMPLETELY SYNC'D!! You can expect this to take 8-12 hours! You are able to watch the status of it via:
orCode:watch -n 0.2 cat /proc/mdstat
Code:watch -n 2 mdadm --detail /dev/md0
- Format the new array.
- Add the array to your fstab (File System TABle). You can use gedit, or your favorite command line editor. Add the following line to the end of your "/etc/fstab" file.
You can change "/media/raidarray" to wherever you want it to mount on boot.Code:/dev/md0 /media/raidarray auto defaults 0 3
- Mount the new raid array:
Now you should have a raid5 array mounted at /media/raidarray or where ever you put it.