Monday, October 25, 2010

Ubuntu 10.10 Install Notes

  1. System -> Preferences -> Keyboard Shortcuts
    • Lock Screen: Super + L
    • Run a terminal: Super + `
    • Move Window: Shift + Super + arrows
    • Switch to Workspace: Super + arrows
    • gksu synaptic: Super + S
  2. System -> Preferences -> Keyboard
    • Layout -> Options -> Ctrl Key Position -> Make Caps Lock an additional Ctrl
  3. System -> Preferences -> Appearance
    • Fonts -> Details -> Resolution: 86 DPI
  4. Synaptic (add Canonical Partners Repo)
    • emacs
    • emacs-goodies-el
    • compizconfig-settings-manager
    • compiz-fusion-plugins-extra       -- for the grid plugin
    • inkscape
    • gimp
    • build-essential
    • git
    • mercurial
    • subversion
    • gparted
    • sun-java6-jdk
    • sun-java6-plugin
    • vlc
    • nautilus-open-terminal    -- adds open in terminal to right-click in nautilus
    • wireshark
      • change menu item to "Wireshark (as root)" and "gksu wireshark"
  5. Other software
    • Google Chrome
    • Dropbox
    • Adobe Flash Plugin
    • Kicad nightly
      • add repo: deb http://ppa.launchpad.net/paxer/ppa/ubuntu lucid main
      • install kicad package
  6. home directory structure
    • progs/
      • bin/
      • src/
  7. Emacs setup:
    1. ln -s /home/alex/Dropbox/Public/.emacs .emacs
    2. Install http://code.google.com/p/js2-mode/
  8. System -> Preferences -> CompizConfig Settings Manager
    • Enable Grid
      • Change shortcuts to Super + numpads

Thursday, October 14, 2010

Recovering a fakeRAID0 in Ubuntu

A few years back my motherboard died. I had two 74GB raptor hard drives set up in a RAID0 (striped) array using the motherboard's built in fakeRAID controller. I tried to recover some of the data today and managed to get the old ntfs partition mounted.

I plugged in the drives to the standard SATA ports on my new motherboard. I have Ubuntu installed on a third hard drive. The two raptor hard drives showed up as /dev/sdb and /dev/sdc.

First, make sure you have mdadm installed. mdadm is the linux software RAID management tool:

$ sudo apt-get install mdadm

Now we will try to create a RAID0 array that matches the original fakeRAID one. RAID0 splits data between the drives in chunks, and to read back the data, we need to know which hard drive had the first chunk and how big the chunks were.

To figure which hard drive was first, run fdisk:

$ sudo fdisk -l
Disk /dev/sdb: 74.4 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7962aa02

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 74.4 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3e344803

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1       18070   145147243+   7  HPFS/NTFS

At least /dev/sdc has a partition table, so it was probably the first hard drive in the array.

To find the chunk size, I just guessed. Usually it will be one of 64K, 32K, 16K, 128K, etc. I vaguely remember setting it to 16K when I created the fakeRAID. The moral of the story is write down the chunk size when creating a RAID0 array so that recovery is easier.

Now to create the array. /dev/md0 will be the name of the new array, and the hard drive with the first chunk should be listed first (in my case /dev/sdc):

$ sudo mdadm --create /dev/md0 --verbose --level=0 --raid-devices=2 --chunk=64 /dev/sdc /dev/sdb

Try and mount the new raid array (in my case with NTFS, to /media/old_raid0):

$ sudo mkdir /media/old_raid0
$ sudo mount.ntfs /dev/md0 /media/old_raid0

If the mount fails, try a different chunk size:

$ sudo mdadm --stop /dev/md0 && sudo mdadm --remove /dev/md0
$ sudo mdadm --create /dev/md0 --verbose --level=0 --raid-devices=2 --chunk=32 /dev/sdc /dev/sdb

After finding the right chunk size, the mount should be successful, and a new file system should show up in nautilus. Recovery is as simple as copying files to a different hard drive.