Skip to content

Instantly share code, notes, and snippets.

@geraldvillorente
Last active January 6, 2024 10:01
Show Gist options
  • Save geraldvillorente/0355d660fa58f6351a45 to your computer and use it in GitHub Desktop.
Save geraldvillorente/0355d660fa58f6351a45 to your computer and use it in GitHub Desktop.
How to fix Ubuntu unable to mount NTFS partition
Unable to mount [DEVICE_NAME]

Error mounting /dev/sdc1 at /media/gerald/PicsBooks: Command-line 
'mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sdc1" 
"/media/gerald/PicsBooks"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sdc1': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.

The reason is because you might have probably unplugged the device directly from windows instead of going through Safely Remove Hardware option and hence the NTFS log is not marked unused. Another reason is you are in a dual boot and you mounted the external partition on Windows environment and shutted it down without unmounting the drive.

To fix this.

sudo ntfsfix /dev/[DRIVE_MACHINE_NAME]

Example:

sudo ntfsfix /dev/sdc1

You can check the machine name under /dev/ by using ls command or you can use sudo fdisk -l.

If you recieved an error ntfsfix: command not found that means ntfs utilities are not installed in your distribution. To install the ntfd utilities.

sudo apt-get install ntfsprogs

Once the ntfs utilies are installed you can issue the ntfsfix command again.

Here is the log of mine.

gerald@gerald-desktop:~$ sudo ntfsfix /dev/sdc1
[sudo] password for gerald: 
Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdc1 was processed successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment