3

I'm running Linux ( Ubuntu 11.10 ) and Windows ( 7 ) on the same system on two partitions.

So I have this folder in Windows:

C:\Users\Me\Folder

And I created this folder in Linux:

/mnt/Folder

Now trying to do something like this:

sudo mount /media/ACER/Users/Me/Folder /mnt/Folder

This doesn't work. I'm guessing it has to do with that one can only mount a media and not folders. Anyhow. Is there some way to do this?

Bruno Pereira
  • 73,643
Espen
  • 153
  • Try this:http://www.computerandyou.net/2011/05/how-to-mount-a-windows-partition-on-linux-automatically-on-each-start-up/

    abd in the fstab..specify the folder

    – abhishek Mar 04 '12 at 12:01

3 Answers3

3

Assuming your C: Windows drive is already mounted under /media/ACER, you can create a symbolic link to the subdirectory you're interested in:

$ sudo ln -sf /media/ACER/Users/Me/Folder /mnt/Folder

The -s option tells ln to create a symlink instead of a hard link, and the -f option instructs it to replace /mnt/Folder if it exists, so you won't have to delete it beforehand.

1

You can always mount a drive(aka Paritition, Filesystem) into some folder and not one folder in another.

So in this case, you will need to mount your entire C: or D: to your folder.

In Linux, this folders are seen as /dev/sda1 or /dev/sdb3 or anything depending upon your drive creation and kinds of devices that you used.

to know more about your partitions, you can execute fdisk -l

to know about your already mounted partitions you can do : df -h (h for human readable)

One you have identified, which is your correct partition, like is it /dev/sda1 or /dev/sda2 you can mount them in this way:

sudo mount /dev/sda1 /path/to/your/folder

linuxeasy
  • 131
0

You could create a shared mount point. The advantage over creating a symbolic link would be if you unmount the windows folder this would not leave you with a broken symbolic link which is a security issue. To create a shared mount you first have to "mark" the mount point you are using as shared:

mount --bind /media/ACER/Users/Me/Folder /media/ACER/Users/Me/Folder
mount --make-shared /media/ACER/Users/Me/Folder

now bind a duplicate to /mnt like this

mount --bind  /media/ACER/Users/Me/Folder /mnt/Folder

You can read more about shared mount points in the red hat documentation you can find it here

This should also work for ubuntu i tested it on my debian machine:

root@Alucard:~# mount --bind /media/DATENKORB/ /media/DATENKORB/
root@Alucard:~# mount --make-shared /media/DATENKORB/
root@Alucard:~# mkdir /mnt/DATENKORB
root@Alucard:~# mount --bind /media/DATENKORB/ /mnt/DATENKORB/
root@Alucard:~# cd /mnt/DATENKORB/
root@Alucard:/mnt/DATENKORB# ls
>> DSC_4988.JPG  _MG_6326.geaendert.JPG
root@Alucard:/mnt/DATENKORB# touch test
root@Alucard:/mnt/DATENKORB# cd /media/DATENKORB
root@Alucard:/media/DATENKORB# ls
>> DSC_4988.JPG  _MG_6326.geaendert.JPG  test
l1zard
  • 101