3

After I perform a full system upgrade and install all the drivers, I usually remove Gvfs and all its dependencies and also Gigolo and any other piece of software used in Ubuntu to automatically mount NTFS or FAT partitions. Call me a paranoid, but I find it more reliable and secure this way to separate Windows files from Linux files mainly because of the incompatibility issues that may occur whenever I mix Linux with Windows.

When and if I need to access a NTFS/FAT partition from Linux, I use the mount/umount commands in a terminal and all is fine this way. But my problem is that, though I can mount and entire NTFS/FAT partition, I am not able and I have no idea how to mount just one directory from a NTFS/FAT partition without having to mount the entire partition prior to that. I am not sure if this is even possible but if it is possible, please let me know how to do it.

So far I tried command lines like these:

      sudo mount /dev/sda5/movies/Riddick/ /media/hdd/

      sudo mount directory  /dev/sda5/movies/Riddick/ /media/hdd/

      sudo mount /sda5/movies/Riddick/ /media/hdd/

and nothing works. I can mount and read a partition, be it /dev/sda5/ or /dev/sda1/ but I can't mount just one directory from that partition. Any ideas?

2

/dev/sda5 and friends are partitions, a type of block device. They don't have (sub-)directories, but they can contain file systems. Only file systems can have directories. To open a file system use the mount command on the block device that contains the file system:

sudo mount [block device] [mountpoint]

where [block device] is the containing device (in your case apparently /dev/sda5) and [mountpoint] is an existing directory where the content of the file system will appear¹. On success you can then look for your movies in or below [mountpoint].

It is (generally) not possible to only mount a subdirectory of a file system on an otherwise unmounted block device. If this is what you want, an equivalent solution may be symbolic links or bind mounts.

¹ shadowing the previously existing content of that directory.

5
  • It is exactly I was asking about, mounting a subdirectory of a file system on an otherwise unmounted block device (and shadowing the previously existing content of that directory). So, in other words, I go back to mounting the entire partition or, like you called it, block device. I understand and thank you for your prompt clear answer. – Taz D. Sep 26 '14 at 18:32
  • I added a link to a related problem/solution in my answer, that you may find helpful in that case. – David Foerster Sep 26 '14 at 18:37
  • I know that link, I run a search before asking the question but, no offence, it seems pretty useless to mount a folder after I already mounted the partition/block device where the folder is located. Either this or I am just too slow and can't fully understand that guide. – Taz D. Sep 26 '14 at 18:43
  • I prefer to suspect that your use case just doesn't profit from bind mounts, but I wanted to let you be the judge of that, because you don't go into much detail about it or at least I don't really understand it. – David Foerster Sep 27 '14 at 15:38
  • Yes, it says in there exactly what you told me namely ... make sure that the block-level device is mounted. You can't directly mount a subdirectory of a partition without first mounting the partition. It is why I said it's useless, at least for me. I was hoping there is some easy way or maybe some piece of software that can help me mount just a target directory from a whole partition. But I did found an easier way. I run Ubuntu inside Windows (wubi), and I created a folder on my host partition exactly for this purpose, to be able to read windows data without having to mount anything. – Taz D. Sep 27 '14 at 21:02
2

You can't directly mount a subdirectory of a partition without first mounting the partition.

you can not mount just a folder from a partition, if you want to mount a folder you will need to mount its partition first. or better if you want mount just a folder it will mount its partition automatically.

2
  • 1
    David Foerster explained it to me more extensively in its answer to my question so I finally figured it out. Not possible for just one folder, only for an entire partition or, like IT pros call it, a block device. Thank you for your answer. – Taz D. Sep 26 '14 at 18:36
  • “Partition” is not wrong (they are partitions indeed), but that's not the important thing here, since mount only cares that you mount from a block device. There are many other block devices besides disk partitions. – David Foerster Sep 26 '14 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.