Sunday, July 26, 2009

Adding a new drive to ubuntu

Given the awesome low prices on hard-drives, i bought myself a Hitachi deskstar 1 TB drive. yep, 1 TERA byte! I still remember the days when 64 MB RAM and 120 MB hard-drive on a Pentium II constituted a "high-end" system.

(sidebar: OK, now I'm officially old. Anytime anyone starts a sentence with 'I remember the days when...', they're fucking officially OLD. So there. I know it's been more than 10 years since I was a teenager and I'm comfortable with it :P)

  1. Windows installation was a cinch:
  2. insert pci card,
  3. power up box,
  4. administrative tools
  5. computer management
  6. disk management (local)
  7. insert driver CD
  8. reboot and navigate back to disk management and assign apposite drive letter (E: for new 1 TB drive, G: for CD, since F: is reserved for the MyBook USB backup and I'd hate changing a whole bunch of rules).

Anyways, the moment I booted up the system into linux, I knew something was off. I was happy that the new drive was instantly recognized, but it came up where my original /dev/sda1 (windows C:) had been. This threw of several mount / mapping rules so that none of my mediatomb shares were available anymore.

the solution to the problem is to use UUIDS.

found the n00b introduction at the following page helpful. (Bing and Google are your friends, though transitivity does not apply in this case).

http://www.unixtutorial.org/2008/05/ubuntu-uuid-how-to/

To see the UUIDs of the various devices known to the system, use the following command:


blkid


the following commands can be used to manually mount the individual drives using UUIDs (UUIDs used in example are not real).


mkdir /mnt/windowsC /mnt/windowsD /mnt/windowsE
sudo mount -t ntfs -U BAADBABEDOOD /mnt/windowsC
sudo mount -t ntfs -U DEADBABEDOOD /mnt/windowsD/
sudo mount -t ntfs -U BAADBEEFFOOD /mnt/windowsE/



EDIT /etc/fstab to create the following entries to allow easier / auto-mounting if needed

more help on fstab can be found at https://help.ubuntu.com/community/Fstab

#/dev/sda1 /mnt/windowsC ntfs-3g,rw,user,auto 0 0
UUID=BAADBABEDOOD /mnt/windowsC ntfs-3g,rw,user,auto 0 0
#/dev/sdb1 /mnt/windowsD ntfs-3g,rw,user,auto 0 0
UUID=DEADBABEDOOD /mnt/windowsD ntfs-3g,rw,user,auto 0 0
UUID=BAADBEEFFOOD /mnt/windowsE ntfs-3g,rw,user,auto 0 0



At this point, a reboot is needed to fix the drive assignments. (ideally you could just issue the following command to remount all drives:


sudo mount -a


However, it might still be worth while to observe system performance after a reboot / cold-start for any glitches, since this will run all necessary prior scripts as well).

No comments: