Tag: Unix

Grow / Change mdadm 2 Drive Raid Level-1 to Level-5

Scenario:
I had two 1tb drives raided with mdadm level 1. I finally filled up my raid, and wanted to ultimatly add another 1tb to the raid. Therefore I wanted to change my raid to level 5, and add this third drive. As a result the raid should become 2tb in usable space. However I don’t have spare harddrive space avaiable to backup everything, to create a three drive level 5 raid. Basically what i’m saying, I had to make this change using live data.

After much research via google and linux irc channels no one seemed to give a straight answer about how to make a level 1 mdadm /dev/md# drive into a level 5 drive. I was advised not to do this because it was risky and because it wouldn’t work. Well thier right, it’s impossible, but there is a work around. Well guess what…… I did it, and it’s not that difficult. If you are confortable with linux it’s easy, you just need to understand the logic.

This tutorial will not tell you the specific commands, and what to type in. So if your not familar with basic linux commands your going to need some additional resources.

Required:

  • i used mdadm v2.6.9
  • be confortable with linux
  • have the balls to do this

Legend:

/dev/sda = 1tb harddrive
/dev/sdb = 1tb harddrive
/dev/sdc = 1tb harddrive

/dev/md0 = /dev/sda1 + /dev/sdb1
/dev/sdc = newly purchased drive

Logical Steps:

  1. physically add your third harddrive to your computer. (edit mdadm.conf if drive names changed)
  2. fdisk / mkfs.ext3 / mount your third drive to a temporary location such as /mnt/temp
  3. move all your /dev/md0 contents to wherever you mounted /dev/sdc1, then umount /dev/sdc1 if you wish
  4. comment out /dev/md0 in /etc/fstab
  5. stop /dev/md0
  6. rm /dev/md0
  7. delete mdadm.conf, or just rename it
  8. format / mkfs to clean out the drives /dev/sda and /dev/sdb
  9. mdadm –create /dev/md0 –level=5 –raid-devices=2 /dev/sda1 /dev/sdb1
  10. monitor /proc/mdstat    …. (cat /proc/mdstat), and wait for it to sync
  11. dont forget to mkfs.ext3 /dev/md0
  12. readd /dev/md0 to the /etc/fstab
  13. i rebooted just to make sure it would work
  14. remount /dev/sdc1 to your temporary location, and copy everything back onto your raid
  15. clean out /dev/sdc
  16. grow the /dev/md0 with /dev/sdc
  17. make sure mdadm.conf is correct
  18. Done

Problems / Answered Questions:

Raid would fail on boot
When i physically added the third drive into the computer my raid failed on boot, the drive names were rearraged. So i had to check the drives names and edit mdadm.conf

how much space does a two drive level 5 raid have, how does it work?
This question really irritated me because no one would give me a straight answer. Some said it’s not possible, while others said it would act if the third drive is failed, and others said drive two would be parity. Well the answer is the second drive will be a parity. For those who do not believe me check the screen shots below. So basically it”s a level 1 drive. Argue what you want with me, I don’t care. All i cared is that it would hold my my stuff, until i added the third drive.


OEM Hitachi HDT721010SLA360 Not Working In Vista

I purchased two new OEM Hitachi HDT721010SLA360 1TB hard drives from TigerDirect. When i put those bad boys in, Vista installed them properly. However the drives didnt not show in “My Computer”. I checked for lose sata connection, updated the bios, uninstalled, then reinstalled…. no luck. To fix the problem just use fdisk in any *nix os. Here is simple step by step.

1. Go to http://www.xubuntu.org/get and download urself a “desktop” iso

2. Burn it

3. Reboot your computer and boot the live cd (without installing)

4. Find the Terminal….called “Terminal”

5. type in ” sudo fdisk -l “. This is going to list all the hard drives connected to your computer.  Make sure you pick the right one. Since these are sata drives it should be called sd*,  (sda, sdb, sdc…etc)

6. When u figure out which drive u need type “sudo fdisk /dev/sda” (switching “a” with the drive you want)

7. Type “n”, to create a new partition

8. Type “1″, 1 being the partition number.

9. Type “<enter>” … twice. This is just selecting beginning and ending of the drive.

10. Type “i”, This is to change the format

11. Type “b”, This is to select Win 95FAT32. Basically good enough for windows to recognize the drive.

12. Type “w”, Nothing has happened until you write

13. Wait until ur prompted to type. This means it’s done

14. Reboot, into vista

15. Vista will ask you to reformat… do so to whatever you like, and your done :)


  • Sponsors

  • Twitter Feed

  • Comments

  • Copyright © 2009-2011 SK3TCHY. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress