Getting back missing Windows hard drives in Ubuntu

[If you don’t want to read through my sob story, scroll down to the Solution bit :p]

As I’m writing, Automatix is bringing my Ubuntu up to speed by automatically installing all the latest goodies that the internet has to offer (V/A codecs, media players, CD burning tools, Picasa and lots of other good stuff …). Last time I checked Windows doesn’t do that for you.

I do confess though that the Ubuntu setup had me scared in the beginning. I have 2 HDs, 80GB master (3 partitions) and a 40GB slave (2 partitions). Yes yes I know they’re tiny. Shut up! So, I go ahead and install Ubuntu on the master, and during setup I select the automatic option which partitions free space and uses that for root and swap space. Everything is going fine until Ubuntu gets installed and is loaded.

Now I go to Computer (same as Window’s My Computer), where it shows all the partitions of my hard drive. I merrily double click on one and it gives me a pmount error, saying that the device isn’t a removable media. Of coarse it isn’t, it’s a hard drive! Anyway, I go to the hard drive manager under System, which displays all the partitions as well. I enter mount points for both partitions of the slave drive and they get mounted successfully from that dialog. I try and do that same for the master partitions, but nothing happens when I click the Enable button. I notice at this point that the file system specified for the slave partitions are different from the master partitions. (the latter have Windows Virtual FS). Convinced that I’ve lost all my data in the 2 partitions of the master drive (1 being in which Ubuntu was installed), I go ahead and startup the Upgrade Manager, and start updating my copy from 6.06 to 6.10 Edgy Eft. After that is done, and my system is booted, I go to Computer again, and find that all my partitions are gone, and there’s just the FileSystem link. I frantically search for the hard drive manager under System, but am unable to find it (they must have taken it out in 6.10 or something).

Solution

Step #1: Finding out which HDs are mounted and which aren’t.
At this point, I turned to the mighty Firefox and start Googling. Two commands that saved the day.
sudo fdisk -l (Will tell you statistics regarding your hard drives & partitions)
Output for me
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 1323 10626966 c W95 FAT32 (LBA)
/dev/hda2 2970 9729 54299700 f W95 Ext'd (LBA)
/dev/hda3 * 1324 2969 13221495 83 Linux
/dev/hda5 3045 6091 24474996 b W95 FAT32
/dev/hda6 6092 9729 29222203+ b W95 FAT32
/dev/hda7 2970 3044 602374+ 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 2434 19551073+ c W95 FAT32 (LBA)
/dev/hdb2 2435 4865 19527007+ f W95 Ext'd (LBA)
/dev/hdb5 2435 4865 19526976 b W95 FAT32

mount (Will tell you which media is mounted at this time)
Output for me
/dev/hda3 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.17-11-386/volatile type tmpfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

Looking at just the FAT32 type partitions, you can clearly see that none but /dev/hda3 are mounted.

Step #2: Manually mounting the HDs you want.
Now I want to mount all the FAT32 drives that are not mounted. Manual commands to do that from the console are:
sudo mount /dev/hda1 /home/jaffer/media/wdigital1 -t vfat -o iocharset=utf8,umask=000
sudo mount /dev/hda5 /home/jaffer/media/wdigital3 -t vfat -o iocharset=utf8,umask=000
sudo mount /dev/hda6 /home/jaffer/media/wdigital4 -t vfat -o iocharset=utf8,umask=000
sudo mount /dev/hdb1 /home/jaffer/media/seagate1 -t vfat -o iocharset=utf8,umask=000
sudo mount /dev/hdb5 /home/jaffer/media/seagate3 -t vfat -o iocharset=utf8,umask=000

Here, /home/jaffer/media/… are folders (mount points in this case) that I made myself. Now I was able to access all my Windows drives without any problems. But these mounts will go away if you restart your machine, so we need to put them somewhere where they’ll be mounted at system startup.

Step #3: Automatically mounting HDs at startup.
The file that you’ll need to change is fstab in the/etc folder.
I did:
sudo vi /etc/fstab
(I prefer vi, but you can open the file in any other editor. Just make sure you have rights to save changes). Learn more about using vi.
and entered the following (slightly modified than the manual ones) commands in the file:
# Manual entries
/dev/hda1 /home/jaffer/media/wdigital1 vfat user,fmask=0111,dmask=0000 0 0
/dev/hda5 /home/jaffer/media/wdigital3 vfat user,fmask=0111,dmask=0000 0 0
/dev/hda6 /home/jaffer/media/wdigital4 vfat user,fmask=0111,dmask=0000 0 0
/dev/hdb1 /home/jaffer/media/seagate1 vfat user,fmask=0111,dmask=0000 0 0
/dev/hdb5 /home/jaffer/media/seagate3 vfat user,fmask=0111,dmask=0000 0 0

A quick way to check if the commands you typed in are correct or not is to run sudo mount -a, which basically executes the fstab file. Or you can reboot and check whether the folders that you’ve specified point to your drives or not.

Worked for me! =D

References:
https://answers.launchpad.net/ubuntu/+source/nautilus/+ticket/1850
http://www.ubuntugeek.com/mount-your-widows-partitions-and-make-it-read-and-writable.html

Coming Soon: Beryl Screenshots!!!

Advertisements

5 thoughts on “Getting back missing Windows hard drives in Ubuntu

  1. Jason Drohn says:

    Ubuntu is a scary animal at first. You are still worlds ahead of me, but if the predicitons prove true, I will have to get familiar with it :0)

  2. Jaffer says:

    Yeah, you need to get your hands dirty to get linux working. But it ROCKS! It’s worth the initial scare 🙂
    Just get yourself familiar with some basic linux commands and read up on the installation process and you should be good to go. Oh, and install the latest version, Edgy Eft, because the Ubuntu UI is getting easier with the latest release, so I’m assuming that the Edgy Eft setup will be a lot better than the Dapper Drake one, that I used.
    Good luck!

  3. dogadder says:

    Hi! I have Edgy and Windows in dualboot.

    I followed your fstab tip about fat32 partitions and it worked for me!
    Just have one question: I have three fat32 partitions that are now writable in Edgy. Only one of them are visible as a icon “device” on my desktop and when i select Places-Computer. I forgot how i got this icon – would you know – since i need it for all three partitions.

    Rrgrds

    dogadder

  4. Jaffer says:

    Glad to hear the fstab thing worked for you dogadder. Hmm … I don’t see any of my drives as separate device icons, neither on my Desktop nor in Places > Computer. If I remember correctly, my drives _were_ visible in this way in Places > Computer when I had Dapper Drake installed, they went away when I upgraded to Edgy.
    I don’t see any options that’ll let me treat my hard drives as separate devices, since Linux doesn’t handle drives like that. You should be able to access your drives in the directories you mounted them to (destinations in the commands for fstab).
    If you can’t get the device icons on your desktop, you can always make shortcuts to those directories and place them where you want them to be ^_^

    Btw, if you do find out how to get those device icons, do tell.

  5. geeza says:

    The steps to recover sounds slick, but I av a problem already in #1. When i run fdisk -l, I don’t get anything. “mount” gives me the following:

    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    tmpfs on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw,mode=0755)
    tmpfs on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw,mode=0755)
    varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
    varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
    udev on /dev type tmpfs (rw,mode=0755)
    devshm on /dev/shm type tmpfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /tmp type tmpfs (rw,nosuid,nodev)

    any ideas?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: