linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Restore btrfs partition
@ 2020-11-03  9:13 Alexey Isaev
  2020-11-05  1:00 ` Chris Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Isaev @ 2020-11-03  9:13 UTC (permalink / raw)
  To: linux-btrfs

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.

-- 
Best Regards,
Aleksey Isaev,
RQC


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Restore btrfs partition
  2020-11-03  9:13 Restore btrfs partition Alexey Isaev
@ 2020-11-05  1:00 ` Chris Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Murphy @ 2020-11-05  1:00 UTC (permalink / raw)
  To: Alexey Isaev; +Cc: Btrfs BTRFS

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-05  1:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  9:13 Restore btrfs partition Alexey Isaev
2020-11-05  1:00 ` Chris Murphy

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).