Black and White.

Wednesday, June 27, 2007

Ubuntu Tricks - How to mount your Windows partition and make it read/writable with NTFS-3G

vista3.jpg

Previously I looked at mounting your NTFS drive on your Ubuntu box using raw Fuse to do it. Now we’re going to look at what may be a better way to do it. It’s certainly easier and from reports, NTFS-3G is a bit more stable as well. This Howto is written specifically for and from Ubuntu 6.10 - Edgy Eft but should work on any Debian based distro.


It should be noted that NTFS-3G is a BETA project (It’s sinced moved to release 1.0) and as such may contain bugs and issues. Writing to NTFS from Linux may be unstable so you should use this at your own risk.

The first thing you’re going to have to do is install NTFS-3G. Let’s open up a terminal session and do the following:

sudo apt-get update

sudo apt-get install ntfs-3g

You’ll be prompted to install this and several other dependancies as well. If you run into errors where ntfs-3g can’t be found, check out this article about adding extra repositories.

Now that NTFS-3G is installed, it’s time to tell your box to use it to mount your NTFS partition. Let’s find out where exactly that is. Back in your terminal type

sudo fdisk -l

You should get something that looks like this:

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2550 20480008+ 7 HPFS/NTFS
/dev/sda2 2550 7493 39707451+ f W95 Ext’d (LBA)
/dev/sda3 7494 9729 17960670 83 Linux
/dev/sda5 2550 7394 38911288+ b W95 FAT32
/dev/sda6 7395 7493 795186 82 Linux swap / Solaris

We’re interested in the partition that says HPFS/NTFS. Notice that on my machine it’s /dev/sda1. You’ll want to keep track of this for yours. I suggest spelling it out in leftover Halloween candy on your desk, or for a spooky effect, use fake blood.

Now that you have your info on the NTFS partition, let’s edit the fstab file in your /etc directory to use NTFS-3G.

sudo cp /etc/fstab /etc/fstab.bak

Always make backups of stuff like this. Really.

Many Ubuntu users will find that the fstab already reflects their NTFS drive as mounted in the /media folder. This is standard but does not allow write access, only read access. We’re going to change this to use NTFS-3G. To see what you have do the following:

cat /etc/fstab

If you have a mount point already for your NTFS partition, it will look something like:

/dev/sda1 /media/sda1 ntfs defaults,nls=utf8,umask=007,gid=46 0 1

You’ll want to replace the bit that says ntfs with ntfs-3g, so it looks like this:

gksu gedit /etc/fstab

Now add:

/dev/sda1 /media/sda1 ntfs-3g defaults,nls=utf8,umask=007,gid=46 0 1

Replace the /dev/sda1 bit with whatever you wrote down from your fdisk -l output and save the file.

If you don’t have this listed at all, you’ll want to create a mount point in your /media folder. If you want to call it ‘windows‘ then you’d make a directory under /media called windows:

sudo mkdir /media/windows

Then add the below line to your /etc/fstab file:

gksu gedit /etc/fstab

Now add:

/dev/sda1 /media/windows ntfs-3g defaults,nls=utf8,umask=007,gid=46 0 1

Finally, restart your machine. Your Windows partition should now be on your desktop, and you can access it through your terminal by going to /media and then cd into the directory your using.


source:arsgeek

No comments: