3

I'm trying to solve another issue with Windows, so I was going to backup my laptop SSD with my hard drive through Ubuntu but it couldn't read it, because it was in exFAT... so I used this command in this video.

The error on my drive was slightly different, with sdd1 instead of sdb1 so I used sdd1 instead, and now my HDD is 'corrupted' in Windows! Ubuntu is now showing it as a usable drive (it's not greyed out) but it had 200GB of stuff on it (I backed up what I believed to be all photos on it yesterday to my desktop thankfully). I think it may simply be because it can't see the stuff, so is there a way I can undo this?

I realise now that I tried to use an NTFS fix on an exFAT hard drive. I hope it hasn't deleted everything. I was simply trying to make the drive usable in Ubuntu and this happened. I'm really worried, so some help would be much appreciated.

Glorfindel
  • 971
  • 3
  • 13
  • 20

2 Answers2

5

You got a different problem then you believe.

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.

As far as normal usage of ntfsfix goes the most important part of the things it does is that it tells Windows to start a scan of the filesystem on the next boot (that will be independent of the filesystem since this is more like setting a boot option). So if the hard disk has a problem that scan will fail and crash Windows. Maybe that is what you are seeing.

For exFat there is a scanning tool called exfatfsck.

exfatfsck checks an exFAT file system for errors. Note that it cannot repair corrupted FS, it just reports found errors.

But that does nothing other than report problems. It has no options to fix anything.

If your hard disk has problems and it is not formatted NTFS then running ntfsfix is not the cause. Neither of the 2 tools can, from within Linux, destroy your Windows partition.

Please don't try to fix Windows from outside Windows. Use your Windows installation media to run chkdsk. That tool is intended to repair Windows filesystems.

Rinzwind
  • 299,756
  • the drive in question is not a windows drive, it is simply an external USB hard drive that i keep misc files in. after using the command :sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL, the drive actually shows that it is ntfs... does that mean that the ntfsfix has reformatted the drive and wiped it? exfatsck now does not work and yeilds 'access denied' or something similar... i wasnt trying to fix windows problems, simply using ubuntu to access my laptops built in ssd to back it up, as it is not booting windows currently. – Spoder man Aug 29 '18 at 12:58
  • Sorry?! An external drive with ntfs as filesystem is a windows drive."does that mean that the ntfsfix has reformatted the drive and wiped it?" No. ntfsfix can not possibly ever in any way format or wipe a disk. It has no such capabilities. All it can do is mark the hiberfile as obsolete and tell Windows to do a scan of the hard disk on next boot. Here is the source code: https://github.com/nats/ntfsprogs/blob/master/ntfsprogs/ntfsfix.c – Rinzwind Aug 29 '18 at 13:09
  • OK. I assumed that it was ex-FAT because i got an error when trying to initially open the drive in ubuntu, saying that it could not open exfat drives (i believe it was error mounting /dev/sdd1 at /media unknown filesystem type 'exfat'). I just checked the drive's users manual, and the drive is indeed 'initialized in NTFS format'... so it puzzles me why it would not let me open it in the first place – Spoder man Aug 29 '18 at 13:18
  • Moreover, by 'windows drive' i thought u meant that it was a drive with windows installed on it. I now realise that what u mean that it is a windows compatable drive, yes?... anyway, the drive is corrupted, and was not corrupted until i ran ntfsfix, so is there a way to undo it? or to fix the corruption at all?? I'm hopeful after you've said that ntfsfix cant wipe a disk - btw thanks so much for the help!!! – Spoder man Aug 29 '18 at 13:23
  • Just checked the drive in Windows disk management... it's saying that it's a RAW file with 100% free space... is this just because it's corrupted? can the data still be on it but it just cant see it? i rly hope i can get it back – Spoder man Aug 29 '18 at 13:44
  • 1
    Sounds bad.Don't use the disk, except for making a disk dump to your working machine. Download "testdisk" and use that to analyze the dump you made. dd: https://blog.kintoandar.com/2010/02/how-to-disk-dump-dd.html make sure to type the correct devices ;) testdisk: https://www.cgsecurity.org/wiki/TestDisk – Rinzwind Aug 29 '18 at 13:47
  • Can i do that with a corrupted disk? i may try that... is there any other way to fix a corrupted disk?? – Spoder man Aug 29 '18 at 13:53
  • 1
    RAW in Windows means it is unformatted. And that is because partition boot sector BS or PBR is corrupted or missing. NTFS keeps a backup which may be valid. See https://askubuntu.com/questions/655290/grub-is-not-letting-me-switch-to-windows-8-dual-boot-process-ubuntu-15-04 Your original issue may have been Windows fast start up as that hibernation flag is set on all NTFS partitions. http://askubuntu.com/questions/145902/unable-to-mount-windows-ntfs-filesystem-due-to-hibernation – oldfred Aug 29 '18 at 14:27
  • 2
    I actually think it's probably due to me pulling the usb hard drive out when ubuntu was still running (there was no option to eject). i'll take a look at that then... – Spoder man Aug 29 '18 at 14:30
  • That could do it yes. – Rinzwind Aug 29 '18 at 14:35
  • exfatfsck now has the ability to repair some of the errors it finds – CervEd Jun 30 '21 at 16:02
5

The answers by @Rinzwind here and in the link

how should I repair exFat data if I run ntfsfix on ubuntu?

are helpful.


You get more details at the following link,

Repair the partition table and file system of a pendrive

Scroll down to the paragraph 'Advanced repair of a partition table, file system and/or recovery of files':

It is a good idea to make a cloned copy and do the recovery work on the cloned copy. That way you need not be afraid to destroy the original drive, if the recovery work goes wrong.

If you want to recover files and TestDisk does not work there is always PhotoRec. It can recover files without a working file system, but it is a lot of work, and you will usually not recover the file names (and not the directory structure), but most common file types can be recovered based on the file content (identifying file headers), as long as they are not overwritten.

sudodus
  • 46,324
  • 5
  • 88
  • 152