From e263a25aae9774b3b9608243fe1b9cd592ff0020 Mon Sep 17 00:00:00 2001 From: Cameron Otsuka Date: Mon, 16 Mar 2026 20:10:16 -0700 Subject: [PATCH] use shell for prism --- .../removing-a-drive-from-a-btrfs-array.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/articles/removing-a-drive-from-a-btrfs-array.mdx b/content/articles/removing-a-drive-from-a-btrfs-array.mdx index 613b4bd..df09719 100644 --- a/content/articles/removing-a-drive-from-a-btrfs-array.mdx +++ b/content/articles/removing-a-drive-from-a-btrfs-array.mdx @@ -24,13 +24,13 @@ At this point, I was okay with losing any corrupted/unrecoverable files. You sho Start a scrub to identify files blocking the device from getting deleted: -```console +```shell [cameron@host ~]$ sudo btrfs scrub start /mnt/btrfs ``` The scrub will take a while. In my case, it took nearly 27 hours: -```console +```shell [cameron@host ~]$ sudo btrfs scrub status /mnt/btrfs UUID: 16df0a0e-1dad-439f-aee1-f9961122fe59 Scrub started: Tue Jul 4 11:27:56 2023 @@ -48,7 +48,7 @@ Error summary: read=256 Btrfs was able to correct many of the errors it came across, but in this instance I was left with 18 uncorrectable errors. As the scrub identifies these, it will report them into the kernel ring buffer (`dmesg`). I found it nearly impossible to search through that, since the messages would either fall out of the log by the time I came back to the terminal to search. Instead, `journalctl` keeps a full enough history to search through: -```console +```shell [cameron@host ~]$ sudo journalctl --dmesg --grep 'unable to fixup' Jul 04 13:56:48 host kernel: BTRFS error (device sdh): unable to fixup (regular) error at logical 32574079762432 on dev /dev/sdd physical 1251936043008 Jul 04 13:58:27 host kernel: BTRFS error (device sdh): unable to fixup (regular) error at logical 32615643807744 on dev /dev/sdd physical 1265582800896 @@ -72,7 +72,7 @@ Jul 04 14:17:38 host kernel: BTRFS error (device sdh): unable to fixup (regular) Now we need to translate those logicals into files we can actually attempt removing: -```console +```shell [cameron@host ~]$ sudo btrfs inspect-internal logical-resolve 32574079762432 /mnt/btrfs /mnt/btrfs/P6300090.mov ``` @@ -83,14 +83,14 @@ The output shows logical `32574079762432` refers to `/mnt/btrfs/P6300090.mov`. R Now remount the Btrfs array, marking it as degraded. Then, delete the device you want to remove (in my case `/dev/sdd`): -```console +```shell [cameron@host ~]$ sudo mount -o degraded /dev/sdd /mnt/btrfs [cameron@host ~]$ sudo btrfs device delete /dev/sdd /mnt/btrfs ``` The device deletion will also take a while, but now you should see the used data total on the device you're deleting reduce over time: -```console +```shell [cameron@host ~]$ sudo btrfs fi show Label: none uuid: 16df0a0e-1dad-439f-aee1-f9961122fe59 Total devices 7 FS bytes used 31.16TiB @@ -105,7 +105,7 @@ Label: none uuid: 16df0a0e-1dad-439f-aee1-f9961122fe59 And here's the same a while later: -```console +```shell [cameron@host ~]$ sudo btrfs fi show Label: none uuid: 16df0a0e-1dad-439f-aee1-f9961122fe59 Total devices 7 FS bytes used 31.16TiB -- 2.53.0