Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] linux partition recovery

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
marzapane
Posts: 5
Joined: 2017-12-13 13:43

[SOLVED] linux partition recovery

#1 Post by marzapane »

Hello

I have an external 1TB hard disk with 1 ext4 partition.
After trying to mount it on Windows with Ext2explore and Ext2fsd something happend and I can not mount it anymore.
I tried all I know and found but nothing seems to work, this is what I've done:

The disk is /dev/sdb and the broken partition /dev/sdb1

Code: Select all

root@HP:/tmp/mount0# fdisk -l /dev/sdb
Disk /dev/sdb: 931.5 GiB, 1000204885504 bytes, 1953525167 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
Disklabel type: dos
Disk identifier: 0xfce82c18

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1        2048 1953525166 1953523119 931.5G 85 Linux extended

Code: Select all

root@HP:/tmp/mount0# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   199M  0 part 
├─sda2   8:2    0 459.4G  0 part /media/windows
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0   1.9G  0 part [SWAP]
├─sda6   8:6    0  61.7G  0 part /
├─sda7   8:7    0   476M  0 part /boot
└─sda8   8:8    0 407.9G  0 part /home
sdb      8:16   0 931.5G  0 disk 
└─sdb1   8:17   0     1K  0 part 
sr0     11:0    1  1024M  0 rom  

fdisk -l returns the right (I think) partition table but lsblk doesn't. When I try to mount:

Code: Select all

root@HP:/tmp/mount0# mount /dev/sdb1 /tmp/mount0/.
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

This is dmesg after trying to mount:

Code: Select all

root@HP:/tmp/mount0# dmesg | tail -3
[ 8975.092042] EXT4-fs (sdb1): unable to read superblock
[ 8975.092511] EXT4-fs (sdb1): unable to read superblock
[ 8975.092984] EXT4-fs (sdb1): unable to read superblock

So I tried to check the disk with some tools but none worked:

Code: Select all

root@HP:/tmp/mount0# dumpe2fs /dev/sdb1 
dumpe2fs 1.43.4 (31-Jan-2017)
dumpe2fs: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdb1
Couldn't find valid filesystem superblock.

Code: Select all

root@HP:/tmp/mount0# e2fsck -pc /dev/sdb1 
e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdb1
Could this be a zero-length partition?
I tried also with e2fsck -pc -b 32768 /dev/sdb1 and other superblocks possible locations guessed with mke2fs -n -v /dev/sdb

Code: Select all

root@HP:/tmp/mount0# parted /dev/sdb
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) rescue                                                           
Error: Invalid partition table on /dev/sdb -- wrong signature 0.
Ignore/Cancel? i                                                          
Start? 2048                                                               
End? 1953525166
(parted) print                                                            
Error: Invalid partition table on /dev/sdb -- wrong signature 0.
Ignore/Cancel? i                                                          
Model: Seagate Expansion (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  1000GB  1000GB  extended

(parted)q
root@HP:/tmp/mount0# dmesg | tail

[12567.537628] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE
[12567.537634] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor] 
[12567.537638] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information
[12567.537643] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(16) 85 06 20 00 00 00 00 00 00 00 00 00 00 00 e5 00
[12568.021560] sd 6:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE
[12568.021569] sd 6:0:0:0: [sdb] tag#0 Sense Key : Hardware Error [current] [descriptor] 
[12568.021574] sd 6:0:0:0: [sdb] tag#0 Add. Sense: No additional sense information
[12568.021581] sd 6:0:0:0: [sdb] tag#0 CDB: ATA command pass through(12)/Blank a1 06 20 da 00 00 4f c2 00 b0 00 00

I also performed a full scan with gpart, it lasted more than 24 hours, output was:

Code: Select all

** Error: invalid extended ptbl found at sector(2048).

dev(/dev/sdb) mss(512) chs(121601/255/63)(LBA) #s(1953525167) size(953869mb)
Primary partition(1)
   type: 133(0x85)(Extended Linux)
   size: 953868mb #s(1953523119) s(2048-1953525166)
   chs:  (0/32/33)-(1023/254/63)d (0/32/33)-(121601/80/62)r
   hex:  00 20 21 00 85 FE FF FF 00 08 00 00 AF 65 70 74

   Logical partition
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

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

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


