public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Jack <ostroffjh@users.sourceforge.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] data recovery advice needed
Date: Mon, 17 Dec 2018 18:19:39 -0500	[thread overview]
Message-ID: <BY3EDXP3.S2NFNEZW.XGQTYTMB@4227EL3E.Q5THDPJC.WKHPEOGB> (raw)
In-Reply-To: <20181217233254.4e979459@lexx> (from lists@baums-on-web.de on Mon Dec 17 17:32:54 2018)

On 2018.12.17 17:32, Heiko Baums wrote:
> Am Sat, 15 Dec 2018 18:33:35 -0500
> schrieb Jack <ostroffjh@users.sourceforge.net>:
> 
>> Some months ago, I borked a laptop HDD by trying to move a partition  
>> in a way that left both the old and new partitions invalid.  (For my  
>> sanity, I've forced the details out of my memory, but the old and  
>> new locations overlapped, and I think the move might have been  
>> interrupted.  My own fault, I know.)
> 
> Have you written anything on this HDD after moving those partitions?  
> And did you move the partitions or did you repartition the HDD?
At this point, unfortunately, my memory is hazy.  I did not  
repartition, but the damage made accessing anything difficult (see  
details below).  The additional problem is that now I'm getting  
physical read errors on the drive, so to be safe, I'd need to get  
another drive large enough to use ddrescue, and then go digging.
> 
> You could try to find the beginning of the old partitions with  
> hexedit and set a pointer to this position with losetup. Set the  
> offset to this position. Linux actually doesn't need partitions to  
> access the HDD and/or mount file systems. Partitions just make it a  
> lot easier.
At this point, I think I've forgotten the details, but using the  
example of a 300G drive with 100G empty and then a 200G partition, when  
I moved the partition to the beginning of the disk (using gparted, as I  
remember) once it moved more than the first 100G of the partition, it  
overwrote the beginning of the original partition, and once it  
overwrote any of the directory structure it still needed to know where  
stuff was, game over.   The first 100G of the "new" partition is  
essentially intact, but the damage to the beginning of the "old"  
partition makes it difficult to start.  I suppose I could go looking  
for any intact directory inodes and see whether it's intact enough to  
find anything of interest.  (There are really only a few files I would  
still like to recover - but as they are in fact .VDI files, it's likely  
all or nothing, because I don't think just part of one of them will be  
at all useful.)  In fact, it would be more acurate to say there was  
another 100G before all of that, and that partition is still intact,  
except for the read errors.
> 
> And keep in mind that partitions are written to the partition table  
> at the beginning of the drive. Repartitioning usually doesn't  
> overwrite any data. So if you haven't written anything onto the new  
> partitions (incl. formatting the new partitions) all the data is most  
> likely still there.
The "new" partition is incomplete, but essentially intact, as much of  
it is there.  The beginning of the "old" partition is overwitten with  
stuff from somewhere in the middle of the partition being moved.
> 
> So you could also try to recover your old partition table. Maybe the  
> backup of your old super block is still intact. Unfortunately I can't  
> remember how to find it out. Maybe with fdisk resp. gdisk or with  
> testdisk.
I know the location of all the partition starts and ends, so that's not  
the issue.  I just need lots more empty space to put the copies so I  
can safely go digging.
> 
> But there is a chance that the behavior of moving partitions is a bit  
> different than repartitioning the HDD, so that the data is actually  
> already overwritten by moving those partitions.
Exactly.
> 
> On the other hand, if you had really moved the partitions the  
> partitioning tool you used should have seen that both partitions  
> would overlap and shouldn't have done this.
I think I mentioned that.  I'm going to have to do some testing, and  
probably learn that gparted is smarter than I thought, which means I've  
clearly forgotten something else stupid that I did.  Otherwise, I'll  
file a bug against gparted.
> 
> That said, no matter which problem you have with an HDD, always stay  
> calm and think first before you do anything. In most cases you can  
> recover your data. But the first step is to stop working  
> (particularly writing) with this HDD. The second step is - as the  
> others already mentioned - to make a copy with dd or ddrescue.
All that would be good and "easy" (for some definition) if the disk  
itself were not in process of failing.
> 
> I had a lot of HDD crashes, logical and physical ones. And once I  
> even didn't have a backup. I never lost any data so far, not even a  
> bit.
I'd call that "famous last words" :-)
> 
> Heiko
Jack

  reply	other threads:[~2018-12-17 23:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 23:33 [gentoo-user] data recovery advice needed Jack
2018-12-16  0:06 ` Grant Taylor
2018-12-16  0:19 ` Rich Freeman
2018-12-17 19:32   ` Jack
2018-12-17 19:42     ` Rich Freeman
2018-12-17 20:53       ` Grant Taylor
2018-12-17 20:45     ` Grant Taylor
2018-12-18 12:21     ` Wols Lists
2018-12-18 14:20       ` Dale
2018-12-18 15:56       ` Grant Taylor
2018-12-18 21:28         ` Marc Joliet
2018-12-19 11:51           ` Mick
2018-12-18 17:43       ` Jack
2018-12-17 22:32 ` Heiko Baums
2018-12-17 23:19   ` Jack [this message]
2018-12-18  9:43     ` Peter Humphrey
2018-12-18 17:11       ` Jack
2018-12-18 17:42         ` Mick
2018-12-18 17:49           ` Jack
2018-12-18 18:33             ` Mick
2018-12-18 18:58             ` Grant Taylor
2018-12-18 18:51           ` Grant Taylor
2018-12-19 11:43             ` Mick
2018-12-19 18:46               ` Grant Taylor
2018-12-19 22:16                 ` Mick
2018-12-19 23:02                   ` Grant Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY3EDXP3.S2NFNEZW.XGQTYTMB@4227EL3E.Q5THDPJC.WKHPEOGB \
    --to=ostroffjh@users.sourceforge.net \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox