how to recover partition table using gpart

Sir yesterday while I was operating suse12.2 power failure occurred at that time I was accessing another internal harddisk finally I opened gparted and found no partitions. In gparted I have selected the option create partition table and also I ran the tool testdisk but no use.After that I ran the command gpart /dev/sda and found four partitions. Can you please describe how to recover partition table using gpart.

Regards,
Rupesh.

Actually I am having two harddisks one 500GB on which I have installed suse and another harddisk of size 160GB on which I have installed Windows7.

see here ==> Recover mbr - How to recover partition table using Test Disk ( GParted live disc ) - YouTube

Sir yesterday I have ran testdisk three to four times on opensuse12.2 and each and every time it is showing errors like cylinders are not in correct position etc., so can I trust that tool and also I think it has destroyed my disk completely. At present I have gparted live disk.

On 2013-04-24 09:46, rupeshforu3 wrote:
>
> Sir yesterday I have ran testdisk three to four times on opensuse12.2
> and each and every time it is showing errors like cylinders are not in
> correct position etc., so can I trust that tool and also I think it has
> destroyed my disk completely. At present I have gparted live disk.

Are you sure that disk is healthy?

Please run:


su -
smartctl --test=short /dev/sdX
# wait two minutes
smartctl -a /dev/sdX

and post all that here inside code tags. Advanced editor, ‘#’ button.
Posting in
Code Tags - A Guide


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

gpart main functionality is to discover lost partitions. So kindly can you give suggestions on how to use gpart.

On 2013-04-24 12:16, rupeshforu3 wrote:
>
> gpart main functionality is to discover lost partitions. So kindly can
> you give suggestions on how to use gpart.

No.

Please answer my question first.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

The results are too long. Kindly analyse the outputs I provided and suggest a solution.

The output of fdisk -l is given below

linux-k4gi:~ # fdisk -l /dev/sda

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x00053a50

Device Boot Start End Blocks Id System
linux-k4gi:~ #

smartctl --test=short /dev/sda output is given below

linux-k4gi:~ # smartctl --test=short /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-3.4.6-2.10-desktop] (SUSE RPM)
Copyright (C) 2002-11 by Bruce Allen, smartmontools

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: “Execute SMART Short self-test routine immediately in off-line mode”.
Drive command “Execute SMART Short self-test routine immediately in off-line mode” successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Thu Apr 25 22:34:30 2013

Use smartctl -X to abort test.
linux-k4gi:~ #

smartctl -a /dev/sda output is given below

linux-k4gi:~ # smartctl -a /dev/sda
smartctl 5.42 2011-10-20 r3458 [x86_64-linux-3.4.6-2.10-desktop] (SUSE RPM)
Copyright (C) 2002-11 by Bruce Allen, smartmontools

=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.11
Device Model: ST3160813AS
Serial Number: 9SY0VERE
LU WWN Device Id: 5 000c50 01119b922
Firmware Version: CC2F
User Capacity: 160,041,885,696 bytes [160 GB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
Local Time is: Thu Apr 25 22:36:31 2013 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 609) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 33) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x103f) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 113 093 006 Pre-fail Always - 51065359
3 Spin_Up_Time 0x0003 100 098 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 095 095 020 Old_age Always - 5159
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 079 060 030 Pre-fail Always - 97576970
9 Power_On_Hours 0x0032 096 096 000 Old_age Always - 4053
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 095 037 020 Old_age Always - 5413
184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 001 001 000 Old_age Always - 1092
188 Command_Timeout 0x0032 100 094 000 Old_age Always - 65913
189 High_Fly_Writes 0x003a 018 018 000 Old_age Always - 82
190 Airflow_Temperature_Cel 0x0022 059 048 045 Old_age Always - 41 (Min/Max 32/41)
194 Temperature_Celsius 0x0022 041 052 000 Old_age Always - 41 (0 20 0 0 0)
195 Hardware_ECC_Recovered 0x001a 059 041 000 Old_age Always - 51065359
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 19
240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 208731115622319
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 3552289036
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 2189100733