Begin scan...
Possible partition(Windows NT/W2K FS), size(953867mb), offset(0mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 953867mb #s(1953520001) s(63-1953520063)
   chs:  (0/1/1)-(1023/254/63)d (0/1/1)-(121600/254/62)r
   hex:  00 01 01 00 07 FE FF FF 3F 00 00 00 81 59 70 74

Possible partition(Linux ext2), size(953868mb), offset(1mb)  <---------------- I think it's this one
   type: 131(0x83)(Linux ext2 filesystem)
   size: 953868mb #s(1953523112) s(2048-1953525159)
   chs:  (0/32/33)-(1023/254/63)d (0/32/33)-(121601/80/55)r
   hex:  00 20 21 00 83 FE FF FF 00 08 00 00 A8 65 70 74

Possible partition(Windows NT/W2K FS), size(5117mb), offset(211764mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 5117mb #s(10481663) s(433692920-444174582)
   chs:  (1023/254/63)-(1023/254/63)d (26996/34/39)-(27648/150/13)r
   hex:  00 FE FF FF 07 FE FF FF F8 A0 D9 19 FF EF 9F 00

Possible partition(Windows NT/W2K FS), size(3mb), offset(327070mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 3mb #s(6173) s(669841348-669847520)
   chs:  (1023/254/63)-(1023/254/63)d (41695/177/23)-(41696/20/21)r
   hex:  00 FE FF FF 07 FE FF FF C4 F7 EC 27 1D 18 00 00

Possible partition(Windows NT/W2K FS), size(0mb), offset(572036mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(1171530569-1171530569)
   chs:  (1023/254/63)-(1023/254/63)d (72924/103/21)-(72924/103/21)r
   hex:  00 FE FF FF 07 FE FF FF 49 23 D4 45 01 00 00 00

Possible partition(Windows NT/W2K FS), size(3mb), offset(574733mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 3mb #s(6173) s(1177053372-1177059544)
   chs:  (1023/254/63)-(1023/254/63)d (73268/46/55)-(73268/144/53)r
   hex:  00 FE FF FF 07 FE FF FF BC 68 28 46 1D 18 00 00

Possible partition(Windows NT/W2K FS), size(3mb), offset(591087mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 3mb #s(6173) s(1210547388-1210553560)
   chs:  (1023/254/63)-(1023/254/63)d (75353/22/58)-(75353/120/56)r
   hex:  00 FE FF FF 07 FE FF FF BC 7C 27 48 1D 18 00 00

Possible partition(Windows NT/W2K FS), size(0mb), offset(673022mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(1378350037-1378350037)
   chs:  (1023/254/63)-(1023/254/63)d (85798/82/2)-(85798/82/2)r
   hex:  00 FE FF FF 07 FE FF FF D5 F3 27 52 01 00 00 00

Possible partition(Windows NT/W2K FS), size(0mb), offset(743710mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(1523120037-1523120037)
   chs:  (1023/254/63)-(1023/254/63)d (94809/213/34)-(94809/213/34)r
   hex:  00 FE FF FF 07 FE FF FF A5 F7 C8 5A 01 00 00 00

Possible partition(Windows NT/W2K FS), size(0mb), offset(743752mb)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 0mb #s(1) s(1523204101-1523204101)
   chs:  (1023/254/63)-(1023/254/63)d (94815/17/56)-(94815/17/56)r
   hex:  00 FE FF FF 07 FE FF FF 05 40 CA 5A 01 00 00 00

End scan.

Checking partitions...

* Warning: Discarded 9 overlapping partition guesses.
Partition(OS/2 HPFS, NTFS, QNX or Advanced UNIX): primary 
Ok.

Guessed primary partition table:
Primary partition(1)
   type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
   size: 953867mb #s(1953520001) s(63-1953520063)
   chs:  (0/1/1)-(1023/254/63)d (0/1/1)-(121600/254/62)r
   hex:  00 01 01 00 07 FE FF FF 3F 00 00 00 81 59 70 74

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

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

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

And these are the first 512 bytes:

Code: Select all

root@HP:/tmp/mount0# dd if=/dev/sdb bs=512 count=1 | hexdump -C
00000000  33 c0 8e d0 bc 00 7c 8e  c0 8e d8 be 00 7c bf 00  |3.....|......|..|
00000010  06 b9 00 02 fc f3 a4 50  68 1c 06 cb fb b9 04 00  |.......Ph.......|
00000020  bd be 07 80 7e 00 00 7c  0b 0f 85 0e 01 83 c5 10  |....~..|........|
00000030  e2 f1 cd 18 88 56 00 55  c6 46 11 05 c6 46 10 00  |.....V.U.F...F..|
00000040  b4 41 bb aa 55 cd 13 5d  72 0f 81 fb 55 aa 75 09  |.A..U..]r...U.u.|
00000050  f7 c1 01 00 74 03 fe 46  10 66 60 80 7e 10 00 74  |....t..F.f`.~..t|
00000060  26 66 68 00 00 00 00 66  ff 76 08 68 00 00 68 00  |&fh....f.v.h..h.|
00000070  7c 68 01 00 68 10 00 b4  42 8a 56 00 8b f4 cd 13  ||h..h...B.V.....|
00000080  9f 83 c4 10 9e eb 14 b8  01 02 bb 00 7c 8a 56 00  |............|.V.|
00000090  8a 76 01 8a 4e 02 8a 6e  03 cd 13 66 61 73 1c fe  |.v..N..n...fas..|
000000a0  4e 11 75 0c 80 7e 00 80  0f 84 8a 00 b2 80 eb 84  |N.u..~..........|
000000b0  55 32 e4 8a 56 00 cd 13  5d eb 9e 81 3e fe 7d 55  |U2..V...]...>.}U|
000000c0  aa 75 6e ff 76 00 e8 8d  00 75 17 fa b0 d1 e6 64  |.un.v....u.....d|
000000d0  e8 83 00 b0 df e6 60 e8  7c 00 b0 ff e6 64 e8 75  |......`.|....d.u|
000000e0  00 fb b8 00 bb cd 1a 66  23 c0 75 3b 66 81 fb 54  |.......f#.u;f..T|
000000f0  43 50 41 75 32 81 f9 02  01 72 2c 66 68 07 bb 00  |CPAu2....r,fh...|
00000100  00 66 68 00 02 00 00 66  68 08 00 00 00 66 53 66  |.fh....fh....fSf|
00000110  53 66 55 66 68 00 00 00  00 66 68 00 7c 00 00 66  |SfUfh....fh.|..f|
00000120  61 68 00 00 07 cd 1a 5a  32 f6 ea 00 7c 00 00 cd  |ah.....Z2...|...|
00000130  18 a0 b7 07 eb 08 a0 b6  07 eb 03 a0 b5 07 32 e4  |..............2.|
00000140  05 00 07 8b f0 ac 3c 00  74 09 bb 07 00 b4 0e cd  |......<.t.......|
00000150  10 eb f2 f4 eb fd 2b c9  e4 64 eb 00 24 02 e0 f8  |......+..d..$...|
00000160  24 02 c3 49 6e 76 61 6c  69 64 20 70 61 72 74 69  |$..Invalid parti|
00000170  74 69 6f 6e 20 74 61 62  6c 65 00 45 72 72 6f 72  |tion table.Error|
00000180  20 6c 6f 61 64 69 6e 67  20 6f 70 65 72 61 74 69  | loading operati|
00000190  6e 67 20 73 79 73 74 65  6d 00 4d 69 73 73 69 6e  |ng system.Missin|
000001a0  67 20 6f 70 65 72 61 74  69 6e 67 20 73 79 73 74  |g operating syst|
000001b0  65 6d 00 00 00 63 7b 9a  18 2c e8 fc 00 00 00 20  |em...c{..,..... |
000001c0  21 00 85 fe ff ff 00 08  00 00 af 65 70 74 00 00  |!..........ept..|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
I really have no idea what to do, I can't understand if all my datas are gone forever or just some partition table trick to do.
Please, there's my job in that hard disk.
Thank you
Last edited by marzapane on 2017-12-16 01:52, edited 1 time in total.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: linux partition recovery

#2 Post by bw123 »

Type
85 Linux extended
Never used this (85) for partition code, what's it do?
resigned by AI ChatGPT

marzapane
Posts: 5
Joined: 2017-12-13 13:43

Re: linux partition recovery

#3 Post by marzapane »

I really have no idea why is 85. I think it should be 83.

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1402
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 46 times
Been thanked: 68 times

Re: linux partition recovery

#4 Post by None1975 »

bw123 wrote:
Never used this (85) for partition code, what's it do?
This code means that it is Linux extended.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: linux partition recovery

#5 Post by Segfault »

Partition recovery tool is testdisk, filesystem recovery tool is fsck.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: linux partition recovery

#6 Post by GarryRicketson »

When the data is so important and your job depends on it, keeping up to date
back ups is essential, one never knows when a disk might fail, for any reason,
it happens.
Then the partition recovery is as simple as using the back up copy that was
made.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: linux partition recovery

#7 Post by bw123 »

I recall hearing about this in IRC a couple months ago, these non-linux ext drivers don't seem mature yet. The person described corruption just by having the driver installed, not even reading from the disk. I think there are problems with different versions of e2fs and also with x86 vs 64bit, so I like the idea, but I wouldn't want to beta test it.

I'm not sure what i would do. I KNOW my partitions are type 83, so if one of these drivers changed it to 85 as some kind of voodoo that would be a clue.
resigned by AI ChatGPT

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: linux partition recovery

#8 Post by Segfault »

No reading operation should write anything to the disk, leave alone changing partitioning structure. There is a reason honest people use doors instead of windows. If there is no backup then the data is not important, everyone knows any hard drive can die any time.

lostfarmer
Posts: 19
Joined: 2016-05-07 01:13
Location: Idaho

Re: linux partition recovery

#9 Post by lostfarmer »

marzapane- in a root terminal run

Code: Select all

dd if=/dev/sdb skip=2048 count=2 bs=512 |xxd
I expect all 00's but if it is not post the lines with data.

if all 00's in terminal

Code: Select all

dd if=/dev/sdb skip=2050 count=1 bs=512 |xxd
post its output

if the partition code is correct of 85 then I am not sure what to expect. hopping the correct code is 83 then the first 2 sectors should be 00's and the 3rd is the partition header.

marzapane
Posts: 5
Joined: 2017-12-13 13:43

Re: linux partition recovery

#10 Post by marzapane »

First of all thanks to all.
This is the output of dd as asked by lostfarmer

Code: Select all

n00b@HP:~$ sudo dd if=/dev/sdb skip=2048 count=2 bs=512 | xxd
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000210: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000220: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000230: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000240: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000250: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000260: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000270: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000280: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000290: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000002f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000300: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000310: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000320: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000330: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000340: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000350: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000360: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000370: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000380: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000390: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000003f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
n00b@HP:~$ 
and

Code: Select all

n00b@HP:~$ sudo dd if=/dev/sdb skip=2050 count=1 bs=512 |xxd
1+0 records in
1+0 records out
512 bytes copied, 4.5331e-05 s, 11.3 MB/s
00000000: 00a0 a303 b50c 8e0e 6f4d ba00 3284 9f04  ........oM..2...
00000010: 8ad0 a103 0000 0000 0200 0000 0200 0000  ................
00000020: 0080 0000 0080 0000 0020 0000 a68d 2d5a  ......... ....-Z
00000030: 9ab8 2d5a 4200 ffff 53ef 0100 0100 0000  ..-ZB...S.......
00000040: 68d3 8257 0000 0000 0000 0000 0100 0000  h..W............
00000050: 0000 0000 0b00 0000 0001 0000 3c00 0000  ............<...
00000060: 4202 0000 7b00 0000 9dcd b750 d588 4d26  B...{......P..M&
00000070: ab8f d6fd 8361 2b5c 0000 0000 0000 0000  .....a+\........
00000080: 0000 0000 0000 0000 2f6d 6564 6961 2f6e  ......../media/n
00000090: 3030 622f 3964 6364 6237 3530 2d64 3538  00b/9dcdb750-d58
000000a0: 382d 3464 3236 2d61 6238 662d 6436 6664  8-4d26-ab8f-d6fd
000000b0: 3833 3631 3262 3563 0036 3132 6235 6300  83612b5c.612b5c.
000000c0: 0000 0000 0000 0000 0000 0000 0000 c503  ................
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0800 0000 0000 0000 0000 0000 79b3 ed3f  ............y..?
000000f0: 8b0e 465a b545 67b1 7e3c 54cf 0101 0000  ..FZ.Eg.~<T.....
00000100: 0c00 0000 0000 0000 68d3 8257 0af3 0200  ........h..W....
00000110: 0400 0000 0000 0000 0000 0000 ff7f 0000  ................
00000120: 0080 4007 ff7f 0000 0100 0000 ffff 4007  ..@...........@.
00000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000140: 0000 0000 0000 0000 0000 0000 0000 0008  ................
00000150: 0000 0000 0000 0000 0000 0000 1c00 1c00  ................
00000160: 0100 0000 0000 0000 0000 0000 0000 0000  ................
00000170: 0000 0000 0400 0000 c45b 6125 0000 0000  .........[a%....
00000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: linux partition recovery

#11 Post by Segfault »

Interesting. The title was partition recovery, now you are investigating what happened instead of fixing it.

lostfarmer
Posts: 19
Joined: 2016-05-07 01:13
Location: Idaho

Re: linux partition recovery

#12 Post by lostfarmer »

the partition type code is incorrect based on the outputs of the dd command. it needs change from type 85 to 83 , you can use 'fdisk' to make the change but you are using an older version (i prefer it) but do not remember the menus . Your version and mine are total different. You will have an option in one of the menu's to change partition type code. After the change be sure to select 'w' to write the change to disk. The change may not take effect till you run 'partprobe' or reboot. ( If you can not figure out what to do, post back)

There are other programmes that can be used for direct hdd data modifications, I have used wxHexEditor (no more)but it has a very bad bug , it writes the changed sector to ( sector +1) with the latest version of program.

marzapane
Posts: 5
Joined: 2017-12-13 13:43

Re: linux partition recovery

#13 Post by marzapane »

Thanks so much, I am now using testdisk on a rescued image of the partition. As soon as possible I'll try to change partition type and edit this message with the results.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: linux partition recovery

#14 Post by p.H »

None1975 wrote:
bw123 wrote:
Never used this (85) for partition code, what's it do?
This code means that it is Linux extended.
IMO, "Linux extended" is not so explicit. Usually GNU/Linux does not care much about partition codes, but 85h appears to be special. The Linux kernel interprets this code in the same way as 05, i.e. as an extended partition. The first sector of an extended partition (EBR) is supposed to contain an extended partition table describing the first logical partition and the next nested extended partition (not shown by most partition tools).

The way the Linux kernel handles an extended partition is a bit special : it creates a block device /dev/sdb1 as for any partition, but its size is limited to 1 KiB regardless of the actual partition size, as can be seen in the output of lsblk (or in /proc/partitions). This prevents to read it beyond the first EBR, leading to "short read" errors as in the original post.

Thus I second the idea to change the type back to any code that is not interpreted in a special way, such as 83h.
Segfault wrote:The title was partition recovery, now you are investigating what happened instead of fixing it.
Understanding what happened is often a good way to know how to fix things, or at least know if things can be fixed.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: linux partition recovery

#15 Post by Segfault »

What happened is a non-mature OS borked the partition table. To fix it one fires up fdisk or similar and rewrites the partition table. Re-writing the partition table without changes to partition boundaries will not affect filesystems, they will be intact and readable again. The whole operation takes a minute or so.

marzapane
Posts: 5
Joined: 2017-12-13 13:43

Re: linux partition recovery

#16 Post by marzapane »

Ok, first of all thanks to everyone.
I managed to fix the partition, I used fdisk and changed with the "t" command the partition type from 85 to 83, then reboot. Everything was ok, now I can mount and backup all my jobs. Thanks again, especially who suggested to simply change the partition type!

Bulkley
Posts: 6386
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: linux partition recovery

#17 Post by Bulkley »

marzapane wrote:I managed to fix the partition, I used fdisk and changed with the "t" command the partition type from 85 to 83, then reboot.
Good! Would you please mark this thread as SOLVED. It might help someone else.

Post Reply