Lost huge /home partition goes over disk boundary. Help!

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Lost huge /home partition goes over disk boundary. Help!

#1 Post by Yada »

Hi,

While re-installing my system with a Ubuntu derivative I decided that my old partitions could be slightly different than before. I made a smaller / directory, removed swap and made a new one at the end of the root partition, and wanted to keep my /home intact. Stupid enough, I wanted to resize it on the fly, which resulted in growing it in the wrong direction. I noticed, but made the stupid mistake to just go on anyway.

After reboot, my homedir wasn't quite the same anymore :shock: About 400 GB of data had vanished. Pretty disastrous, since all my important files are in there, plus my music. Photorec is not really an option because of the amount of data. It does find my files, though, so I figure all is not lost.

In the past I have managed to rescue data on my mom's computer with Testdisk/Photorec, so I burnt the latest System Rescue CD and started trying to recover the lost partition. Luckily, I have a 1TB hdd lying around for use in a htpc-to-be which I temporarily installed in my home pc for the recovery. Sadly, my /home is not recoverable, so Testdisk says after Deeper Search:

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63

The harddisk (500 GB / 465 GiB) seems too small! (< 736 GB / 685 GiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partition can't be recovered:
Partition Start End Size in sectors
> Linux 31821 1 1 89538 78 56 927228512


[ Continue ]
EXT4 Large file Sparse superblock Recover, 474 GB / 442 GiB


I tried to figure out how to solve this, and found a promising thread:
http://forum.cgsecurity.org/phpBB3/post ... imit#p3435

It seems I need to calculate the right amount of cylinders, but I'm sort of mediocre at calculations :?

My installation is pretty straightforward with 3 partitions: root ext4, swap and one big /home, also ext4. During my attempts to rescue the partition, I deleted the newly created almost-empty one by the OS in the hope I would be able to recover after all, but no :(

So it seems I need to change the number of cylinders to fool the partition table and be able to recover the partition with its whole directory/file structure. I'm stuck at what number to fill out here:

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63, sector size=512

Because these numbers change the way that TestDisk looks for partitions
and calculates their sizes, it's important to have the correct disk geometry.
PC partitioning programs often make partitions end on cylinder boundaries.

A partition's CHS values are based on disk translations which make them
different than its physical geometry. The most common CHS head values
are: 255, 240 and sometimes 16.

Enter the number of cylinders: 60801



Any help would be a life saver! I never found it necessary to keep regular external backups, since my data have been on this disk for ages, and have partially even been copied over from other hdd's from ancient computers. I've never lost anything important in over 10 years. The last 48 hours have tought me differently.

Thanks in advance, I hope someone has an answer soon. And if it's not too much to ask, a step-by-step calculation included would be really great! I'd love to understand how to do this.

Kind regards,

Irene


Here's my Testdisk logfile:

Thu Jan 31 01:20:47 2013
Command line: TestDisk

TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 3.4.27-std330-amd64 (#2 SMP Tue Jan 22 23:33:56 UTC 2013) x86_64
Compiler: GCC 4.4
Compilation date: 2013-01-24T08:48:40
ext2fs lib: 1.42.6, ntfs lib: libntfs-3g, reiserfs lib: 0.3.1-rc8, ewf lib: none
/dev/sda: LBA, HPA, LBA48, DCO support
/dev/sda: size 976773168 sectors
/dev/sda: user_max 976773168 sectors
/dev/sda: native_max 976773168 sectors
/dev/sda: dco 976773168 sectors
/dev/sdb: LBA, HPA, LBA48, DCO support
/dev/sdb: size 1953525168 sectors
/dev/sdb: user_max 1953525168 sectors
/dev/sdb: native_max 1953525168 sectors
/dev/sdb: dco 1953525168 sectors
Warning: can't get size for Disk /dev/mapper/control - 0 B - CHS 1 1 1, sector size=512
Warning: can't get size for Disk /dev/md0 - 0 B - CHS 1 2 4, sector size=512
/dev/sr0 is not an ATA disk
Hard disk list
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63, sector size=512 - SAMSUNG HD502IJ, S/N:S13TJ90Q877546, FW:1AA01113
Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121601 255 63, sector size=512 - WDC WD10EARS-00Y5B1, S/N:WD-WCAV55641205, FW:80.00A80
Disk /dev/sr0 - 385 MB / 367 MiB - CHS 188329 1 1 (RO), sector size=2048 - HL-DT-ST RW/DVD GCC-4520B, FW:1.00

Partition table type (auto): Intel
Disk /dev/sda - 500 GB / 465 GiB - SAMSUNG HD502IJ
Partition table type: Intel

Analyse Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Geometry from i386 MBR: head=255 sector=63
get_geometry_from_list_part_aux head=255 nbr=4
get_geometry_from_list_part_aux head=8 nbr=2
get_geometry_from_list_part_aux head=16 nbr=2
get_geometry_from_list_part_aux head=32 nbr=2
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=2
get_geometry_from_list_part_aux head=255 nbr=4
Current partition structure:
1 * Linux 0 1 1 1823 254 63 29302497
2 P Linux Swap 2678 0 1 3083 254 63 6522390
Ask the user for vista mode
Allow partial last cylinder : No
search_vista_part: 0

search_part()
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63

recover_EXT2: s_block_group_nr=0/111, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8176
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 3662109
recover_EXT2: part_size 29296872
Linux 0 1 1 1823 165 45 29296872
EXT4 Large file Sparse superblock, 14 GB / 13 GiB
Linux Swap 2678 0 1 3083 254 41 6522368
SWAP2 version 1, 3339 MB / 3184 MiB

recover_EXT2: s_block_group_nr=0/3537, s_mnt_count=3/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8192
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 115903564
recover_EXT2: part_size 927228512
Linux 3084 0 1 60801 77 56 927228512
EXT4 Large file Sparse superblock, 474 GB / 442 GiB
get_geometry_from_list_part_aux head=255 nbr=4
get_geometry_from_list_part_aux head=8 nbr=1
get_geometry_from_list_part_aux head=16 nbr=1
get_geometry_from_list_part_aux head=32 nbr=1
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=1
get_geometry_from_list_part_aux head=255 nbr=4

Results
* Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
P Linux Swap 2678 0 1 3083 254 63 6522390
SWAP2 version 1, 3339 MB / 3184 MiB
P Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB


dir_partition inode=2
P Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
11 drwx------ 0 0 16384 30-Jan-2013 01:17 lost+found
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 irene

dir_partition inode=9437185
P Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB
Directory /irene
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
9437186 -rw-r--r-- 1000 1000 675 30-Jan-2013 01:21 .profile
9437187 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 .config
9437208 -rw-r--r-- 1000 1000 3102 30-Jan-2013 01:21 .bashrc
9437209 drwxr-xr-x 1000 1000 4096 30-Jan-2013 01:21 .local
9437213 -rw-r--r-- 1000 1000 220 30-Jan-2013 01:21 .bash_logout
9437214 drwxr-xr-x 1000 1000 4096 30-Jan-2013 01:21 .e
9437221 -rw------- 1000 1000 337625 30-Jan-2013 02:56 .xsession-errors
9437222 -rw------- 1000 1000 53 30-Jan-2013 01:29 .Xauthority
9437223 drwx------ 1000 1000 4096 30-Jan-2013 01:29 .dbus
9437244 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:49 .cache
9437261 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:49 Desktop
9437312 drwx------ 1000 1000 4096 30-Jan-2013 01:32 .gvfs
9437315 drwx------ 1000 1000 4096 30-Jan-2013 02:38 .gconf
9437316 -rw-r----- 1000 1000 0 30-Jan-2013 02:28 .gksu.lock
9437348 drwxrwxr-x 1000 1000 4096 30-Jan-2013 02:48 .gstreamer-0.10
9437258 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .mozilla
9437522 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .gnome2
9437523 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .gnome2_private
9437650 -rw-r--r-- 0 0 15748 30-Jan-2013 02:54 testdisk.log
9437706 -rw-rw-r-- 1000 1000 139577344 30-Jan-2013 02:40 gparted-live-0.14.1-6-i486.iso
9437736 -rw-rw-r-- 1000 1000 385693696 30-Jan-2013 02:44 systemrescuecd-x86-3.3.0.iso
9437322 -rw------- 1000 1000 49 30-Jan-2013 02:56 .bash_history
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
11 drwx------ 0 0 16384 30-Jan-2013 01:17 lost+found
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 irene

interface_write()
1 * Linux 0 1 1 1823 254 63 29302497
2 P Linux Swap 2678 0 1 3083 254 63 6522390

search_part()
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63

recover_EXT2: s_block_group_nr=0/111, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8176
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 3662109
recover_EXT2: part_size 29296872
Linux 0 1 1 1823 165 45 29296872
EXT4 Large file Sparse superblock, 14 GB / 13 GiB

block_group_nr 3

recover_EXT2: "e2fsck -b 98304 -B 4096 device" may be needed
recover_EXT2: s_block_group_nr=3/111, s_mnt_count=0/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8176
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 3662109
recover_EXT2: part_size 29296872
Linux 0 1 1 1823 165 45 29296872
EXT4 Large file Sparse superblock Backup superblock, 14 GB / 13 GiB
Linux Swap 2678 0 1 3083 254 41 6522368
SWAP2 version 1, 3339 MB / 3184 MiB

recover_EXT2: s_block_group_nr=0/3537, s_mnt_count=3/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8192
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 115903564
recover_EXT2: part_size 927228512
Linux 3084 0 1 60801 77 56 927228512
EXT4 Large file Sparse superblock, 474 GB / 442 GiB

block_group_nr 3

recover_EXT2: "e2fsck -b 98304 -B 4096 device" may be needed
recover_EXT2: s_block_group_nr=3/3537, s_mnt_count=0/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8192
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 115903564
recover_EXT2: part_size 927228512
Linux 3084 0 1 60801 77 56 927228512
EXT4 Large file Sparse superblock Backup superblock, 474 GB / 442 GiB

recover_EXT2: s_block_group_nr=0/3537, s_mnt_count=2/4294967295, s_blocks_per_group=32768, s_inodes_per_group=8192
recover_EXT2: s_blocksize=4096
recover_EXT2: s_blocks_count 115903564
recover_EXT2: part_size 927228512
Linux 31821 1 1 89538 78 56 927228512
EXT4 Large file Sparse superblock Recover, 474 GB / 442 GiB
This partition ends after the disk limits. (start=511204428, size=927228512, end=1438432939, disk end=976773168)
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Check the harddisk size: HD jumpers settings, BIOS detection...
The harddisk (500 GB / 465 GiB) seems too small! (< 736 GB / 685 GiB)
The following partition can't be recovered:
Linux 31821 1 1 89538 78 56 927228512
EXT4 Large file Sparse superblock Recover, 474 GB / 442 GiB
get_geometry_from_list_part_aux head=255 nbr=4
get_geometry_from_list_part_aux head=8 nbr=1
get_geometry_from_list_part_aux head=16 nbr=1
get_geometry_from_list_part_aux head=32 nbr=1
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=1
get_geometry_from_list_part_aux head=255 nbr=4

Results
* Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
P Linux Swap 2678 0 1 3083 254 63 6522390
SWAP2 version 1, 3339 MB / 3184 MiB
P Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB


dir_partition inode=2
Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
11 drwx------ 0 0 16384 30-Jan-2013 01:17 lost+found
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 irene

dir_partition inode=9437185
Linux 3084 0 1 60801 254 63 927239670
EXT4 Large file Sparse superblock, 474 GB / 442 GiB
Directory /irene
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
9437186 -rw-r--r-- 1000 1000 675 30-Jan-2013 01:21 .profile
9437187 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 .config
9437208 -rw-r--r-- 1000 1000 3102 30-Jan-2013 01:21 .bashrc
9437209 drwxr-xr-x 1000 1000 4096 30-Jan-2013 01:21 .local
9437213 -rw-r--r-- 1000 1000 220 30-Jan-2013 01:21 .bash_logout
9437214 drwxr-xr-x 1000 1000 4096 30-Jan-2013 01:21 .e
9437221 -rw------- 1000 1000 337625 30-Jan-2013 02:56 .xsession-errors
9437222 -rw------- 1000 1000 53 30-Jan-2013 01:29 .Xauthority
9437223 drwx------ 1000 1000 4096 30-Jan-2013 01:29 .dbus
9437244 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:49 .cache
9437261 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:49 Desktop
9437312 drwx------ 1000 1000 4096 30-Jan-2013 01:32 .gvfs
9437315 drwx------ 1000 1000 4096 30-Jan-2013 02:38 .gconf
9437316 -rw-r----- 1000 1000 0 30-Jan-2013 02:28 .gksu.lock
9437348 drwxrwxr-x 1000 1000 4096 30-Jan-2013 02:48 .gstreamer-0.10
9437258 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .mozilla
9437522 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .gnome2
9437523 drwx------ 1000 1000 4096 30-Jan-2013 02:02 .gnome2_private
9437650 -rw-r--r-- 0 0 15748 30-Jan-2013 02:54 testdisk.log
9437706 -rw-rw-r-- 1000 1000 139577344 30-Jan-2013 02:40 gparted-live-0.14.1-6-i486.iso
9437736 -rw-rw-r-- 1000 1000 385693696 30-Jan-2013 02:44 systemrescuecd-x86-3.3.0.iso
9437322 -rw------- 1000 1000 49 30-Jan-2013 02:56 .bash_history
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 ..
11 drwx------ 0 0 16384 30-Jan-2013 01:17 lost+found
9437185 drwxr-xr-x 1000 1000 4096 30-Jan-2013 02:56 irene

interface_write()
1 * Linux 0 1 1 1823 254 63 29302497
2 P Linux Swap 2678 0 1 3083 254 63 6522390
simulate write!

write_mbr_i386: starting...
write_all_log_i386: starting...
No extended partition
New options :
Dump : No
Cylinder boundary : Yes
Allow partial last cylinder : No
Expert mode : Yes

Interface Advanced
Geometry from i386 MBR: head=255 sector=63
get_geometry_from_list_part_aux head=255 nbr=4
get_geometry_from_list_part_aux head=8 nbr=2
get_geometry_from_list_part_aux head=16 nbr=2
get_geometry_from_list_part_aux head=32 nbr=2
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=2
get_geometry_from_list_part_aux head=255 nbr=4
1 * Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
2 P Linux Swap 2678 0 1 3083 254 63 6522390
SWAP2 version 1, 3339 MB / 3184 MiB

Interface Advanced
Geometry from i386 MBR: head=255 sector=63
get_geometry_from_list_part_aux head=255 nbr=4
get_geometry_from_list_part_aux head=8 nbr=2
get_geometry_from_list_part_aux head=16 nbr=2
get_geometry_from_list_part_aux head=32 nbr=2
get_geometry_from_list_part_aux head=64 nbr=1
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=2
get_geometry_from_list_part_aux head=255 nbr=4
1 * Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
2 P Linux Swap 2678 0 1 3083 254 63 6522390
SWAP2 version 1, 3339 MB / 3184 MiB


dir_partition inode=2
1 * Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:58 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:58 ..
11 drwx------ 0 0 16384 30-Jan-2013 00:58 lost+found
130817 drwxr-xr-x 0 0 4096 30-Jan-2013 01:18 home
261633 drwxr-xr-x 0 0 4096 30-Jan-2013 02:56 etc
523265 drwxr-xr-x 0 0 4096 2-Jan-2013 21:36 media
654081 drwxr-xr-x 0 0 4096 30-Jan-2013 01:56 bin
130818 drwxr-xr-x 0 0 4096 30-Jan-2013 02:00 boot
523266 drwxr-xr-x 0 0 4096 28-Dec-2012 03:53 cdrom
261635 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 dev
654082 drwxr-xr-x 0 0 4096 30-Jan-2013 01:55 lib
654083 drwxr-xr-x 0 0 4096 30-Jan-2013 01:56 lib64
130819 drwxr-xr-x 0 0 4096 2-Jan-2013 21:36 mnt
523267 drwxr-xr-x 0 0 4096 6-Jun-2012 16:36 opt
8177 drwxr-xr-x 0 0 4096 2-Jan-2013 21:36 proc
8178 drwx------ 0 0 4096 30-Jan-2013 01:22 root
16353 drwxr-xr-x 0 0 4096 30-Jan-2013 01:21 run
16354 drwxr-xr-x 0 0 12288 30-Jan-2013 01:57 sbin
24529 drwxr-xr-x 0 0 4096 5-Mar-2012 17:54 selinux
24530 drwxr-xr-x 0 0 4096 6-Jun-2012 16:36 srv
32705 drwxr-xr-x 0 0 4096 2-Jan-2013 21:36 sys
32706 drwxrwxrwt 0 0 4096 30-Jan-2013 02:56 tmp
40881 drwxr-xr-x 0 0 4096 6-Jun-2012 16:36 usr
40882 drwxr-xr-x 0 0 4096 30-Jan-2013 02:56 var
13 lrwxrwxrwx 0 0 29 30-Jan-2013 01:58 vmlinuz
14 lrwxrwxrwx 0 0 31 30-Jan-2013 01:22 initrd.img.old
1815 lrwxrwxrwx 0 0 33 30-Jan-2013 01:58 initrd.img
X 12 lrwxrwxrwx 0 0 28 30-Jan-2013 01:22 vmlinuz.27382
12 lrwxrwxrwx 0 0 28 30-Jan-2013 01:22 vmlinuz.old

dir_partition inode=130817
1 * Linux 0 1 1 1823 254 63 29302497
EXT4 Large file Sparse superblock, 15 GB / 13 GiB
Directory /home
130817 drwxr-xr-x 0 0 4096 30-Jan-2013 01:18 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:58 ..
Directory /
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:58 .
2 drwxr-xr-x 0 0 4096 30-Jan-2013 01:58 ..
11 drwx------ 0 0 16384 30-Jan-2013 0
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#2 Post by Yada »

I've found it, I believe. I had been struggling with this problem all day and it had become the middle of the night (or early morning, rather). It's so simple I overlooked it, thinking too complicated.

If I'm correct, it's just adding 1 to the number of the last cylinder of the lost partition, so that would be 89539 in my case:

Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63

The harddisk (500 GB / 465 GiB) seems too small! (< 736 GB / 685 GiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partition can't be recovered:
Partition Start End Size in sectors
> Linux 31821 1 1 89538 78 56 927228512


Soon as the Photorec just-in-case file recovery has finished, I'm going t give it a go and post back. It could take a few days, Photorec takes several days for over 400 GB.
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#3 Post by Yada »

Changed cylinders, and that makes my lost partition appear in Deeper Search, and I can select it as primary (as used to be the case). But on enterng P to list files, its says there are no files because the partition may be damaged.

The good news is that I am now able to restore it. I'm going to have to do a reboot, analyze again and put it back. But just to be sure only after Photorec has finished copying which will take another 3 days.

Depending on how my partition comes out, then I probably have to follow the instructions found here:
http://linuxexpresso.wordpress.com/2010 ... in-ubuntu/

That will be an interesting way to spend a sunday night....
Last edited by Yada on 02 Feb 2013, 00:27, edited 2 times in total.
User avatar
Fiona
Posts: 2835
Joined: 18 Feb 2012, 17:19
Location: Ludwigsburg/Stuttgart - Germany

Re: Lost huge /home partition goes over disk boundary. Help!

#4 Post by Fiona »

Something what you could try too, can you use the menu Options in TestDisk and set the option cylinder boundary to "No" and allow partitial last cylinder to "Yes"?
Repeat your diagnose and have another try to write your partition structur.
If your partition ends after disk limit and you still run into problems, please let me know.

Fiona
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#5 Post by Yada »

Thank you for your advise, Fiona :) I haven't yet written the table to the disk yet, since Photorec at the same time is still copying over files and I want to be sure at least something is saved before I do anythning else to the partition.

As soon as it's finished I will reboot and run Testdisk again with your suggestions. If I get stuck I'll definitely contact you.

Thanks again!
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#6 Post by Yada »

I set the cylinder boundary to 'no' and allow partial last cylinder to 'yes', but I'm getting the same result: Testdisk sees the partition, but no files.

I suppose I should write the table anyway and try to recover with the ext4 superblock thing. Or is there still something else I can try?
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#7 Post by Yada »

Crap. I wrote the partition structure to disk and went for the superblock thing.

It gives me this:

Disk /dev/sda - 736 GB / 685 GiB - CHS 89539 255 63

Partition Start End Size in sectors

Linux 31821 1 1 89538 78 56 927228512
superblock 0, blocksize=4096 []

To repair the filesystem using alternate superblock, run
fsck.ext4 -p -b superblock -B blocksize device

>[ Quit ]


So i ran fsck.ext4 -p -b 0 -B 4096 /dev/sda3
and got this:

root@sysresccd /run/media/root/sdb1-ata-WDC_WD10EARS-00Y/partitie % fsck.ext4 -p -b 0 -B 4096 /dev/hda3
fsck.ext4: No such file or directory while trying to open /dev/hda3


Checking with GParted and it shows only unallocated space :cry:

Sure enough, running Testdisk again it finds all partitions:

TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60802 255 63
Current partition structure:
Partition Start End Size in sectors

1 * Linux 0 1 1 1823 165 45 29296872
2 P Linux Swap 2678 0 1 3083 254 41 6522368
3 P Linux 31821 1 1 89538 78 56 927228512

*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
>[Quick Search] [ Backup ]
Try to locate partition


The first search comes up with the wrong /dev/sda3 again:

TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60802 255 63
Partition Start End Size in sectors
* Linux 0 1 1 1823 165 45 29296872
P Linux Swap 2678 0 1 3083 254 41 6522368
>P Linux 3084 0 1 60801 77 56 927228512

Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable P=Primary L=Logical E=Extended D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
Enter: to continue
EXT4 Large file Sparse superblock, 474 GB / 442 GiB


So yet again running Deeper Search, with these results:

TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sda - 500 GB / 465 GiB - CHS 60802 255 63

The harddisk (500 GB / 465 GiB) seems too small! (< 736 GB / 685 GiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partition can't be recovered:
Partition Start End Size in sectors
> Linux 31821 1 1 89538 78 56 927228512

[ Continue ]
EXT4 Large file Sparse superblock Recover, 474 GB / 442 GiB



Also, I found this info on my hdd by running hdparm -i and hdparm -I:

root@sysresccd /run/media/root/sdb1-ata-WDC_WD10EARS-00Y/partitie % hdparm -i /dev/sda

/dev/sda:

Model=SAMSUNG HD502IJ, FwRev=1AA01113, SerialNo=S13TJ90Q877546
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4
BuffType=DualPortCache, BuffSize=16384kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=976773168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: disabled (255) WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-3,4,5,6,7

* signifies the current active mode

http://planetvm.net/blog/?p=1592



root@sysresccd / % hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
Model Number: SAMSUNG HD502IJ
Serial Number: S13TJ90Q877546
Firmware Revision: 1AA01113
Standards:
Used: ATA-8-ACS revision 3b
Supported: 7 6 5 4
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 976773168
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 476940 MBytes
device size with M = 1000*1000: 500107 MBytes (500 GB)
cache/buffer size = 16384 KBytes (type=DualPortCache)
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = 16
Advanced power management level: disabled
Recommended acoustic management value: 254, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 udma7
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
Advanced Power Management feature set
Power-Up In Standby feature set
* SET_FEATURES required to spinup after power up
SET_MAX security extension
Automatic Acoustic Management feature set
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
Media Card Pass-Through
* General Purpose Logging feature set
* 64-bit World wide name

* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Native Command Queueing (NCQ)
* Host-initiated interface power management
* Phy event counters
* NCQ priority information
DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Software settings preservation
* SMART Command Transport (SCT) feature set
* SCT Read/Write Long (AC1), obsolete
* SCT Write Same (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
110min for SECURITY ERASE UNIT. 110min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 50000f000b785764
NAA : 5
IEEE OUI : 0000f0
Unique ID : 00b785764
Checksum: correct


Makes me wonder whether the native CHS has anything to do with this? If I run Testdisk against these parameters i get a massive list of partitions and a seemingly neverending run that doesn't stop at 100%. And still no file structure.

I'm afraid I've just made matters worse by writing the partition table :( Feels like running around in circles. It's depressing. I wonder whether it might be an idea to try Testdisk 6.14, because of this bugfix:
Rewrote how TestDisk aligns partition on cylinder or 1MB boundary. It avoids to create partition entry where the partition ends after the end of the disk.
Yada
Posts: 8
Joined: 31 Jan 2013, 02:48

Re: Lost huge /home partition goes over disk boundary. Help!

#8 Post by Yada »

Copied files from my 'empty' partiton last week with Photorec and expert settings. Set sector size to 4096, as suggested by e2fsck and hdparm. It took only several hours instead of 3 days to copy the files. In the meantime, nothing seems to have changed: testdisk still does not see any files and repair with fsck-ext4 does not repair any superblocks. The partition is still halfway dangling over the edge.

I don't get it. The data is there, obviously. How can I pull the partition back on the disk, and get Testdisk to recover my file table correctly?

I'd love to use my home desktop computer with my home administration again.... Would anybody be so kind to respond, please?
Locked