Accidentally picked guided LVM setup in Debian, lost ext3

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
jasontan
Posts: 4
Joined: 04 Jul 2013, 02:09

Accidentally picked guided LVM setup in Debian, lost ext3

#1 Post by jasontan »

Hi,

I was trying to install Debian 7 over Debian 6 on my dual boot Dell laptop. It was using ext3 and NTFS.

I wanted to change the Linux partition to use LVM, and selected Guided LVM but in my hurry, I didn't read the words "Use whole disk ..." before pressing proceed. I only realised my mistake when I looked at the available partitions on the next step.

I tried rebooting and going to Manual disk partitioning but it only shows the single pv of the LVM. It now looks like this inside GParted:

Code: Select all

/dev/sda1 unknown - 243.0 MiB
/dev/sda2 extended - 297.85 GiB
  /dev/sda5 lvm2 pv - 297.85 GiB
I also opened a terminal and ran testdisk. It only shows

Disk /dev/sr0 - 139 MB / 133 MB (RO) - TSSTcorp DVD+/-RW TS-L633J

I believe this is the LiveCD, right?

May I know what I need to do to recover my old OS'es?

Thank you in advance.

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Accidentally picked guided LVM setup in Debian, lost ext

#2 Post by cgrenier »

Run "sudo testdisk" to be root and be able to access all devices.

jasontan
Posts: 4
Joined: 04 Jul 2013, 02:09

Re: Accidentally picked guided LVM setup in Debian, lost ext

#3 Post by jasontan »

I used sudo after I realised it after submitting.

Anyway, here are my outputs so far. I just want to restore my Windows 7. The linux partition can be lost as I intend to install a new version.

Code: Select all

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

  TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
 Disk /dev/sda - 320 GB / 298 GiB - WDC WD3200BEKT-75PVMT0
 Disk /dev/mapper/latitude-root - 311 GB / 290 GiB - WDC WD3200BEKT-75PVMT0
 Disk /dev/mapper/latitude-swap_1 - 8376 MB / 7988 MiB - WDC WD3200BEKT-75PVMT0
 Disk /dev/sr0 - 139 MB / 133 MiB (RO) - TSSTcorp DVD+/-RW TS-L633J
 Disk /dev/dm-0 - 311 GB / 290 GiB - WDC WD3200BEKT-75PVMT0
>Disk /dev/dm-1 - 8376 MB / 7988 MiB - WDC WD3200BEKT-75PVMT0

>[Proceed ]  [  Quit  ]

Note: Disk capacity must be correctly detected for a successful recovery.
If a disk listed above has incorrect size, check HD jumper settings, BIOS
detection, and install the latest OS patches and disk drivers.

Code: Select all

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

Disk /dev/dm-0 - 311 GB / 290 GiB - CHS 608272384 1 1

The harddisk (311 GB / 290 GiB) seems too small! (< 308152 TB / 280263 TiB)
Check the harddisk size: HD jumpers settings, BIOS detection...

The following partitions can't be recovered:
     Partition               Start        End    Size in sectors
