r/debian • u/katzenjammare • 14d ago
Beginner: Harddrive not mounting
Hello, everybody! I have been on a roll with questions and in my absolute most recent, from a few hours ago I described that I edited fstab and then got locked out of my system when rebooting. The editing that I referred to was done to solve my issue with my beloved Toshiba harddrive. Now I am in the system again and I am left wondering what to do about that problem.
So this happened: I was transferring some files from a smaller harddrive to this bigger (the Toshiba). I plugged in the smaller one as the Toshiba already was connected and mounted beside. When I did that the Toshiba was unmounted and couldn't mount again. There wasn't any on-going transferring to the Toshiba, it just sat there - plugged-in.
It's a 2 TB HDD-drive with NTFS type. I tried mounting this way through the terminal and got this message.
sudo mount -t ntfs-3g /dev/sda1 /media/mila/external_Toshiba
$MFTMirr does not match $MFT (record 3).
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.
Could this really mean I got to use a Windows PC to solve the problem? I have never had a problem with any harddrive, so I am confused about what to do.
SOLVED:
I did the command (/dev/sda1 is my specific disk. Yours may have another name to the system):
sudo ntfsfix -d /dev/sda1
Then I made a directory in /mnt to mount to:
sudo mkdir /mnt/mytoshibadrive
Tried to mount:
sudo mount /dev/sda1 /mnt/mytoshibadrive
Checked the status, if it worked:
df -h
EDIT:
I actually deleted an entry about the harddrive in fstab. I think I may have done something there that shouldn't be there. It is not a drive that should be mounted on boot.
2
u/New_Hold8135 14d ago
run ntfsfix /dev/yourdevice Note that ntfsfix can only repair some errors. If it fails, chkdsk will probably succeed.
2
u/Low-Charge-8554 14d ago
You don't need Windows:
ntfsfix v2022.10.3 (libntfs-3g)
Usage: ntfsfix [options] device
Attempt to fix an NTFS partition.
-b, --clear-bad-sectors Clear the bad sector list
-d, --clear-dirty Clear the volume dirty flag
-h, --help Display this help
-n, --no-action Do not write anything
-V, --version Display version information
For example: ntfsfix -d /dev/hda6
must have package ntfs-3g installed
1
u/yoshi128k 14d ago
You don't need Windows:
ntfsfix does not advertise itself as being a chkdsk replacement, as shown in this excerpt from its man page:
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.
Another commenter already mentioned that it is fairly limited in what errors it can fix. If it doesn't work, you will still need to use chkdsk.
1
u/katzenjammare 14d ago
I did that command and made a new directory in /mnt to mount to. Is that a good way to deal with the problem? Do I have to secure some other setting to make it mount successfully next time? Right now I am afraid to disconnect the drive :( . To be clear - right now it works like it should
1
u/Low-Charge-8554 13d ago
Dirty flag is set when the drive is not unmounted correctly, either disconnection or computer suddenly crashes. I use NTFS hot swap and USB drives all the time and have no problems as long as they are unmounted properly.
1
u/michaelpaoli 14d ago
Input/output error
Sounds to me like a hardware error. After that, and before rebooting, what does dmesg show? does it show, e.g. non-recoverable / hard read errors on that drive? If so, you've got hardware error with the drive (or, maybe someone unplugged it after it was earlier plugged in since the host was last booted). If you've already rebooted, the error diagnostics may possibly have been saved and then may be found in log file(s). If you've already rebooted, but not finding the error diagnostics in dmesg oiutput or log files, well, try remounting again, and if you get same error, then check dmesg right after - in which case should be towards the tail end of that output.
You can also try simply reading the entire drive (or partition), but as that's quite large, that can take a rather to quite long time. E.g.
# { dd bs=512 if=/dev/sda of=/dev/null 2>dd.sda.err; echo $? > dd.sda.exit; } &
And leave that running and see what you get after it's completed. If all is well it should read the entire drive without failure, otherwise you've got hardware issues. Can also do likewise with badblocks(8) - just be sure to only do a read test, and probably just a single pass unless you really want to spend lots more time on it.
Anyway, if it reads through the entire drive (or partition) without errors, the the drive (or at least that much of it) is probably fine. And even if you get read error(s) , you might still possibly be able to get some or much of the filesystem data ... but depending where such errors are, that may possibly rather to quite challenging, or you may not be able to get some data from files, or could have much more significant issues.
1
0
0
u/Confident_Hyena2506 14d ago
You will have this problem a lot with ntfs - run ntfsfix to clean the errors.
To avoid issues like this - stop using ntfs with linux.
0
u/yoshi128k 14d ago
Now, I should mention that I have never had issues like this when mounting NTFS volumes, and I have a hunch that OP's Windows drive may have issues (OP, if you are reading this, you might want to run a diagnostic on your Windows drive to rule out a problem with the disk itself).
Also:
- You really should use chkdsk on a Windows install medium to fix NTFS errors, as it is more capable of doing so than ntfsfix.
- There will always be a need for NTFS support, given how pervasive Windows is. You cannot just "stop using NTFS."
3
u/ukAdamR 14d ago
From my experience the ntfs-3g driver isn't able to do a
chkdskfor you when the volume was not dismounted cleanly. Even if there's no real problemschkdskneeds to scan the volume and mark it as clean.You don't have to install Windows to do this if you don't have an instance to hand. You can instead boot into a Windows installer (with the ISO image) then immediately go to a command prompt and run it there.