Professional Loafer
|
Mounting a Windows Partition in Linux
There are two different generally-used Windows FS types. The first is widely used and old: FAT32 (which Linux recognizes and calls it vfat). The second is much newer (and gained wide popularity and use with the release of Windows XP), known as NTFS.
Linux doesn't read both these file systems natively. In fact, chances are you might need to recompile your kernel with support for VFAT (or FAT32) and NTFS. However, take note: NTFS write support is still experimental. At the moment, a user can only modify a file without changing a file size. Further, corruptions and massive data loss have been reported in the past when users have tried to write to their NTFS partitions.
Although the kernel used to recognize NTFS reading as experimental in the past, it is now fully supported without an experimental flag. Writing is, though, still considered experimental as of the 2.6.3 kernel.
Anyways, on with the HowTo.
In your kernel, include support for VFAT and NTFS by compiling them in; hit "Y" when the file types are selected. Personally, I wouldn't recommend adding them in as modules, although I have not tested to see if that would work. What you specificall need to enable is the following:
* DOS FAT fs support
* MSDOS fs support
* VFAT (Windows-95) fs support
* NTFS file system support (read only)
In this howto, I will not discuss how to use write-support in NTFS. I haven't risked it, and I wouldn't recommend it.
Compile your kernel, smack that baby into your boot partition, and reboot.
With that said, we can now mount a Windows partition in Linux.
Please note that there are many different variations on what I am going to explain below.
To mount a partition in Linux using one command (and assuming that the mount point is not in your fstab file), use the following command with the appropriate syntax:
QUOTE
root / # mount -t [filetype] /dev/[location] /mnt/[mountpoint]
Please note that to mount a device, you need to specify a valid mountpoint -- i.e., if the directory doesn't exist, create it. Good examples of names would be, "/mnt/xp" or "/mnt/vfat" or even "/mnt/ntfs".
So, a brief example of loading up a vfat partition that is located normally in Windows under "D:\" would be the following:
QUOTE
root / # mount -t vfat /dev/hda2 /mnt/windows
I used the mountpoint /mnt/windows, and I assumed that the partition was located at /dev/hda2 (since it was called D:\ in Windows).
Now, instead of typing a long command like that every time you want to fire up your VFAT/NTFS partition, it's probably easier to write a line in your /etc/fstab. Please note you have to be root to do this, and that you want to be careful with whatever you put in your fstab. (you can't send your system up in flames for writing something incorrectly in your fstab, but I am not going to be held responsible for anything that goes wrong).
For your fstab, your Linux system expects you to add lines following this syntax:
QUOTE
device location� � � device mountpoint� � � file type� � � options� � � dump/fsck options (integrity test)
Here's a good way to take the same command listed above and write it into the fstab so that the Windows partition located at /dev/hda2 is loaded automatically:
QUOTE
/dev/hda2� � � /mnt/windows� � � vfat� � � defaults,auto� � � 0 0
The defaults option passes the default parameters to mount. "auto" means that the partition is mounted automatically at boot.
However, the problem with this chunk of the fstab file is that only root will be able to enter and write to your vfat partition.
To change this, we are going to use a variety of commands.
Below is an example of a setup that would allow any user to access the drive and write to it:
QUOTE
/dev/hda2� � � /mnt/windows� � � vfat� � � defaults,umask=000� � � 0 0
umask can be compared to chmod. The three numbers represent access levels for the given mount. The first number is the number which sets the permissions everybody has on the mount. The second number represents a certain group number, while the third number represents a users' permission on the mount.
This table below will give more information about the what numbers would accomplish what in the umask setting:
QUOTE
Octal Number | Permission
0 --------> Read and write (and execute for directories)
1 --------> Read and write
2 --------> Read (and execute for directories)
3 --------> Read
4 --------> Write (and execute for directories)
5 --------> Write
6 --------> Execute for directories only
7 --------> No permissions
So here's a hypothetical situation. You want to allow group 730 to read and execute data located in the mount. Here's what the fstab chunk would look like:
QUOTE
/dev/hda2� � � /mnt/windows� � � vfat� � � defaults,gid=730,umask=727� � � 0 0
Make sense?
One quick note before I continue. Careful with the way you syntax your fstab. mount won't like it if you include spaces between your options arguments.
Now I'll finally cover NTFS mounts. Again, I am only going to include read-only NTFS support in this HowTo. I don't want people to eMail me flaming me when they loose gigs and gigs of data on an NTFS drive after they try to write data to the drive. (although realistically this might never happen to you, I've heard of it happening on several occasions; again, I wouldn't take the risk...at least not until the kernel support is deemed non-experimental).
Let's say you have an NTFS partition on /dev/hdb3. It has all your fancy movies and mp3 files. What do you do to mount it? Well, you can try the one-lined mount command again, but adding it to the fstab file is much easier.
Again, let's assume you have kernel support for NTFS already figured out. Here's what the chunk for the NTFS mount would look like in your /etc/fstab:
QUOTE
/dev/hdb3� � � /mnt/ntfs� � � ntfs� � � noauto,user,ro,umask=000� � � 0 0
Note the noauto argument. This means the partition will not be mounted automatically. Any user can mount this partition using the following command (because of the umask argument):
QUOTE
joe ~ $ mount /mnt/ntfs
Small note: The umask=000 does indeed mean that any user can read, write and execute. However, the ro syntax takes presidence over the umask argument. Any user will be able to read, mount, and execute files from the mount, but ro will prevent writing to the partition. Take note, an attempt to write to a partition mounted as shown above will not work because mount will reject the request stating the partition is mounted as read-only.
The mount command above will look through your fstab, find the entry that has your mountpoint as ntfs, and then execute the appropriate command in order to mount your ntfs partition. We didn't have to do this on the vfat partition because the setting "auto" was present which would mount your vfat partition automatically at boot. Kinda nifty, 'eh? Note also the fstab for your ntfs partition entry has "ro." This means read only. No need to mess with the umask settings.
---------------------------------------------------------------------------
As for the Mozillia Firefox using the same profile in Windows and Linux. This isn't possible as far as I know. I looked on Google a bit for answers. The OS' are quite a bit different in the way that they handle file writes and reads. If you notice that Windows systems also use a backslash, whereas linux uses the forwardslash. You can get around this easily enough through linux, but not sure Windows would know what to do.
I'm meaning that you would have to set up a profile in Windows first, and then tell Linux where it is. The folder might be: mozilla\ firfox\ profile\ folder/ . Anyway, I'm just getting at the heirarchy is completely different.
__________________
"You hear the one about the fella who died, went to the pearly gates? St. Peter let him in. Sees a guy in a suit making a closing argument. Says, "Who's that?" St. Peter says, "Oh, that's God. Thinks he's Denny Crane."
Last edited by bendsley; 11-21-2004 at 11:11 AM..
|