SMART Error Log Version: 1
ATA Error Count: 885 (device log contains only the most recent five errors)
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It “wraps” after 49.710 days.

Error 885 occurred at disk power-on lifetime: 1903 hours (79 days + 7 hours)
When the command that caused the error occurred, the device was active or idle.

After command completion occurred, registers were:
ER ST SC SN CL CH DH


40 51 00 b8 e3 93 03 Error: UNC at LBA = 0x0393e3b8 = 60023736

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name


42 d8 01 b8 e3 93 e3 00 00:32:57.685 READ VERIFY SECTOR(S) EXT
25 d8 01 00 f8 8e ef 00 00:32:57.667 READ DMA EXT
42 d8 02 ba e3 93 e3 00 00:32:57.649 READ VERIFY SECTOR(S) EXT
25 d8 01 43 b1 fe ec 00 00:32:57.630 READ DMA EXT
42 d8 02 b8 e3 93 e3 00 00:32:54.912 READ VERIFY SECTOR(S) EXT

Error 884 occurred at disk power-on lifetime: 1903 hours (79 days + 7 hours)
When the command that caused the error occurred, the device was active or idle.

After command completion occurred, registers were:
ER ST SC SN CL CH DH


40 51 00 b8 e3 93 03 Error: UNC at LBA = 0x0393e3b8 = 60023736

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name


42 d8 02 b8 e3 93 e3 00 00:32:54.912 READ VERIFY SECTOR(S) EXT
25 d8 01 00 28 c6 eb 00 00:32:54.893 READ DMA EXT
42 d8 04 bc e3 93 e3 00 00:32:54.881 READ VERIFY SECTOR(S) EXT
25 d8 01 d7 e4 3b e8 00 00:32:54.823 READ DMA EXT
42 d8 04 b8 e3 93 e3 00 00:32:52.142 READ VERIFY SECTOR(S) EXT

Error 883 occurred at disk power-on lifetime: 1903 hours (79 days + 7 hours)
When the command that caused the error occurred, the device was active or idle.

After command completion occurred, registers were:
ER ST SC SN CL CH DH


40 51 00 b8 e3 93 03 Error: UNC at LBA = 0x0393e3b8 = 60023736

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name


42 d8 08 b8 e3 93 e3 00 00:32:49.306 READ VERIFY SECTOR(S) EXT
25 d8 01 00 00 00 e0 00 00:32:49.304 READ DMA EXT
42 d8 08 b0 e3 93 e3 00 00:32:49.296 READ VERIFY SECTOR(S) EXT
25 d8 01 00 00 00 e0 00 00:32:49.295 READ DMA EXT
42 d8 10 c0 e3 93 e3 00 00:32:49.283 READ VERIFY SECTOR(S) EXT

Error 882 occurred at disk power-on lifetime: 1903 hours (79 days + 7 hours)
When the command that caused the error occurred, the device was active or idle.

After command completion occurred, registers were:
ER ST SC SN CL CH DH


40 51 00 b8 e3 93 03 Error: UNC at LBA = 0x0393e3b8 = 60023736

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name


42 d8 10 b0 e3 93 e3 00 00:32:46.512 READ VERIFY SECTOR(S) EXT
25 d8 01 ff ff ff ef 00 00:32:46.489 READ DMA EXT
42 d8 20 d0 e3 93 e3 00 00:32:46.465 READ VERIFY SECTOR(S) EXT
25 d8 01 00 f8 8e ef 00 00:32:46.411 READ DMA EXT
42 d8 20 b0 e3 93 e3 00 00:32:43.698 READ VERIFY SECTOR(S) EXT

Error 881 occurred at disk power-on lifetime: 1903 hours (79 days + 7 hours)
When the command that caused the error occurred, the device was active or idle.

