How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

intro   How To Fix A Corrupted Windows NTFS Filesystem With UbuntuHow many of you have had that sinking feeling as your PC boots up? You know, a slight niggle in the back of your mind that says “this is taking longer than usual” before Windows drops dead in front of you, and refuses to play ball.

Me too, and much of the time the original Windows CD/DVD/USB you used in your original install can’t fix the problem. You need something else. Something like a whole operating system, either installed on a separate partition or in Live CD/USB format. Enter Ubuntu!


There’s a good few reasons to have Ubuntu on a CD or USB stick somewhere in a draw. It’s free, to start with. You don’t need to install it to use it, and it’s great for accessing a butchered Windows partition ““ even if it’s just to get your precious documents back before a format.

When it comes to fixing your broken Windows install then Ubuntu has its uses there too. If you happen to break your registry or master boot record, then fear not ““ all is not lost. This technique should work on any Ubuntu-based Linux distributions.

Download, Install & Boot Ubuntu

Those of you who already have a dual-boot Ubuntu and Windows machine can skip this step.

If you’ve not got a Live USB stick then you’re going to need to get hold of one. UNetbootin is a useful tool which enables you to create a USB stick with a bootable version of your favourite open source operating system preloaded. If you’d prefer to use a CD, download an Ubuntu disk image and burn it with ImgBurn.

unetbootin1   How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

If you’re dual-booting, then this is a simple step of choosing Ubuntu over Windows at boot. For Live USB sticks and CDs you’re going to need to enter the BIOS setup as your PC boots (usually by pressing F2 or Del) and arrange your boot devices to prioritize your USB device or CD drive to boot before your main hard drive.

If you’ve done everything correctly you’ll see the UNetbootin bootloader appear. From here you’ll want to boot directly into the operating system. After a minute or two you’ll see the desktop appear, and we’re ready to begin.

Fixing A Corrupted Windows NTFS Partition

Luckily you can schedule an NTFS consistency check within Ubuntu to attempt to repair your tattered Windows partition, but you’re going to need to install a couple of things. It is worth mentioning that this should work with any NTFS drive that refuses to mount in Ubuntu too. Open a Terminal window by clicking Applications, Accessories and then Terminal.

First install NTFS-3G by typing this command:

sudo apt-get install ntfs-3g

Enter your password and hit Enter on your keyboard. Next install NTFSProgs in the same way:

sudo apt-get install ntfsprogs
ntfsprogs   How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

Now with both of those tools at your disposal, you can set about fixing Windows. First locate your Windows partition. In the Terminal type:

sudo fdisk -l
fdisk   How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

You’re looking for an entry that looks like this:

/dev/sda2   *         638       12312    93773824    7  HPFS/NTFS

The important bit is the /dev/sda2 which tells us where the Windows partition is mounted. HPFS/NTFS lets us know that the partition is a Microsoft Windows formatted device, and that little star denotes that this is a bootable partition.

So in my case /dev/sda2 means that Windows is on sda (my internal hard drive) and that it’s partition 2 that I want to play around with.

Armed with this information you want to use NTFSProgs to attempt to fix the partition. In your Terminal window type:

sudo ntfsfix /dev/<device name>
ntfsfix   How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

Replace <device name> with your Windows partition (e.g. /dev/sda2) and enter your password followed by Enter. Your drive will now be mounted, checked for consistency and any errors found should be fixed. Restart your PC to assess the situation, if all goes well you’ll see Windows.

Fixing A Corrupt Master Boot Record

If you’ve got a problem with Windows’ oh-so-important boot record then you can also fix that from within Ubuntu too. Assuming you’ve already booted into Ubuntu, open up Terminal and install lilo by typing:

sudo apt-get install lilo

Enter your password to proceed with the installation, you’ll get a few warnings pop-up along the way.
If you followed the first part of this tutorial you’ll know which partition Windows is installed on, if you missed it type:

sudo fdisk -l

Find the HPFS/NTFS partition that relates to your Windows install, and type:

sudo lilo -M /dev/ mbr

Replace <device name> with your Windows partition (e.g. /dev/sda2) and hit Enter. Ubuntu will attempt to restore your master boot record. You’ll probably want to restart your machine now, just make sure you take any Live CD/USB devices out as you do.

Conclusion

If you’re still having problems with a Windows install, and you’ve tried everything then don’t forget you can mount the partition and rescue as much data as you think you’ll need. Using the terminal, enter:

sudo mkdir /media/windows
sudo ntfs-3g -o force,rw /dev/<device name> /media/windows

Replace <device name> with your Windows partition location and the drive should pop-up on your desktop.

mountwindows   How To Fix A Corrupted Windows NTFS Filesystem With Ubuntu

Has Ubuntu saved your bacon recently? Do you dual-boot with Windows? Thinking about making a Live CD just in case? Let us know below.

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

25 Comments -

0 votes

pceasies

Windows CD/DVD has always worked using chkdsk and fixmbr. Might give it a try in the future as a last ditch effort.

0 votes

Accommodation in Cannes

