Double confirmation for destructive actions

Morning everyone,

As a real fat-fingered guy I NEED double confirmation, or even triple, with big red flashing warning signs for anything that could potentially destroy my data.

Yesterday my fat right hand as a whole clicked on the ‘destroy’ button for one of the members of an unmounted btfrs array instead of the ‘import’ one, right a few pixels away of it (on my 4K TV they are soooo close, in my discharge). The one of my fat fingers clicked on the confirmation prompt as both actions (destroy and import) ask for ONE confirmation, just to feel a cold shiver running through my spine the millisecond I heard the mouse click and noticed the mess…

I will open a new thread with the trick that saved my ass, but this link

https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#What_if_I_don.27t_have_wipefs_at_hand.3F

with this sh gem:

If you want to restore the superblocks magic string, 
# echo "_BHRfS_M" | dd bs=1 count=8 of=/dev/sdXXX seek=$((64*1024+64))

is a real life saver. You can undo what wipefs did and recover your array as if no fat fingers ever touched it. It took me a couple hours to find it, so enjoy.

EDIT: changed sda to sdXXX to avoid fat finger copy&paste wreaking further havoc in your system. Removed instructions to restore 2nd and 3rd superblock copies as only the first one is overwritten by wipefs

2 Likes