linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Mamedov <rm@romanrm.net>
To: Matt Huszagh <huszaghmatt@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: How to replace a failing device
Date: Wed, 2 Nov 2022 00:32:32 +0500	[thread overview]
Message-ID: <20221102003232.097748e7@nvm> (raw)
In-Reply-To: <87v8nyh4jg.fsf@gmail.com>

On Tue, 01 Nov 2022 12:13:07 -0700
Matt Huszagh <huszaghmatt@gmail.com> wrote:

> $ sudo btrfs fi show
> Label: 'btrfs'  uuid: d31878d6-3a77-4f0f-9fdd-bb9a2c4e578b
>         Total devices 4 FS bytes used 2.76TiB
>         devid    1 size 931.01GiB used 928.99GiB path /dev/mapper/cryptnvme
>         devid    2 size 931.50GiB used 931.50GiB path /dev/mapper/cryptnvme1
>         devid    3 size 1.82TiB used 1.55TiB path /dev/mapper/cryptsdd1
>         devid    4 size 15.88TiB used 0.00B path /dev/mapper/cryptsdc2

Remove this cryptsdc2 from the FS (btrfs dev remove), stop the crypto device,
wipe sdc2 entirely with wipefs.

Then power-off, boot into a rescue system such as grml.org, and use "ddrescue"
to copy the entire content of ex-sdd1 to ex-sdc2. The reason for calling them
"ex", is because it is extremely unfortunate to refer to disks by their sd*
names like that, as those can vary per kernel, distro, random delays during
detection, etc -- and of course, the controller ports used. So double-check to
ensure you get the source and destination right.

After "ddrescue" manages to copy whatever it could, power-off and remove the
old failing "sdd" from the system. Do not boot the main OS with both disks
still plugged in. You can wipe the failing one later (after verifying the
created copy is good) on some other PC, or booting into the same rescue system
again.

Of course this eschews the question of why Btrfs is not behaving in a more
desirable way in these circumstances (maybe someone can weigh in on that), and
does not use its native tools to recover, but this feels to be just the most
straightforward idea of "what you can do" right now, to bring the system back
to working order.

> Label: 'backup'  uuid: 0bd10808-0330-4736-9425-059d4a0a300e
>         Total devices 2 FS bytes used 1.08TiB
>         devid    1 size 1.82TiB used 593.00GiB path /dev/mapper/cryptsdc1
>         devid    2 size 1.82TiB used 588.00GiB path /dev/mapper/cryptsdb1
> 
> (the above is printed, but the command doesn't return...)
> 
> $ sudo btrfs fi df /
> Data, single: total=3.15TiB, used=2.74TiB
> System, RAID1: total=32.00MiB, used=432.00KiB
> Metadata, RAID1: total=110.00GiB, used=18.25GiB
> GlobalReserve, single: total=512.00MiB, used=0.00B

-- 
With respect,
Roman

  reply	other threads:[~2022-11-01 19:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 19:13 How to replace a failing device Matt Huszagh
2022-11-01 19:32 ` Roman Mamedov [this message]
2022-11-01 19:44   ` Roman Mamedov
2022-11-03  3:51   ` Matt Huszagh
2022-11-03  4:19     ` Andrei Borzenkov
2022-11-03  4:25       ` Matt Huszagh
2022-11-03 12:18     ` Roman Mamedov
2022-11-03 21:39       ` Matt Huszagh
2022-11-03 22:32         ` Roman Mamedov

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=20221102003232.097748e7@nvm \
    --to=rm@romanrm.net \
    --cc=huszaghmatt@gmail.com \
    --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).