This is a really excellent read for me. Must admit that you are one of the best blogger I ever saw. Thanks for posting this useful article.

0 votes

Sasha Karasev

thank you

0 votes

Jasjeev Singh Anand

Just the sort o thing I needed. Gonna give it try.

0 votes

Saptashwa

Already done these things…..

0 votes

stan reichardt

Article nicely written and quite understandable.

I’m using Ubuntu 10.04.1 with current updates. Am not able to locate the “ms-sys” package in US repositories. Where can I find it?

Why use “force, rw” options if you are only going to back-up data? Isn’t that a bit risky to an already fragile system?

1 votes

Tim Brookes

It appears the ms-sys package has been removed from the repositories due to licensing issues, so instead I’m putting up instructions for lilo. You can install it by opening the Terminal and typing:

sudo apt-get install lilo

Then repair your MBR by typing:

sudo lilo -m /dev/"device name" mbr

The article will be updated soon, hope this helps.

0 votes

stan reichardt

Article nicely written and quite understandable.

I’m using Ubuntu 10.04.1 with current updates. Am not able to locate the “ms-sys” package in US repositories. Where can I find it?

Why use “force, rw” options if you are only going to back-up data? Isn’t that a bit risky to an already fragile system?

0 votes

Luigi Cavallo

With Windows 7 and Vista using BCD as a means of booting the OS, do these tools help to recover from a corrupted BCD>

0 votes

Steve

BIG NOTE HERE!!!: ms-sys was taken out of the repositories back in Ubuntu 8.0.4. So many sites point to using ms-sys and say “just apt-get install it!” If you were wanting to use ms-sys to restore the MBR, you’d HAVE to download the source code, two libraries (I think), and compile it from source. I’ve done that one more than once to repair the MBR. A tool which IS included on the live CD (last I checked) is “install-mbr” and I believe I’ve had good luck with that tool (http://manpages.ubuntu.com/manpages/lucid/man8/install-mbr.8.html). The other option I’ve read (but not tried) is to repair it using lilo (http://ubuntuforums.org/showthread.php?p=6361212)

0 votes

Tim Brookes

Well spotted, the article will be amended shortly with instuctions for lilo.

ms-sys was removed from the repositories a while ago due to licensing issues.

0 votes

Steve

BIG NOTE HERE!!!: ms-sys was taken out of the repositories back in Ubuntu 8.0.4. So many sites point to using ms-sys and say “just apt-get install it!” If you were wanting to use ms-sys to restore the MBR, you’d HAVE to download the source code, two libraries (I think), and compile it from source. I’ve done that one more than once to repair the MBR. A tool which IS included on the live CD (last I checked) is “install-mbr” and I believe I’ve had good luck with that tool (http://manpages.ubuntu.com/man… The other option I’ve read (but not tried) is to repair it using lilo (http://ubuntuforums.org/showth

0 votes

Tim Brookes

Well spotted, the article will be amended shortly with instuctions for lilo.

ms-sys was removed from the repositories a while ago due to licensing issues.

0 votes

Tim Brookes

It appears the ms-sys package has been removed from the repositories due to licensing issues, so instead I’m putting up instructions for lilo. You can install it by opening the Terminal and typing:

sudo apt-get install lilo

Then repair your MBR by typing:

sudo lilo -m /dev/"device name" mbr

The article will be updated soon, hope this helps.

0 votes

Basie

Ubuntu works!! Had a laptop with Vista and could not boot or access recovery partition. Booted wih Ubuntu sticks and could recover all data. A have to have.

0 votes

TLW

Okay. I’m sold. When I fired up my pc, 30 minutes ago, she went into fixing file mode. I’m no geek. However, I know bad when I see it :)

0 votes

aer conditionat

thanks for this, i had a problem with master boot record and it’s solved

0 votes

Bob

thanks, I made a guess it was possible to recover an NTFS partition, did a web search and bam it worked! nice!

0 votes

Bob

thanks, I made a guess it was possible to recover an NTFS partition, did a web search and bam it worked! nice!

0 votes

Tim Brookes

It’s actually:

sudo apt-get install ntfs-3g

Probably why you can’t find it! Though I wrote this for 10.04, I’m fairly sure it should still work with the latest build.

0 votes

Icerabbitje

Unable to locate package ntfs-g

New to Ubuntu. Latest ubuntu 10.10 running on flash drive to fix an ailing netbook …

0 votes

Tim Brookes

It’s actually:

sudo apt-get install ntfs-3g

Probably why you can’t find it! Though I wrote this for 10.04, I’m fairly sure it should still work with the latest build.

0 votes

Jesper

Thanks – that was just what i neded to “Fix A Corrupted Windows NTFS Partition” -wooderfull, it saved me at least 24 hours of reinstalling.

Many thanks
Jesper

0 votes

Jesper

Thanks – that was just what i neded to “Fix A Corrupted Windows NTFS Partition” -wooderfull, it saved me at least 24 hours of reinstalling.

Many thanks
Jesper

0 votes

Grogan Ryan

I Had The Cd Come, I Did Try It, It Works, But You Can’t Download Anything.