span.fullpost {display:inline;}

Wednesday, July 16, 2008

Mounting Windows Partitions in Ubuntu

Unmount the partition
If you already have your Windows partitions mounted (but with the wrong permissions), unmount them before beginning these instructions. For example, if your Windows partition is mounted as /media/hda1, then open up a terminal and type
sudo umount /media/hda1

Examine the partition table
The first thing we need to do is figure out where the Windows partitions are in the partition table. Typing
sudo fdisk -l

will tell you the location and the filesystem type (FAT32 or NTFS). For example, my sudo fdisk -llooks like this:

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1911 15350076 7 HPFS/NTFS
/dev/hda2 1912 19457 140938245 5 Extended
/dev/hda5 1912 14716 102856131 83 Linux
/dev/hda6 14717 17278 20579233+ 83 Linux
/dev/hda7 17279 17404 1012063+ 82 Linux swap / Solaris
/dev/hda8 17405 19457 16490691 83 Linux


From this, I can see that my Windows partition is type NTFS and is located at /dev/hda1.

Create a mount point
The next thing I need to do is create a mount point. This mount point may already exist as /media/hda1, but I like creating a separate directory altogether:
sudo mkdir /windows

Edit the /etc/fstab file
Now, we need to edit the /etc/fstab file to make the Windows partition mount with the proper permissions (NTFS is read-only in Ubuntu). First, let's make a back-up copy of the /etc/fstab file:
sudo cp /etc/fstab /etc/fstab_backup

Next, let's edit the fstab file:
sudo nano /etc/fstab

This is what it might look like before we change it:

proc /proc proc defaults 0 0
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 /home ext3 defaults 0 2
/dev/hda1 /media/hda1 ntfs defaults 0 0
/dev/hda7 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/hdd /media/cdrom1 udf,iso9660 user,noauto 0 0


Note: Starting with Edgy Eft (Ubuntu 6.10), the appearance of the /etc/fstab file has changed a bit, but the principle still remains. Instead of looking like this:
/dev/hda1 /media/hda1 ntfs defaults 0 0

This is what it should look like after we change it:

proc /proc proc defaults 0 0
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 /home ext3 defaults 0 2
/dev/hda1 /windows ntfs nls=utf8,umask=0222 0 0
/dev/hda7 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/hdd /media/cdrom1 udf,iso9660 user,noauto 0 0


For FAT32 (instead of NTFS)
If we also had a FAT32 partition, say at /dev/hdb1, we would unmount it and create a new mount directory for it:
sudo umount /dev/hdb1
sudo mkdir /fat_files


Then we would add in a line so that our final /etc/fstab would look like this:

proc /proc proc defaults 0 0
/dev/hda6 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 /home ext3 defaults 0 2
/dev/hda1 /windows ntfs nls=utf8,umask=0222 0 0
/dev/hdb1 /fat_files vfat iocharset=utf8,umask=000 0 0
/dev/hda7 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/hdd /media/cdrom1 udf,iso9660 user,noauto 0 0


Save changes
When you're done editing the /etc/fstab file, save (Control-X), confirm (y), and exit (Enter).
Finally, we'd remount them both:
sudo mount -a

If, for some reason, that doesn't work, try rebooting the computer.

Enable read/write for NTFS
If you're using Ubuntu 7.04 (or newer) and want to enable read/write permissions (not just read-only, as the instructions above will give you) for an NTFS partition, follow these directions
Windows NTFS Partitions Read/write support made easy in Ubuntu Feisty

If you're using Ubuntu 6.10 (or older) and want to enabled read/write permissions for NTFS, follow these instructions:
HOWTO: NTFS with read/write support using ntfs-3g (easy method)

0 comments:

Tutorialsland By - Templates4all | Free Blogger and web Templates
Free Website templatesFree Flash TemplatesFree joomla templatesSEO Web Design AgencyMusic Videos OnlineFree Wordpress Themes Templatesfreethemes4all.comFree Blog TemplatesLast NewsFree CMS TemplatesFree CSS TemplatesSoccer Videos OnlineFree Wordpress ThemesFree Web Templates