>  HPFS - NTFS             32838420 3962886610 3930048191
   HPFS - NTFS             41911148 3971959338 3930048191
   VMFS                    46001099 601860358877793 601860312876694
   HFS                    117876021 4115485565 3997609545
   HFS                    123417013 4121026557 3997609545
   FAT12                  138810452  692568915  553758464
   HFS                    141840582 1811238971 1669398390 [D$^D~KUM-4~I^T$ ~_
   HFS                    151594343 4149203887 3997609545
   FAT12                  174758842  728517305  553758464
   HFS                    252859084 1603916493 1351057410
   HFS                    258313764 1609371173 1351057410
   HFS                    263483514 1337783555 1074300042
   HPFS - NTFS            374594772 1060408282  685813511
   FAT16 LBA              435729006 4723898665 4288169660
   FAT16 <32M             436594115 1727539439 1290945325
   FAT12                  440915011 2540840575 2099925565
   Linux                  580464638  624637949   44173312 [home]
   Linux                  580464640  624637951   44173312 [home]
>  Linux                  602226736  646400047   44173312 [home]
   Linux                  602226832  646400143   44173312 [home]
   Linux                  602227040  646400351   44173312 [home]
   Linux                  602227336  646400647   44173312 [home]
   Linux                  602227680  646400991   44173312 [home]
   Linux                  602227744  646401055   44173312 [home]
   Linux                  602228144  646401455   44173312 [home]
>  Linux                  602228304  646401615   44173312 [home]

[ Continue ]
I did an analyse this morning and could see my original partitions:

Code: Select all

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

Disk /dev/sda - 320 GB / 298 GiB - CHS 38914 255 63
     Partition               Start        End    Size in sectors
>* FAT16 >32M               0   1  1     4 254 63      80262 [DellUtility]
 P HPFS - NTFS              5  25 21  1349  68 63   21594112 [RECOVERY]
 P HPFS - NTFS           1349  69  1 17952 137 26  266731505 [OS]
 L HPFS - NTFS          17952 170 11 34218  60 18  261306368 [data]
 L Linux                34218  92 51 35677  36  7   23435264 [boot]
 L Linux Swap           35677  68 40 36163 123 40    7811056
 L Linux                36163 156 26 38913  70  5   44173312 [home]

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
FAT16, 41 MB / 39 MiB
However, fdisk -l shows the following:

Code: Select all


Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x00070888

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      499711      248832   83  Linux
/dev/sda2          501758   625141759   312320001    5  Extended
/dev/sda5          501760   625141759   312320000   8e  Linux LVM

Disk /dev/mapper/latitude-root: 311.4 GB, 311435460608 bytes
255 heads, 63 sectors/track, 37863 cylinders, total 608272384 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: 0x00000000


Disk /dev/mapper/latitude-swap_1: 8376 MB, 8376025088 bytes
255 heads, 63 sectors/track, 1018 cylinders, total 16359424 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: 0x00000000
May I know what I should do next?

TomMDS
Posts: 1
Joined: 23 Jul 2013, 02:35

Re: Accidentally picked guided LVM setup in Debian, lost ext

#4 Post by TomMDS »

Not sure what you did but you could pick out the MBR and boot records similarly to what was doen for LVM here. Hopefully, the second copy of the MBR is still intact.

http://microdevsys.com/wp/linux-lvm-rec ... st-volume/

You could use the similar dd and fdisk commands to pick out the boot records and copy over. Won't be easily however.

On the other hand, if you overwrote the main partition with a Linux one and created or installed data after that....

Cheers,
TK

jasontan
Posts: 4
Joined: 04 Jul 2013, 02:09

Re: Accidentally picked guided LVM setup in Debian, lost ext

#5 Post by jasontan »

Code: Select all

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

Disk /dev/sda - 320 GB / 298 GiB - CHS 38914 255 63
     Partition               Start        End    Size in sectors
>* FAT16 >32M               0   1  1     4 254 63      80262 [DellUtility]
 P HPFS - NTFS              5  25 21  1349  68 63   21594112 [RECOVERY]
 P HPFS - NTFS           1349  69  1 17952 137 26  266731505 [OS]
 L HPFS - NTFS          17952 170 11 34218  60 18  261306368 [data]
 L Linux                34218  92 51 35677  36  7   23435264 [boot]
 L Linux Swap           35677  68 40 36163 123 40    7811056
 L Linux                36163 156 26 38913  70  5   44173312 [home]

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
Do I press A to add partition? Doing so sends me to the next form asking for Starting Cylinders, Starting Head, Starting Sector, Ending Cylinder, Ending Head, Ending Sector, Type, Done.

What values do I use. Can I get these from the table above?

So far, I am able to try to copy out my files from the missing partitions by going to list files, but it would be nice if I can restore everything back to status quo.

jasontan
Posts: 4
Joined: 04 Jul 2013, 02:09

Re: Accidentally picked guided LVM setup in Debian, lost ext

#6 Post by jasontan »

I did not manage to successfully restore my old partitions. It was way too complex for me.

Nevertheless, I managed to recover all my data. Dell gave me a replacement HDD and to top it up, I moved from Windows 7 32 bit to 64 bits.

Thank you for all the help.

Locked