After command completion occurred, registers were:
ER ST SC SN CL CH DH


40 51 00 b8 e3 93 03 Error: UNC at LBA = 0x0393e3b8 = 60023736

Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name


42 d8 00 b0 e3 93 e3 00 00:32:35.223 READ VERIFY SECTOR(S) EXT
25 d8 01 00 00 00 e0 00 00:32:35.208 READ DMA EXT
42 00 00 b0 e3 93 43 00 00:32:32.480 READ VERIFY SECTOR(S) EXT
42 00 00 b0 d9 8a 43 00 00:32:30.019 READ VERIFY SECTOR(S) EXT
42 d8 00 b0 c9 7e e3 00 00:32:26.765 READ VERIFY SECTOR(S) EXT

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error

1 Short offline Completed without error 00% 4053 -

SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

linux-k4gi:~ #

Sir I am providing the output of*** gpart -vf /dev/sda*** also. Please suggest the solution with patience

linux-k4gi:~ # gpart -vf /dev/sda

dev(/dev/sda) mss(512) chs(19457/255/63)(LBA) #s(312576705) size(152625mb)

  • Warning: strange partition table magic 0x0000.
    Primary partition(1)
    type: 000(0x00)(unused)
    size: 0mb #s(0) s(0-0)
    chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
    hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(2)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(3)
type: 000(0x00)(unused)
size: 21mb #s(43605) s(0-43604)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(2/182/9)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA 00 00 00 00 00 00

Primary partition(4)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Begin scan…
End scan.

Checking partitions…
Ok.

Guessed primary partition table:
Primary partition(1)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(2)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(3)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(4)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
hex: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

linux-k4gi:~ #

On 2013-04-24 13:46, rupeshforu3 wrote:
>
> The results are too long. Kindly analyse the outputs I provided and
> suggest a solution.

I told you to use code tags and you did not. This makes things more
difficult.


> SMART Attributes Data Structure revision number: 10
> Vendor Specific SMART Attributes with Thresholds:
> ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE
> UPDATED  WHEN_FAILED RAW_VALUE

>   5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0

>   9 Power_On_Hours          0x0032   096   096   000    Old_age   Always       -       4053

> 197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
> 198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0


> SMART Self-test log structure revision number 1
> Num  Test_Description    Status                  Remaining
> LifeTime(hours)  LBA_of_first_error
> # 1  Short offline       Completed without error       00%      4053

Not bad, so far. Now you should run the long test, we have to make sure
the disk is not damaged.


su -
smartctl --test=long /dev/sdX
# wait about an hour or two, as specified in the message
smartctl -a /dev/sdX

And post the result here - mind, inside code tags.

On 2013-04-24 14:26, rupeshforu3 wrote:>
> Sir I am providing the output of-* gpart -vf /dev/sda*- also. Please
> suggest the solution with patience

I’m sorry, but there is nothing to recover, there is absolutely no
partition data there.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

sir yesterday I have ran testdisk using gparted livecd and I have recovered two Windows partitions but one ext3 partition is left.All partitions are primary.I am unable to recover ext3 partition using testdisk and it is showing that the partition can’t be recovered. I have also tried gpart using gparted livecd and it recovered only one Windows partition. Is there any other tool in Linux or software in Windows to recover the ext3 partition.

On 2013-04-25 04:56, rupeshforu3 wrote:
>
> sir yesterday I have ran testdisk using gparted livecd and I have
> recovered two Windows partitions but one ext3 partition is left.All
> partitions are primary.I am unable to recover ext3 partition using
> testdisk and it is showing that the partition can’t be recovered. I have
> also tried gpart using gparted livecd and it recovered only one Windows
> partition. Is there any other tool in Linux or software in Windows to
> recover the ext3 partition.

If your data is very important, there are businesses that make a living
out of recovering data. They can charge a lot, like a thousand dollars.
Up to you.

To me, your disk is bad, and you still have not finished checking it.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)