Столкнулся с проблемой подключения винта разбитого под Windows (ntfs) к машине с бубунту. При попытке монтирования выдавал ошибку —
An error occurred while accessing 'Домашняя папка', the system responded: Не удалось выполнить запрошенную операцию.: Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0). Failed to mount '/dev/sda1': Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation for more details.
Следовать данному совету как-то не очень хотелось, то бишь перетыкать винт в машину с вендой и запускать chkdisk, а потом обратно переподключать …. брр, как-то слишком много действий.
Гугл подсказал прекрасную утилиту — ntfsfix, входящая в состав ntfsprogs, которая прекрасно справилась с данной ошибкой.
Из описания пакета —
ntfsfix — утилита которая исправляет некоторые основные ошибки NTFS. ntfsfix не является линукс-версией chkdsk. Она только исправляет некоторые базовые проблемы NTFS, сбрасывает файлы журнала NTFS, назначает проверку целостности файловой системы штатными утилитами Windows при ее следующей загрузке.
Устанавливаем —
sudo apt-get install ntfsprogs
И проверяем наш раздел —
$ sudo ntfsfix /dev/sda1 Mounting volume... $MFTMirr does not match $MFT (record 0). FAILED Attempting to correct errors... Processing $MFT and $MFTMirr... Reading $MFT... OK Reading $MFTMirr... OK Comparing $MFTMirr to $MFT... FAILED Correcting differences in $MFTMirr record 0...OK Correcting differences in $MFTMirr record 1...OK Correcting differences in $MFTMirr record 2...OK Correcting differences in $MFTMirr record 3...OK Processing of $MFT and $MFTMirr completed successfully. Setting required flags on partition... OK Going to empty the journal ($LogFile)... OK NTFS volume version is 3.1. NTFS partition /dev/sda1 was processed successfully.
где sda1 наш раздел с ntfs.
После данных нехитрых манипуляций диск легко примонтировался.
MY NTFS Partition has gotten corrupt somehow (it’s a relic from the days when I had Windows installed).
I’m putting the debug output of fdisk and blkid here.
At the same time, any OS is unable to mount my root partition, which is located next to my NTFS partition. I’m not sure if this has anything to do with it, though. I get the following error while trying to mount my root partition (sda5)
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
ubuntu@ubuntu:~$ dmesg | tail
[ 1019.726530] Descriptor sense data with sense descriptors (in hex):
[ 1019.726533] 72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00
[ 1019.726551] 1a 3e ed 92
[ 1019.726558] sd 0:0:0:0: [sda] Add. Sense: Unrecovered read error - auto reallocate failed
[ 1019.726568] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 1a 3e ed 40 00 01 00 00
[ 1019.726584] end_request: I/O error, dev sda, sector 440331666
[ 1019.726602] JBD: Failed to read block at offset 462
[ 1019.726609] ata1: EH complete
[ 1019.726612] JBD: recovery failed
[ 1019.726617] EXT4-fs (sda5): error loading journal
When I open gparted (using live CD), I get an exclamation next to my NTFS drive which states
Is there a way to run chkdsk
without using windows ?
My attempt to run fsck
results in the following :
ubuntu@ubuntu:~$ sudo fsck /dev/sda
fsck from util-linux-ng 2.17.2
e2fsck 1.41.14 (22-Dec-2010)
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
Update: I was able to fix the NTFS partition running chkdsk off Hiren’s BootCD, but it seems that the superblock problem still remains.
Update 2: Fixed superblock issue using e2fsck -c /dev/sda5
NTFSFIX(8) | System Manager’s Manual | NTFSFIX(8) |
NAME
ntfsfix — fix common errors and force Windows to check NTFS
SYNOPSIS
ntfsfix [options] device
DESCRIPTION
ntfsfix is a utility that fixes some common NTFS problems.
ntfsfix is NOT a Linux version of chkdsk. It only repairs some
fundamental NTFS inconsistencies, resets the NTFS journal file and schedules
an NTFS consistency check for the first boot into Windows.
You may run ntfsfix on an NTFS volume if you think it was
damaged by Windows or some other way and it cannot be mounted.
OPTIONS
Below is a summary of all the options that ntfsfix accepts.
Nearly all options have two equivalent names. The short name is preceded by
— and the long name is preceded by —. Any single letter
options, that don’t take an argument, can be combined into a single command,
e.g. -fv is equivalent to -f -v. Long named options can be
abbreviated to any unique prefix of their name.
- -b,
—clear-bad-sectors - Clear the list of bad sectors. This is useful after cloning an old disk
with bad sectors to a new disk. - -d,
—clear-dirty - Clear the volume dirty flag if the volume can be fixed and mounted. If the
option is not present or the volume cannot be fixed, the dirty volume flag
is set to request a volume checking at next mount. - -h, —help
- Show a list of options with a brief description of each one.
- -n,
—no-action - Do not write anything, just show what would have been done.
- -V, —version
- Show the version number, copyright and license
BUGS
There are no known problems with ntfsfix. If you find a bug
please send an email describing the problem to the development team:
ntfs-3g-devel@lists.sf.net
ntfsfix was written by Anton Altaparmakov, with
contributions from Szabolcs Szakacsits. It was ported to ntfs-3g by Erik
Larsson and Jean-Pierre Andre.
AVAILABILITY
ntfsfix is part of the ntfs-3g package and is
available from:
https://github.com/tuxera/ntfs-3g/wiki/
SEE ALSO
mkntfs(8), ntfsprogs(8)
Using a fsck.ntfs
solved my similar problem in a Windows ntfs partition + Ubuntu 20.XX LTS partition (can’t remember exact version):
Running lsblk -f
returns:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
├─sda2 vfat FAT32 1950-4B8D 505,9M 1% /boot/efi
└─sda3 ext4 1.0 29ee8e5b-457e-4610-a503-c8142cc40d68
sdb
└─sdb1 ntfs HDD 42AEC908AEC8F607
sdc
├─sdc1 ntfs Recuperação 04C0478BC0478242
└─sdc2 ext4 1.0 8be461e1-7470-45f6-844c-7559ed2769e9 380,6G 8% /
As you can see, I need to fix my HDD labeled driver (42AEC908AEC8F607), so ln -s /bin/ntfsfix /sbin/fsck.ntfs
and after an fsck /dev/sdb1
solved for me, even loggin windows ‘refuse to mount’ FAILED:
root@bruno-andrade:/home/bruno# fsck /dev/sdb1
fsck from util-linux 2.37.2
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... FIXED
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.
Thanks to @tanguy in his answer: fsck an ntfs drive in Linux
In this article, we will show how to fix NTFS failed to mount errors such as “Failed to mount ‘/dev/sdax’: Input/output error, NTFS is either inconsistent, or there is a hardware fault, or it’s a SoftRAID/FakeRAID hardware”.
The following screenshot shows an example of an NTFS failed to mount error.
To fix this error, you can use ntfsfix, a tiny and useful utility that fixes some common NTFS problems. A ntfsfix is part of the ntfs-3g package (an open-source implementation of NTFS) and it repairs several fundamental NTFS inconsistencies, resets the NTFS journal file, and schedules an NTFS consistency check for the first boot into Windows.
To run it on our computer, you need to install the ntfs-3g package as follows.
----------- On Debian, Ubuntu & Mint ----------- $ sudo apt-get install ntfs-3g ----------- On RHEL, CentOS & Fedora ----------- $ sudo yum install epel-release $ sudo yum install ntfs-3g
Once you have the ntfs-3g package installed, run the ntfsfix command, provide the NTFS partition that has issues as an argument as shown.
$ sudo ntfsfix /dev/sda5
To perform a dry-run where ntfsfix doesn’t write anything but only shows what would have been done, use the -n
or --no-action
option.
$ sudo ntfsfix -n /dev/sda5
A ntfsfix has another useful switch -b
or --clear-bad-sectors
for clearing the list of bad sectors. This feature is particularly useful after cloning an old disk with bad sectors to a new disk.
$ sudo ntfsfix -b /dev/sda5
Also, ntfsfix supports clearing the volume dirty flag if the volume can be fixed and mounted. You can invoke this feature bypassing the -d
option as shown.
$ sudo ntfsfix -d /dev/sda5
Note: ntfsfix can only repair some NTFS partition errors. If it fails, chkdsk will probably succeed. If you have windows installed, you can also load Windows and run its disk checking program, chkdsk.
A nftsfix is a useful tool for fixing some common NTFS problems. For any questions or comments, reach us via the feedback form below.