How to fix a non-working Windows hard drive on Linux
Do you have a dirty Windows hard drive running the NTFS file system, are experiencing issues with it and don’t feel like rebooting into Windows? If so, don’t worry! It is possible to fix up a non-working Windows hard drive running Microsoft’s NTFS file system directly from the terminal, and it’s called NTFS-fix.
Install NTFS fix
The NTFS fix tool doesn’t come pre-installed on Linux. Furthermore, most Linux distributions cannot interact with NTFS file systems natively. So, before we can get into how to clean up a hard drive running the Windows file system, we must go over how to set up your Linux OS to be able to interact with the hard drive by installing Ntfs-3g, and some other packages.
To start the installation of NTFS fix, open up a terminal window by pressing Ctrl + Shift + T or Ctrl + Alt + T on the keyboard. Then, follow the command-line instructions that match your Linux operating system below.
Ubuntu
On Ubuntu Linux, the NTFSFix app isn’t installable with its specific package. Instead, the Ntfs-3g package which adds in support for Microsoft Windows NTFS file system will also provide the NTFS fix application.
To install the Ntfs-3g package on your Ubuntu system, use the following Apt command below.
sudo apt install ntfs-3g -y
Debian
Debian Linux is very similar to Ubuntu when it comes to NTFS Fix, as it doesn’t distribute the app as a unique package, but rather as a small piece of the Ntfs-3g package (which gives NTFS support to Linux).
If you’re on Linux and you need this package, go to the terminal window and use the Apt-get command below.
sudo apt-get install ntfs-3g -y
Arch Linux
To gain access to the NTFS Fix utility on Arch Linux, you must load up the NTFS-3g package. However, you should know that the NTFS-3g package is only available in the “Extra” software repository, which needs to be enabled.
Enable extra by opening up your Pacman configuration file using the Nano text editor.
sudo nano -w /etc/pacman.conf
Scroll through to find “Extra” and remove the “#” symbol from the “Extra” line to enable it. Then, remove the # symbols from all of the lines directly below it.
Save the edits to the configuration file in Nano by pressing Ctrl + O, exit with Ctrl + X, and install the package with:
sudo pacman -Syy ntfs-3g
Fedora
On Fedora Linux, support for NTFS and the NTFS Fix app are split between two packages. The Ntfs-3g package and the Ntfsprogs package. To install both on your Fedora system, enter the Dnf command below.
sudo dnf install ntfs-3g ntfsprogs -y
OpenSUSE
OpenSUSE handles NTFS Fix as the Fedora project does. The NTFS userspace driver is in the Ntfs-3g package, while the NTFS Fix utility, and all other things are in the ntfsprogs package. To get everything working, enter the Zypper command below.
sudo zypper install ntfs-3g ntfsprogs
Using NTFS Fix
The NTFS Fix tool is very easy to use on Linux, as the command’s syntax and options are very well explained in the “help” area of the command.
Note: to access the “help” section, run ntfsfix --help
.
To clean up an NTFS filesystem hard drive on Linux with the NTFS fix, start by identifying the drive label of it in the terminal. The quickest way to identify a hard drive’s label on Linux is to use the lsblk command. In the terminal, execute the command below.
lsblk
Look through the drive tree that the lsblk command prints out on screen and do your best to identify the label and partition of your Windows/NTFS hard drive. Unsure what to look for? Check out our in-depth guide on how to find hard drive information on Linux. It goes over the lsblk command much deeper than we can here.
Once you’ve got the label of your Windows/NTFS hard drive and the partition you’d like to scan, pipe it into the command below to run NTFS Fix. In this example, the drive label is /dev/sdX1. Be sure to replace it with your actual drive label.
Note: keep in mind that running this tool doesn’t work 100% of the time. Sometimes, if NTFS Fix can’t take care of the problem, you must boot into Windows and run a chkdsk.
sudo ntfsfix /dev/sdX1
Let the command run its course. When done, everything on your NTFS drive should be in working order!
Clear bad sectors
Need to clear out some bad sectors on your NTFS hard drive? The NTFS Fix can take care of it! Just use the “clear-bad-sectors” command-line switch.
sudo ntfsfix --clear-bad-sectors /dev/sdX1
Clear dirty flags
The NTFS Fix tool can clear any “dirty flags” on an NTFS drive if the “clear-dirty” command-line switch is used.
sudo ntfsfix --clear-dirty /dev/sdX1
Thank you so so much <3
thanks!