2

I have this external HDD, which has two partitions: one ext4 and one ntfs. However, when I connect it to some devices, the ntfs-3g driver goes crazy and stays in a loop of mounting->unmounting->remounting the ntfs partition. I already removed the ntfs-3g package, but I keep getting error messages related to the ntfs partition being "removed unsafely".

Is there any way I can make this partition invisible to the OS? At least to make it leave the partition alone and not try to do anything with it?

Thanks a lot!

  • http://askubuntu.com/questions/124094/how-to-hide-an-ntfs-partition-from-ubuntu could be the solution you are looking for. – Guruprasad Apr 07 '13 at 19:55
  • Why would you want an unusable drive connected to your computer? Do you dual-boot with Windows? – Gav Apr 07 '13 at 19:56
  • @Gav Yes, indeed I do use my external hdd with windows too. So, when running Linux, I'd like the ntfs partition not to be touched by any ntfs thing of the OS, only the ext4 one... If only I could built-in support for EXT4 in both OS X and Windows, I would never use ntfs again. – Eduardo Bezerra Apr 07 '13 at 20:09
  • @Guruprasad that's a real close one, but the solution breaks if the device name changes (e.g., I connect the usb storage devices in a different order). – Eduardo Bezerra Apr 07 '13 at 20:15
  • 1
    @EduardoBezerra, if you are concerned by changing names, you could use UUID of the disk drive to mount. The command udevadm info --query=all --name=/dev/sdx1 where x is the alphabet corresponding to your drive' will provide all the information about the drive in this aspect. Or you could use the very simple and widely used 'blkid' command sudo blkid /dev/sdXN where X is an alphabet to uniquely identify your drive and N is the partition number – Guruprasad Apr 07 '13 at 20:21
  • @Guruprasad no, that doesn't solve the problem at all because "Supposedly you are still able to mount the drive “by hand”, assuming you know which device it is. You can easily access it using the mount command." I want ntfs from cease existing in my OS. If there is an ntfs partition in my device, the OS (or any application) won't be able to mount it. I want my OS to behave as if such a dreaded file system (ntfs) was never created. Is that possible? – Eduardo Bezerra Apr 07 '13 at 20:48
  • @EduardoBezerra Nope, not possible as far as I know. The only way you could achieve it is by not connecting the drive at all. Or you could use something like a Truecrypt to encrypt the partition so that it becomes unrecognizable to the OS and can be used only by mounting with Truecrypt. But this is not a good solution as it would require fiddling with the NTFS partition. If you uninstall ntfs-3g you will still be able to mount the NTFS partition read-only. – Guruprasad Apr 07 '13 at 20:53
  • Oh right, there is an ntfs kernel module. I could just redirect the kernel module to some fake stuff, like adding install ntfs /bin/false in /etc/modprobe.d/blacklist.conf, but that didn't solve the problem either. I guess I'll give a try to the solution you pointed and hope that no application tries to mount the ntfs partition. Last resort: wipe out the ntfs partition from the hdd completely. Thanks for the tips, bro. – Eduardo Bezerra Apr 07 '13 at 20:59
  • @EduardoBezerra No application should try to automatically mount the NTFS partition unless you have configured it to. I will post my solution as an answer to this question so that you can accept it if it works for you. – Guruprasad Apr 07 '13 at 21:00

2 Answers2

0

How to hide a(n) (NTFS) partition from ubuntu could be the solution you are looking for. It uses udev rules to achieve the result. If you are worried about changing device names, you could use UUID to mount the drive. blkid command will give you the UUID of the drive.

Or if you want to totally disable NTFS support, you could blacklist the NTFS Linux kernel module by sudo gedit /etc/modprobe.d/blacklist.conf and adding the line blacklist ntfs. You might have to reboot for the changes to take effect. I have not tried this out.

  • I have tried both, neither worked. Even if a module is blacklisted, it can be loaded by hand. Also, if another module another, which is not blacklisted, is loaded, it can load the blacklisted module, even if another itself is auto-loaded. – Eduardo Bezerra Apr 07 '13 at 21:17
  • I agree that it can be loaded by hand but why would you do that unless you want to access that drive. If you want cross-platform support, you could go with UDF which is very well supported. – Guruprasad Apr 08 '13 at 06:28
0

You could always uninstall ntfs-3g sudo apt-get purge ntfs-3g You might also want to look into udev rules, they give you a very granular way of dealing with mounting/unmounting devices.

Handy UDEV rules

Creating UDEV rules

Writing UDEV rules

Scott Goodgame
  • 2,636
  • 15
  • 20