3

I try to access an external hard drive with an ntfs filesystem from NixOS.

Is it correct that I have to create a mounting point? Where do you usually create a mounting point?

sudo mkdir -p /media/b/TDrive sudo chmod a+rwx /media{,/b,{/TDrive}} sudo chown -R b:users /media 

and everything looks good:

$ ls -ld /media/b/TDrive drwxrwxrwx 2 b users 4096 Oct 21 11:42 /media/b/TDrive 

But when I mount the external hdd, the permission and ownership change.

$ sudo mount /dev/sdb1 /media/b/TDrive $ ls -ld /media/b/TDrive/ dr-x------ 1 root root 4096 Oct 18 15:02 /media/b/TDrive/ $ cd /media/b/TDrive/ bash: cd: /media/b/TDrive/: Permission denied 

What can I do?

The above problem doesn't happen on another computer running Ubuntu.

5
  • Read man mount, there are NTFS options. Be sure that the Windows system(s) you connect the drive to have "Fast Boot" turned OFF, or the drive will look funny to Linux. Beware some Windows updates turn "Fast Boot" ON. Commented Oct 21, 2021 at 21:52
  • Be careful not to write to an NTFS drive from a Unix-based OS! It may corrupt the drive. The proposed fix for this bug has not yet made it into the kernel, at least on Linux. Commented Oct 21, 2021 at 22:11
  • @waltinator The above problem doesn't happen on another computer running Ubuntu. Commented Oct 21, 2021 at 22:19
  • 1
    @MikeWaters The above problem doesn't happen on another computer running Ubuntu. Commented Oct 21, 2021 at 22:19
  • wiki.archlinux.org/title/NTFS-3G Read the manual... Especially this "ntfsfix /dev/your_NTFS_partition" Commented Oct 22, 2021 at 8:00

1 Answer 1

1

Is it correct that I have to create a mounting point? Where do you usually create a mounting point?

In most cases, no, you don't need to create a new directory as a mounting point. Modern GNU/Linux distros (at least desktop-oriented ones) with desktop environments will do that for you. For example, if you use Plasma or Gnome to graphically mount your external hard drive, a new folder will be created at /run/media/<your_username>/<label_partition>/ and used as mounting point to your disk. This directory will be deleted when you unmount the disk, too.

Whenever I manually mount anything, I usually create a subdirectory at /mnt. For example, /mnt/backup or /mnt/iso_image.

What can I do?

I have never used NixOS before, but it doesn't look like a generic desktop-oriented distro based on a quick reading on their website. Things that work out of the box on Ubuntu may need some additional configuration on NixOS. In particular for your problem, in their wiki they mention that you should enable NTFS suppport.

So after you do that, try to mount with

# mkdir /mnt/my_disk # mount -t ntfs-3g /dev/<your_disk_partition> /mnt/my_disk 

Read the ntfs-3g man page for more details, specially regarding permissions. The previous command will mount your ntfs partition with standard Linux permissions applied.

Also, as pointed out by @waltinator, double check that the ntfs partition is not left in an inconsistent state by Windows. ntfs-3g will warn you and mount the partition in read-only mode. But probably this is not the case if you were able to mount the same disk using Ubuntu.

5
  • Read man hier - description of the filesystem hierarchy. Commented Oct 21, 2021 at 23:34
  • Thanks. Are mount -t ntfs-3g and mount -t ntfs the same? Commented Oct 22, 2021 at 1:03
  • A second question. What does " enable NTFS suppport." in NixOS mean? What in other Linux distribution (e.g. Ubuntu/Debian) is " enable NTFS suppport." in NixOS equivalent to? Commented Oct 22, 2021 at 3:56
  • Regarding first question, probably they are the same. Check this, but double check because it may be different on NixOS. Commented Oct 22, 2021 at 8:27
  • And regarding the second question, I don't know exactly what it means "enable NTFS support" on NixOS. I suspect that it enables the fuse driver, but you should ask the developers to be sure. In other distors (e.g. Arch Linux), to enable NTFS support you should install the driver and utilities by installing the package ntfs-3g. Commented Oct 22, 2021 at 8:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.