Sunday, November 30, 2014

linux - How can I fix an inconsistent NTFS file system without Windows?



I have a Dell laptop that came with Windows from the factory. Since then, I have installed Linux and replaced the hard drive with an SSD. The NTFS partition is inconsistent (a result of bad sectors on the HDD) and needs to be fixed, but I cannot boot into Windows to run chkdsk.



How do I fix this problem? Until I do, I cannot move my NTFS partition to expand space on my root filesystem, which is critically low.



EDIT:




All of my partitions were cloned from my dying HDD to my SSD via Clonezilla. There are no bad sectors on the SSD, but the NTFS partition is still in an inconsistent state.


Answer



If the computer has nothing but Linux, you should not be using NTFS. There are no good Linux tools for repairing NTFS damage. (The Linux ntfsfix tool just does some very basic checks and then flags the filesystem as needing more attention from Windows.) Thus, in the long term your goal should be to switch from NTFS to a Linux-native filesystem. In the short term, you should use a Windows emergency disk to repair the filesystem. (Such emergency disks are widely available, but I don't happen to have any URLs handy. Maybe you can find one by searching Microsoft's site.) It's conceivable that you could use ntfsclone to make a backup, too; see the --rescue option in its man page. I've never tried this, though.



Overall, I'd say you should do the following:




  1. Use a Windows emergency disc, ntfsclone, or any other tool necessary to gain access to the partition.

  2. Copy the files from that partition to another disk. You can do this in either Linux or Windows, depending on what's convenient and how you got access to the disk.


  3. Create a Linux-native filesystem (ext2/3/4fs, ReiserFS, XFS, JFS, or maybe even Btrfs) on the partition.

  4. Copy the files back to the original (but freshly-prepared) partition.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...