How to fix corrupted Windows NTFS file system with Ubuntu
If you happen to break your file system or Master Boot Record on Windows, don't worry, all is not lost. You can use Ubuntu to fix problems related to the Windows operating system. This technique should work on any Ubuntu-based Linux distribution.
Download, Install and Start Ubuntu
Those of you who already have dual-boot Ubuntu and Windows computers can skip this step.
Prepare a USB, download the official Ubuntu installation ISO.
Once done, now it's time to create a new Ubuntu bootable USB. There are several tools to create a bootable USB from an ISO file, but you can use balenaEtcher because it has an intuitive, easy-to-use interface. All you need to do is select the ISO file and device, then click Flash.
If you're dual-booting, here's a simple step: Choose Ubuntu instead of Windows on boot. For live USBs and CDs, you'll need to enter the BIOS setup when the PC boots (usually by pressing F2 or Del) and arrange the boot devices to prioritize the bootable USB device or CD drive before the main hard drive. .
If you did everything correctly, you should see the Ubuntu bootloader appear. From here, you'll want to boot directly into the working OS by selecting Try Ubuntu. After a minute or two, you should see the screen appear and ready to get started.
Fix corrupted Windows NTFS partition
Fortunately, you can schedule an NTFS consistency check to attempt to repair a corrupted Windows NTFS partition from Ubuntu, but you'll need to install some packages first. This should work with any NTFS drive that refuses to mount in Ubuntu.
Open a Terminal and install NTFS-3G by typing the following command:
sudo apt install ntfs-3g
Now you can set up the repair of your Windows installation. First, locate your Windows partition. In Terminal, enter:
sudo fdisk -l
Output:
You are looking for an entry that resembles the following:
/dev/sda9 * 638 12312 93773824 8.9G Microsoft basic data
The important bit is that /dev/sda9 indicates where the Windows partition is mounted and "Microsoft basic data" indicates that the partition is a Microsoft Windows formatted device. You can also identify the Windows drive by looking at the size of the partition (8.9G).
So in this case, /dev/nvme0n1p9 means Windows is using an NVMe SSD and its partition number is 9. Normally, if your Windows partition is on the hard drive, the device name will be /dev/sdax, where x is a number.
Armed with this information, you must use the ntfsfix command to attempt to repair the partition. Type the following into the Terminal:
sudo ntfsfix /dev/
Replace with your Windows partition (eg /dev/nvme0n1p9) and enter the password. NTFS-3G will now mount your drive and check if it's consistent, and any errors found will be automatically corrected.
Restart your PC to assess the situation, and if all goes well, you should see Windows booting up without any problems.
Fix broken Master Boot Record
If you have problems with Windows' Boot Record then you can also fix it from within Ubuntu. Assuming you've booted into Ubuntu, open Terminal and run:
sudo os-prober
Then, recreate the GRUB configuration file by entering the following in the command line:
sudo update-grub
GRUB will now identify the Windows EFI partition on your storage device and attempt to add it to the entry. You'll probably want to reboot your machine now, just make sure you unplug any working CD/USB devices.
Alternatively you can use LILO bootloader. Install it on your system first by typing:
sudo apt install lilo
Enter the password to proceed with the installation. You may receive a few warnings during the process.
Now you know the device name for the Windows installation partition. If you missed it, enter:
sudo fdisk -l
Find the "Microsoft basic data" partition relevant to your Windows installation and enter:
sudo lilo -M /dev/ mbr
Replace with your Windows partition (e.g. /dev/sda2) and press Enter. LILO will attempt to restore the Master Boot Record. Again, reboot the system to check if the problem persists.
Recover data from Windows partition on Ubuntu
If you're having issues with your Windows installation and have tried everything and it still doesn't work, there's still hope. Don't forget that you can mount the partition and save as much data as you think you'll need. Using Terminal, enter the following commands one by one:
sudo mkdir /media/windows sudo ntfs-3g -o force,rw /dev/ /media/windows
Replace it with the location of your Windows partition and the drive will appear on the desktop. The mkdir command created a directory where the Windows file system would be mounted and then, using the ntfs-3g command, you mounted the file system to the newly created directory.
Copy any important data from the Windows file system to the Linux partition. You can then transfer it to a removable media and restore it after troubleshooting the Windows installation.
You can use almost any other Linux distribution to fix such problems with Windows. Some distributions like SystemRescue and Ultimate Boot CD focus entirely on troubleshooting and repairing problems related to booting the operating system, file system, etc.
If the Ubuntu desktop appeals to you, then perhaps you should consider installing Ubuntu on your Windows computer. Or even better, you can dual-boot Ubuntu with Windows, but first make sure you're aware of the risks associated with dual-booting.
You should read it
- Here's how to use Resilient File System (ReFS) on Windows 10
- Disable NTFS file compression to speed up Windows computers
- What is NTFS? What is FAT32? Compare NTFS and FAT32
- How to enable or disable NTFS file encryption in Windows
- Mozilla fixes Windows 10's NTFS crash in Firefox
- Microsoft forces OneDrive users to use NTFS to synchronize
- How to convert a FAT32 hard drive to NTFS on Windows does not lose data
- What is FAT32, NTFS, exFAT format?
- The convert in Windows command
- What is the difference between exFAT, FAT32 and NTFS?
- How to switch from FAT32 to NTFS without losing data with the CMD command in Windows 7,8,10
- Why does USB drive, memory card ... use FAT32 format instead of NFTS?
Maybe you are interested
How to fix the missing language bar error on Windows 11 extremely quickly
Turn off these visual effects to make Windows run smoother!
7 Ways to Customize Windows 11 Notepad
8 settings to change to make your Mac trackpad and keyboard work like Windows
How to add fonts to Word in Windows computer
How to use the file search command on Windows, find saved files