Monday, November 12, 2007

Using Windows Partitions/Drives in a Linux OS

How to use Windows XP Filesystem in Linux (Kubuntu 7.04 Feisty Fawn)

This is probably the most basic thing to learn if you want to get started using Ubuntu in a dual boot system. If you are having trouble with things like storing documents on a drive that was formatted under Windows or playing music from your Windows drive this will most likely solve your problem. I should have written this down before because it always bites me in the rear when I do a new install and I pull my hair out thinking it is something more complex than it is.

A brief overview of file systems. Your computer stores and retrieves information from a medium like a hard drive or disk using a predefined system of dealing with data, ie a file system. The default system for XP and Vista is NTFS. The default for most Linux Operating Systems is Ext3, and sometimes Ext2. They are pretty much mutually exclusive - Windows does not even acknowledge the existence of an ext3 formatted drive (shows up as unformatted) without special software, and until recently Linux OS's could only read from NTFS and not write to it (ie save stuff to it).

Enter NTFS-3g, a development that has really made dual boot systems usable because it allows a Linux OS to read and write to NTFS so that you can share disk space between Windows and Linux. Therefore you can put music on an NTFS partition and play it from both a Linux and Windows OS, or movies, or pdf files, or whatever.

These instructions are specific to Kubuntu 7.04 but they can be easily tweaked to be used under any Linux OS that uses ntfs-3g.

Install the necessary utilities. In a terminal type:

sudo apt-get install ntfs-config

This will also install a gui that allows you to different choices - you can get specific instructions here(Skip down to the Configuration section).

To see exactly what partitions are available to me I use GParted Partition Manager under Start>System>GNOME Partition Editor, which I describe using in more detail in my blog about setting up a dual boot system. This shows exactly which partitions are there and what file system they are using. This is especially useful if you have two hard drives because it seems Ubuntu only automatically recognizes partitions on the one that it is installed on (hda or sda). Make a note of all the ntfs drives by the name they are associated with - ie sda1 or sda7 or hdb3 (I'll use these as examples earlier). Next you can go to /media and see if those drives are there. If they are you can see if they are mounted by clicking on them and seeing if any files show up. If they are not, ie there are no folders or icons marked hdb3, then open a terminal and type

sudo mkdir /media/hdb3

and one will magically appear!

Now to mount your ntfs drive. BTW 'mount' is linux/unix terminology for making a drive available, so although a drive will show up in GParted, usually as /dev/hdb(N), you cannot access the drive until it is mounted. Mounting a drive transfers the files on the drive to a folder that you can then access. The folder is usually in /mnt or, as in Ubuntu, /media. The command to do this is as follows:

sudo mount -t ntfs-3g /dev/hdb3 /media/hdb3

This will now allow access to the files on /dev/hdb3 to be accessed by clicking on /media/hdb3.

To automatically mount the drives on system start up you can install the automatix package manager and use their tool for automatically mounting ntfs and fat32 drives.

Learning to use Linux is well worth the time and challenge. I recommend using a virtual machine first but moving on to a dual boot system and using Linux with the full power of your machine. I am not one of those people hell bent on taking down Microsoft but I do think it is fun and worth the time to explore different options.

UPDATE (5-12-2008) I now think it is much better to edit the /etc/fstab file, both from a functional standpoint and from a learning perspective. Here is an excellent and informative post. I used the ntfs-config tool initially and then edited the script that generated which led me to the realization that putting tabbed spaces in the script to make everything look pretty was what was causing it to not work for me initially! Gparted was very helpful as well. There seem to be some issues with Automatix being potentially dangerous as well. Here is a very informative blog outlining problems with Automatix.

No comments: