linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dd on wrong device, 1.9 GiB from the beginning has been overwritten, how to restore partition?
@ 2016-06-12 21:22 Maximilian Böhm
  2016-06-12 22:15 ` Martin Steigerwald
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Maximilian Böhm @ 2016-06-12 21:22 UTC (permalink / raw)
  To: linux-btrfs

Hi there, I did something terribly wrong, all blame on me. I wanted to
write to an USB stick but /dev/sdc wasn't the stick in this case but
an attached HDD with GPT and an 8 TB btrfs partition…

$ sudo dd bs=4M if=manjaro-kde-16.06.1-x86_64.iso of=/dev/sdc
483+1 Datensätze ein
483+1 Datensätze aus
2028060672 bytes (2,0 GB, 1,9 GiB) copied, 16,89 s, 120 MB/s

So, shit.

$ sudo btrfs check --repair /dev/sdc
enabling repair mode
No valid Btrfs found on /dev/sdc
Couldn't open file system

$ sudo btrfs-find-root /dev/sdc
No valid Btrfs found on /dev/sdc
ERROR: open ctree failed

$ sudo btrfs-show-super /dev/sdc --all
superblock: bytenr=65536, device=/dev/sdc
---------------------------------------------------------
ERROR: bad magic on superblock on /dev/sdc at 65536

superblock: bytenr=67108864, device=/dev/sdc
---------------------------------------------------------
ERROR: bad magic on superblock on /dev/sdc at 67108864

superblock: bytenr=274877906944, device=/dev/sdc
---------------------------------------------------------
ERROR: bad magic on superblock on /dev/sdc at 274877906944


System infos:

$ uname -a
Linux Mongo 4.6.2-1-MANJARO #1 SMP PREEMPT Wed Jun 8 11:00:08 UTC 2016
x86_64 GNU/Linux

$ btrfs --version
btrfs-progs v4.5.3

Don't think dmesg is necessary here.


OK, the btrfs wiki says there is a second superblock at 64 MiB
(overwritten too in my case) and a third at 256 GiB ("0x4000000000").
But how to restore it? And how to restore the general btrfs header
metadata? How to restore GPT without doing something terrible again?
Would be glad for any help!

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

end of thread, other threads:[~2016-06-20 14:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-12 21:22 dd on wrong device, 1.9 GiB from the beginning has been overwritten, how to restore partition? Maximilian Böhm
2016-06-12 22:15 ` Martin Steigerwald
2016-06-12 22:49 ` Henk Slager
2016-06-13  4:51   ` Andrei Borzenkov
2016-06-14 14:34     ` Maximilian Böhm
2016-06-20 14:24       ` Maximilian Böhm
2016-06-12 23:02 ` 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).