# [SOLVED] Trying to restore partition table from backup

## mimmozzo

Hello guys... Right now i am posting from a nearly-blowing-up pc  :Razz:  If it crashes or I reboot, i am lost  :Very Happy: 

The problem is:

dont ask me how, but i broke the partition table; now it shows this ****:

```

# fdisk -l

Disco /dev/sda: 160.0 GB, 160041885696 byte

255 heads, 63 sectors/track, 19457 cylinders

Units = cilindri of 16065 * 512 = 8225280 bytes

Disk identifier: 0xe4a9cdb4

Dispositivo Boot      Start         End      Blocks   Id  System

/dev/sda1            1481        2394     7341673+   f  W95 Esteso (LBA)

/dev/sda5            1481        2394     7341668+   7  HPFS/NTFS

```

Before breaking, it WAS this:

```

#1196890130 Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63

 1 : start=       63, size= 14329917, Id=83, P

 2 : start= 14329980, size=  7341705, Id=83, P

 3 : start= 21671685, size= 61448625, Id=05, E

 5 : start= 21671748, size=  2104452, Id=83, L

 6 : start= 23776263, size= 14683347, Id=07, L

 4 : start= 83120310, size=218660715, Id=83, P

```

this is the backup.log from testdisk.

Now i am getting crazy... what does a backup serve for, if i am not able to restore it?

Testdisk doesnt load the backup (why? i dont know).

I've tried with sfdisk in this way:

```

sfdisk /dev/sda < backup.log --no-reread

```

but i get "sfdisk: invalid input"

Please help... before it crashes (nvidia helps it).

----------

## Keruskerfuerst

```
#1196890130 Disk /dev/sda - 160 GB / 149 GiB - CHS 19457 255 63

 1 : start=       63, size= 14329917, Id=83, P

 2 : start= 14329980, size=  7341705, Id=83, P

 3 : start= 21671685, size= 61448625, Id=05, E

 5 : start= 21671748, size=  2104452, Id=83, L

 6 : start= 23776263, size= 14683347, Id=07, L

 4 : start= 83120310, size=218660715, Id=83, P 
```

I assume:

start=start block

size=number of blocks

Try to use fdsik or cfdisk and a calculator: CHS 19457 255 63.

You should also have an eye on the partition ID.

----------

## mimmozzo

 *Quote:*   

> Try to use fdsik or cfdisk and a calculator: CHS 19457 255 63. 

 

i didnt understand, sry. The fact is, how can I use this backup file, or modify it to make it a valid input file for fdisk or cfdisk or sfdisk...

I tried some modifications, but they didnt work...

Still not resolved.

----------

## mimmozzo

Modifying the file backup.log and giving it to sfdisk, i finally managed to recover 4 partitions:

-gentoo system

-partition for var

-partition for portage

-NTFS partition

I was lucky, cos after a while X froze the whole computer and i was forced to reboot, and.. the system worked (longest seconds in my geek-life  :Razz: )

Now the only thing I have to recover is the data partition. It's an ext3 partition, primary, and i got these info by testdisk:

```

Partition                Start           End              Size in sectors

Linux                      5174           18784          218660715

```

Can someone advice me on the way to recover these? i dont trust testdisk, it is the cause of all my problems...

Btw i am googling it. Thx in advance for help.

Edit: managed to recover the data partition, finding the exact start sector of the partition.

----------

