solie.space

 
Repair NTFS Drive, MacOS by solie.space

Repair NTFS Drive, MacOS

Last update: a year ago Tag : filesystem, ntfs, repairing

Usually we format external drive using NTFS filesystem, for portability and capability between multiple OS we may encounter. Sometimes we just don't properly dismount that drive, leading to a corrupt file/folder, and some weird things, like we couldn't empty the Trash bin.

The MacOS don't provide automatic mechanism to mount/unmount a connected drive in it's sleep and wake up routine, so to avoid external data corruption, we must exit all active apps accessing the drive, and then manually dismount/eject that drive, before we left the computer for a long enough time to sleep/hibernate. This is why I use something like this to keep the mac awake. https://github.com/newmarcel/KeepingYouAwake/blob/master/Screenshots.jpg?raw=true

So, if we use NTFS most probably we already have installed the third party NTFS extension to enable the write function. Without this third party extension, MacOS can't write anything to an external NTFS drive. Actually MacOS has the write capability (since Yosemite, I guess) but it's turned off by default, as it's still an experimental feature, so the safety is the biggest risk. Read this article for further investigation.

This article assumes that we use Tuxera NTFS as an extension, and here we go to start repairing an improperly dismounted external NTFS drive:

  1. Open Terminal.app using launchpad->utilities->terminal, or just type terminal and enter. We'll use this app extensively from the start to the end.
  2. Connect the drive, and check the disk address via typing the command in the terminal: mount [ENTER]. This command will list all mounted drive. Find the external drive (/Volume/DISK_NAME), for example I have '/dev/disk2s1 as external drive.
  3. Unmount (not Eject) the volume by typing: diskutil unmount /dev/disk2s1. You'll have to adjust the disk2s1 to your previous finding. Note that this address maybe changed although we use the very same disk.
  4. Locate the repairer, this will be a long path. In my latest macOS (Sierra), it's in /Library/Filesystems/fusefs_txantfs.fs/Contents/Resources/Support, so you need to go to this location by typing: cd /Library/Filesystems/fusefs_txantfs.fs/Contents/Resources/Support [ENTER]. YMMV, maybe you need to go to /System/Library instead of /Library. Check by typing this command: ls [ENTER]. If you see something like fusefs_txantfs.repair, you're in the right path.
  5. Doing repairing, type: sudo ./fusefs_txantfs.repair -y /dev/disk2s1 [ENTER], here you need to type your password (and ENTER) to continue. The password will not be displayed.
  6. Wait for the repairing process. You may see some input/output error, indicated that your drive has a problem, maybe a serious one: bad sector. You can try this repairing command several times, maybe the input/output error will go away after several repairing.
  7. Done. Close the terminal, and replug the drive. You can try to empty the trash bin and if some garbages still can't be cleared, most likely you have more serious problem than file/folder corruption. Its better for you to quickly backup your data to another disk and reformat the disk completely.

Share this post: