3

I have Linux mount question.

I have a dual-boot Win7/Linux machine.
My main OS is Windows, and that's where most of my work lives.
Generally all work done under Linux, is to be migrated for further Win usage.

I would therefore like to mount my NTFS partitions onto my Linux OS.
However, I wish to protect me from me.
I would like to (say) mount my Win-Desktop folder, as a device of its own, without mounting the whole relevant drive.
Is it possible? Further more, if it's not possible, I at-least want the drive to be mounted without being visible on the Linux desktop, and just have the Win-Desktop folder visibly mounted.

I would appreciate any comment, or past expiriance.

4 Answers 4

5

I realize this question is almost two years old, but I answer it for those who find this in search and need the answer.

First, mount your Windows partition as read-only. If your Windows partition is the first partition on your first hard drive add this to the file /etc/fstab:

/dev/sda1       /mnt/windows   ntfs  ro,umask=0222,defaults 0 0

You have to create a directory called windows first.

mkdir /mnt/windows

If you want to mount the partition after boot and not be logged in as root, use this:

/dev/sda1  /mnt/windows   ntfs  user,ro,umask=0222,defaults 0 0

To mount a specific Windows directory as read and write, use ntfs-3g or fuse-ntfs-3g. Most people will want to mount their Documents, so I will use this use example. If you are user David on Windows and david on Linux, use this (substituting fuse-ntfs-3g for ntfs-3g or whatever current kernel module you have installed):

/mnt/windows/Users/David/Documents  /home/David/Documents  ntfs-3g  rbind,user,umask=0222,defaults 0 0

rbind is what remounts an already location to another. For a more detailed explanation of other options in the comma separated list, type info ntfs-3g in a command console. The Documents directory in Linux must exist and should be empty. This line must be after the line that mounts the Windows partition.

This is for Windows Vista and 7. If you have Windows XP, use /mnt/windows/"Documents and Settings"/David/Documents. The quotations are important because mount cannot accept spaces in the directory name even though Linux has no problems with spaces in directories.

If you don't have a kernel module that can mount NTFS as read and write, you need to install one.

Ubuntu comes with ntfs-3g, automount, and ntfsconfig. Any currently connected partition should be automatically detected and set up to be mounted automatically. Ubuntu also mounts nonnative partitions like Windows under /media instead, usually with the name of the operating system, so your Windows 7 partition is mounted at /media/Windows 7. You will find your fstab entry uses unicode strings for special characters so that the line says /media/Windows\0407, where \040 is substituted for the space without the need for quotes.

To mount David's Windows 7 documents in david's Linux home directory in Ubuntu, put this in /etc/fstab:

/media/Windows\0407/Users/David/Documents  /home/David/Documents  ntfs-3g  rbind,nosuid,user,umask=0222  0  0

I hope this helps.

1
  • 10x Man!!! Cool stuff - appreciate you taking the time to answer. I'm sure it'll also help others. Cheers :) Nov 22, 2012 at 23:54
2

I am not sure whether this is due to an update of mount at some point in the past year or so, but the way suggested by @thomassisson's answer no longer works. According to man mount, rbind can not alter the mount options of the whole drive. Instead, a remount command must be used. I quote the relevant part of the man page below:

mount --rbind olddir newdir

or shortoption

mount -R olddir newdir

Note that the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind. The mount options can be changed by a separate remount command, for example:

mount --bind olddir newdir mount -o remount,ro newdir

Unfortunately, NTFS-3G currently does not seem to support remount. You must first umount the partition and then mount it, which essentially closes the door for the trick.

0

As far as I have tried, you can only mount the entire partition. However you can then make a symlink to the folder of choice and save it as a favorite or display it on your desktop or home directory.

check out this link on how to do this mount ntfs partition

or check this link generic ntfs mount instructions

How to create a symlink

open terminal and sudo

ln -s [TARGET DIRECTORY OR FILE] ./[SHORTCUT]

For example: ln -s /usr/local/apache/logs ./logs

This points a symbolic link "./logs" to "/usr/local/apache/logs"

automount = basic gui instructions

or edit the fstab file see this. personally you shoudl use the gui instructions cause this updates the fstab file

3
  • so how do I automount them now? Feb 28, 2011 at 21:36
  • @David, apended original instructions for automount
    – IanN
    Feb 28, 2011 at 21:43
  • come to think of it you can perform all actions throught the gui in Ubuntu and OpenSUSE
    – IanN
    Feb 28, 2011 at 21:44
0

Since this old question still pops out in 2021 and the accepted answer does not seem to work anymore (as @reflectionalist suggested), I'm updating with a solution I've just found.

The idea is to:

  • mount the windows filesystem as read-write for you
  • … but put the mountpoint in a directory that only root can access
  • then use a binding to the directories you want in a place that you can access

So first:

sudo mkdir /media/root
sudo mkdir /media/root/windows  # mount point for Windows FS
sudo chmod -R 700 /media/root

Then in fstab:

UUID=the_uuid                                /media/root/windows      ntfs uid=your_uid,gid=your_gid,umask=0022,defaults 0 0
/media/root/windows/Users/francois/Documents /home/francois/Documents ntfs rbind                                         0 0

BTW now ntfs is equivalent to ntfs-3g

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .