linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Murphy <lists@colorremedies.com>
To: Alexey Isaev <a.isaev@rqc.ru>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: Restore btrfs partition
Date: Wed, 4 Nov 2020 20:00:41 -0500	[thread overview]
Message-ID: <CAJCQCtRA94QCpi6hqNgxBapnGGz_APGgTegiWTM=50chdFRi9A@mail.gmail.com> (raw)
In-Reply-To: <ddaef86e-3487-369d-5528-2e2f0e0e9ba4@rqc.ru>

On Tue, Nov 3, 2020 at 4:21 AM Alexey Isaev <a.isaev@rqc.ru> wrote:
>
> Hello!
>
> I have accidentally overwritten partition table on hdd with btfs
> filesystem. Is it possible to restore it?
> There was only one partition on disk with btrfs.

Yes, pretty straightforward. Main idea is to find the first super
block . From that you can figure out what that start LBA is for the
partition; and from reading the superblock you can get the device
size, and make the partition exactly that size.

This does assume that it's only the partition map that's been
overwritten and not some part of the file system itself. They are
completely separate things with no overlap, so if the assumption
holds, the file system is unharmed.



-- 
Chris Murphy

      reply	other threads:[~2020-11-05  1:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  9:13 Restore btrfs partition Alexey Isaev
2020-11-05  1:00 ` Chris Murphy [this message]

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='CAJCQCtRA94QCpi6hqNgxBapnGGz_APGgTegiWTM=50chdFRi9A@mail.gmail.com' \
    --to=lists@colorremedies.com \
    --cc=a.isaev@rqc.ru \
    --cc=linux-btrfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).