Repairing a corrupt hard disk

My hdd seems to have become completely corrupted. It was the hdd on NTFS that I used for Win7. I’d been getting weird slowdowns and hangups+crashes lately. On checking with chkdsk, it seems to freeze. Either it has a lot of bad sectors, or it’s physically done for..

Tried Gparted-Wouldnt finish scanning it

Chkdsk-Hangs

Ubuntu Live CD-Gparted-Hangs

Win7-Installation Formatter-Doesnt proceed to the stage of formatting!

Finally did this in Ubuntu Live CD:

$fdisk
The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       60802   488386528+   7  HPFS/NTFS

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-60801, default 60801):
Using default value 60801

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       60801   488384001   83  Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L

0  Empty           1e  Hidden W95 FAT1 80  Old Minix       bf  Solaris
1  FAT12           24  NEC DOS         81  Minix / old Lin c1  DRDOS/sec (FAT-
2  XENIX root      39  Plan 9          82  Linux swap / So c4  DRDOS/sec (FAT-
3  XENIX usr       3c  PartitionMagic  83  Linux           c6  DRDOS/sec (FAT-
4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c7  Syrinx
5  Extended        41  PPC PReP Boot   85  Linux extended  da  Non-FS data
6  FAT16           42  SFS             86  NTFS volume set db  CP/M / CTOS / .
7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set de  Dell Utility
8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt
9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access
a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O
b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor
c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs
e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  GPT
f  W95 Ext’d (LBA) 54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x84b8ae6e

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       60801   488384001    c  W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[email protected]:~$ sudo mkfs -t fat32 /dev/sda1
mkfs.fat32: No such file or directory
[email protected]:~$ mkfs
Usage: mkfs [-V] [-t fstype] [fs-options] device [size]
[email protected]:~$ sudo apt-get mkfs.fat2
E: Invalid operation mkfs.fat2
[email protected]:~$ sudo apt-get mkfs.fat32
E: Invalid operation mkfs.fat32
[email protected]:~$ sudo apt-get mkfs
E: Invalid operation mkfs
[email protected]:~$ sudo mkfs -t ext4 /dev/sda1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30531584 inodes, 122096000 blocks
6104800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
3727 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[email protected]:~$ fsck.ext4 -cDfty -C 0 /dev/sda1
e2fsck 1.41.4 (27-Jan-2009)
fsck.ext4: Permission denied while trying to open /dev/sda1
You must have r/w access to the filesystem or be root
[email protected]:~$ sudo fsck.ext4 -cDfty -C 0 /dev/sda1
e2fsck 1.41.4 (27-Jan-2009)

 

The following is from http://justcheckingonall.wordpress.com/2010/07/18/howto-repair-broken-ext4-partitions/

 

 

HowTo Repair Broken ext4 Partitions

Every now and then, you might run into a situation where your *nix installation won’t start due to a corrupted/damaged journal, be it due to power failure or disk failure.

That’s where fsck comes in handy.

You should boot from live distribution, such as Ubuntu live CD (running fsck on a mounted system is very dangerous), and run fsck on your file system, one partition at a time. Here’s my favourite setting:

fsck.ext4 -cDfty -C 0 /dev/sd**[/code]

  • -c – check for bad sectors
  • -D – optimize directories if possible
  • -f – force check, even if filesystem seems clean
  • -t – print timing stats (use -tt for more)
  • -y – assume answer “yes” to all questions (such as, “do you want to continue”)
  • -C 0 – print progress info to stdout
  • /dev/sd** – the partition to check, e.g. /dev/sda1 for first partition (1) on first hard disk (a), etc.

For reiser FS you can use the following:

fsck.reiserfs --fix-fixable -y /dev/sd**[/code]