5

This is what happened,

I inserted my (important) external HDD into a RedHat 6 machine, did my task's, unmounted the drive via Nautilus, and physically detached the drive from the machine (and now I realized that, I detached the drive in a hurry while Nautilus (of RHEL6) was writing some thing to the disk).

That hardisk had 3 partitions, 100GB ext4, 50GB ext4 and remaining about 148GB ntfs.

Later I connected it again to my Ubuntu 14.04 machine, and now the two ext4 partitions of the drive are not mounting.

Here is what Gparted says,

enter image description here

and,

enter image description here

also, here is the sudo fdisk -l command's output,

Disk /dev/sdb: 320.1 GB, 320072932352 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142446 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf909bf11

Device Boot Start End Blocks Id System
/dev/sdb1 2048 209717247 104857600 83 Linux
/dev/sdb2 209717248 314574847 52428800 83 Linux
/dev/sdb3 314574848 625141759 155283456 7 HPFS/NTFS/exFAT

I am not that familiar to fsck or fsck.ext4 command, please provide me a direction.

8
  • 1
    Well, you know the command to run: fsck.ext4. Include the device number as the argument (fsck.ext4 /dev/sdb1). Also, when in doubt, man pages help (man fsck.ext4). Aug 5, 2014 at 19:18
  • @saiarcot895 - Thank you for your suggestion, I do know a bit of fsck.ext4 and how to run it, but I don't know it's exact outcomes. Like will it reset the file system tables? or Will I be able to get my data back?, because I don't want to lose the data present in it.
    – Sat93
    Aug 5, 2014 at 19:24
  • I believe that it will try to recover the ext4 superblock and try to complete any writes that weren't fully written to the disk (is currently in a journal). You can use the -n option initially to mount the filesystem in a read-only mode to get a status report. Aug 5, 2014 at 19:29
  • @saiarcot895 - I just now tried what you suggested, the check dumped a whole lot of things while the Pass 5: Checking group summary information, also there were lots of Free blocks count wrong for group #0 (23513, counted=23510). Fix? no type questions, and at the end it said, MyDisk: ********** WARNING: Filesystem still has errors ********** MyDisk: 11/6553600 files (1709.1% non-contiguous), 459349/26214400 blocks
    – Sat93
    Aug 5, 2014 at 19:42
  • 4
    The very first thing you should do is go buy another HDD and copy the entirety of the original drive to the new HDD: sudo dd if=/dev/sdN of=/dev/sdNN. Any suggestion has the potential of damaging your data even further and if this data is truly important, please back it up!
    – earthmeLon
    Aug 10, 2014 at 18:30

2 Answers 2

1

Run this for both sdb1 & sdb2. If external drive and you are sure everything is unmounted, you can run from inside your working Ubuntu. Others may need to use live installer.

From liveDVD/Flash so everything is unmounted,swap off if necessary, change example shown with partition sdb1 to your partition(s)

e2fsck is used to check the ext2/ext3/ext4 family of file systems. -p trys fixes where response not required

sudo e2fsck -C0 -p -f -v /dev/sdb1

if errors: -y auto answers yes for fixes needing response

sudo e2fsck -f -y -v /dev/sdb1

also see:

man e2fsck
0

Four things to consider!

First you should really try mounting it back on the original device this last worked on. If this is the case you can back up your data from there, then wipe the drive in it entirety.

Second, the partitions are possibly not mounting because you were in the middle of writing something, Windows is retarded the same way when a CD is removed, all user interaction is prompted to put the CD in or else. So simply putting the harddrive back in would work, but only if you still had the machine running. Some cases, however, can revert last made changes.

Third, your partition table file, for the name I cannot recall, is most likely destroyed and corrupted.

Fourth, you should never, ever ever ever ever, remove a drive while its in use, ever.

If the first three cannot fix your issue, then back what data you can and call in a pro to recover the "Lost" data you cannot. Sadly HDD problems are mostly irreversible and permanent, with no work around possible without ruining the drive or its contents further. It's why everyone tells you redundantly to back your content up.

1
  • Thanks for your suggestion! And ya! about that fourth point, will always make sure!
    – Sat93
    Aug 16, 2014 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .