I have a dual boot laptop (Ubuntu 12.04.4/Windows 7) with a failing hard disk. S.M.A.R.T. current pending sector count has started to rise and the system takes a few minutes to boot in both Ubuntu and Windows. I replaced the disk with another one with the same capacity (750GB) and tried to transfer everything to the new disk using dd command.
Ubuntu (logical) partition has disappeared and its previously occupied space now appears as RAW space inside the extended partition. I decided to reinstall Ubuntu (14.04) and it works fine, except that it does not offer the choice to dual boot in Windows 7 anymore. During installation, it said there was no other OS found.
Strangely, the NTFS partition is there, it mounts in Ubuntu and the files can be accessed. During the hard disk cloning there were several errors, but the first error was some 28GB from the start of the Windows partition, so i guess it couldn't have done some critical damage to the filesystem. Below is the output of some utilities i tried:
sudo fdisk -l
Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x677f9038
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 7 HPFS/NTFS/exFAT
/dev/sda2 411648 314984447 157286400 7 HPFS/NTFS/exFAT
/dev/sda3 314984448 1434222591 559619072 f W95 Ext'd (LBA)
/dev/sda4 1434222592 1465149167 15463288 12 Compaq diagnostics
/dev/sda5 314986496 323375103 4194304 82 Linux swap / Solaris
/dev/sda6 323377152 637949951 157286400 83 Linux
The Windows 7 partition is /dev/sda2. There is an exclamation mark to it in gparted tool and the following information is provided:
Unable to read the contents of this file system! Because of this some operations may be unavailable. The cause might be a missing software package. The following list of software packages is required for ntfs file syste support: ntfsprogs / ntfs-3g.
Testdisk utility reports a heads/cylinder mismatch (the replacement HDD was a different model):
Disk /dev/sda - 750 GB / 698 GiB - CHS 91201 255 63
Current partition structure:
Partition Start End Size in sectors
Warning: number of heads/cylinder mismatches 16 (NTFS) != 255 (HD)
1 * HPFS - NTFS 0 32 33 25 159 6 409600
Bad relative sector.
Warning: number of heads/cylinder mismatches 16 (NTFS) != 255 (HD)
2 P HPFS - NTFS 25 159 7 19606 223 9 314572800
Bad relative sector.
3 E extended LBA 19606 223 10 89276 57 61 1119238144
4 P Compaq Diagnostics 89276 57 62 91201 80 63 30926576
5 L Linux Swap 19607 0 42 20129 43 10 8388608
X extended 20129 65 1 39710 139 45 314573472
6 L Linux 20129 75 43 39710 139 45 314572800
I also tried ntfsfix, but without writing anything:
ntfsfix -n /dev/sda2
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... BAD
Error: Failed to fix the alternate boot sector
and finally ntfsresize:
ntfsresize --info --force --no-progress-bar /dev/sda2
ntfsresize v2013.1.13AR.1 (libntfs-3g)
Device name : /dev/sda2
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 161061270016 bytes (161062 MB)
Current device size: 161061273600 bytes (161062 MB)
Checking filesystem consistency ...
Inode is corrupt (15996): Input/output error
Inode is corrupt (16000): Input/output error
Inode is corrupt (16001): Input/output error
Inode is corrupt (16003): Input/output error
Inode is corrupt (16007): Input/output error
Inode is corrupt (16008): Input/output error
Inode is corrupt (16009): Input/output error
Inode is corrupt (16010): Input/output error
Inode is corrupt (16012): Input/output error
Inode is corrupt (16014): Input/output error
Inode is corrupt (16015): Input/output error
Inode is corrupt (16016): Input/output error
Inode is corrupt (16017): Input/output error
Inode is corrupt (16019): Input/output error
Inode is corrupt (16020): Input/output error
Found stale mft reference in attribute list!
Inode is corrupt (16021): Input/output error
Inode is corrupt (16022): Input/output error
Inode is corrupt (16023): Input/output error
Inode is corrupt (16038): Input/output error
Inode is corrupt (83920): Input/output error
Inode is corrupt (171988): Input/output error
Inode is corrupt (172451): Input/output error
Accounting clusters ...
Cluster accounting failed at 118054 (0x1cd26): extra cluster in $Bitmap
Cluster accounting failed at 118055 (0x1cd27): extra cluster in $Bitmap
Cluster accounting failed at 118056 (0x1cd28): extra cluster in $Bitmap
Cluster accounting failed at 118057 (0x1cd29): extra cluster in $Bitmap
Cluster accounting failed at 118058 (0x1cd2a): extra cluster in $Bitmap
Cluster accounting failed at 118059 (0x1cd2b): extra cluster in $Bitmap
Cluster accounting failed at 118060 (0x1cd2c): extra cluster in $Bitmap
Cluster accounting failed at 118061 (0x1cd2d): extra cluster in $Bitmap
Cluster accounting failed at 118062 (0x1cd2e): extra cluster in $Bitmap
Cluster accounting failed at 118063 (0x1cd2f): extra cluster in $Bitmap
Filesystem check failed! Totally 426 cluster accounting mismatches.
ERROR: NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!
The usage of the /f parameter is very IMPORTANT! No modification was
and will be made to NTFS by this software until it gets repaired.
What is the safest method to repair the partition and make the system dual-bootable again? I don't have a Windows 7 DVD, as my laptop came with a small hidden partition at the end of the disk which could be used to restore everything in case of failure, but now is severely damaged.