Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

raid

I’ve been scared about losing all my music (around 60 gigs) in a hard drive crash for a long time, and finally this week I got my stuff together and built a RAID. It was slightly tricky.

I had:
  • a 75gb disk, completely filled with music,
  • an 80gb disk, with OS/personal stuff, and an old copy of the music, with some additions not on the 75gb disk.
The hard part is transitioning that data onto a three-disk RAID even though I don’t have another huge disk to copy the data off on to while I mess around with disks.

First, I bought a new 80gb disk so I could have three. Then, the strategy is basically to get the data on one disk, build the RAID across the other two disks, copy the data onto the RAID and insert the data disk into the RAID. It’s complicated by the fact that I had my OS and data in one huge partition on the existing disk, so I had to do some OS bootstrapping first.

So:
  1. bootstrap Debian onto a 5gb partition on the new disk
  2. merge all of the existing data from the other disks onto the old OS disk, copying the leftovers onto my scratch 20gb disk (I bought it when 20gb was a lot!)
  3. unplug the old OS disk so there’s no possibility of me mistyping a command and wiping out my data
  4. establish a three-disk raid across the two older disks with one disk marked missing, and verify it’s working:
        Number   Major   Minor   RaidDevice State
           0       3        2        0      active sync   /dev/hda2
           1      33        1        1      active sync   /dev/hde1
           2       0        0       -1      removed
  5. put the data disks back in, copy all the data to the RAID
  6. and finally, repartition the source disk, insert it as the missing third disk into the RAID, and watch it rebuild:
    martine@bunny:~$ cat /proc/mdstat
    Personalities : [linear] [raid0] [raid1] [raid5] [multipath]
    md0 : active raid5 hdg2[3] hde1[1] hda2[0]
          150127232 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
          [=====>...............]  recovery = 26.2% (19668352/75063616)
                                   finish=47.9min speed=19253K/sec

This whole thing is scary because a wrong command (or a RAID autodetect-and-rebuild somewhere that I didn’t anticipate) could have wiped everything out. But I was careful, and it worked.

Here’s my secret tip:
raidtools (debian package raidtools2, and is the name of the collection of utilities including mkraid, raidstart, and raidstop) sucks, even though they’re what all the RAID docs talk about.

Use mdadm instead. mkraid refused to create my RAID 5 because I was missing a disk, even though I told it the disk was gone in the configuration file; mdadm works through a straightforward command-line interface and was pretty much intuitive.

I’m a little worried about performance. I didn’t do any benchmarking to see what the appropriate chunk size on the RAID / block size in the file system were. But since it’s mostly used for archiving music, it only needs to be able to push about 16kb/sec, which it does easily; otherwise, it looks like it does something like 20mb/sec, which isn’t too bad, I guess?
Subscribe

  • your vcs sucks

    I've been hacking on some Haskell stuff lately that's all managed in darcs and it's reminded me of an observation I made over two years ago now (see…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…

  • found my bug!

    Not too interesting, but this has been bugging me for a week. Been working on a toy program that proxies a TCP connection. It was working fine for…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 7 comments