linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas <74cmonty@gmail.com>
To: Chris Murphy <lists@colorremedies.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: BTRFS error (device sda1): bdev /dev/sdb1 errs: wr 2702175, rd 2719033, flush 0, corrupt 6, gen 0
Date: Fri, 2 Apr 2021 22:46:25 +0200	[thread overview]
Message-ID: <57292e4b-549d-9ce1-7967-32e6820c80e5@gmail.com> (raw)
In-Reply-To: <CAJCQCtR5zeC=jNRf0iSHpqQXDOBExfFzfGj+PzMTxs_S1JVmVg@mail.gmail.com>

Hi,

I finished repartition of devices /dev/sda + /dev/sdb now.
On both devices the first partition is equal in size:
$ sudo fdisk -l /dev/sda
Festplatte /dev/sda: 238,47 GiB, 256060514304 Bytes, 500118192 Sektoren
Festplattenmodell: SanDisk SD8SBAT2
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0x0914a19b

Gerät      Boot    Anfang      Ende  Sektoren Größe Kn Typ
/dev/sda1            2048 497027071 497025024  237G 83 Linux
/dev/sda2       497027072 500118191   3091120  1,5G 82 Linux Swap / Solaris


$ sudo fdisk -l /dev/sdb
Festplatte /dev/sdb: 238,47 GiB, 256060514304 Bytes, 500118192 Sektoren
Festplattenmodell: SanDisk SD9TB8W2
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0xf23fc590

Gerät      Boot Anfang      Ende  Sektoren Größe Kn Typ
/dev/sdb1         2048 497027071 497025024  237G 83 Linux


However, the output of btrfs insp dump-s <device> is still different:
$ sudo btrfs insp dump-s /dev/sda1 | grep dev_item.total_bytes
dev_item.total_bytes    254476812288

$ sudo btrfs insp dump-s /dev/sdb1 | grep dev_item.total_bytes
dev_item.total_bytes    256059465728


Can you please advise how to fix this?
My understanding is that size of btrfs superblock must be equal on both
devices.


THX


Am 13.03.21 um 19:02 schrieb Chris Murphy:
> On Sat, Mar 13, 2021 at 5:22 AM Thomas <74cmonty@gmail.com> wrote:
>
>> Gerät      Boot Anfang      Ende  Sektoren  Größe Kn Typ
>> /dev/sdb1         2048 496093750 496091703 236,6G 83 Linux
>> However the output of btrfs insp dump-s <device> is different:
>> thomas@pc1-desktop:~
>> $ sudo btrfs insp dump-s /dev/sdb1 | grep dev_item.total_bytes
>> dev_item.total_bytes    256059465728
> sdb1 has 253998951936 bytes which is *less* than the btrfs super block
> is saying it should be. 1.919 GiB less. I'm going to guess that the
> sdb1 partition was reduced without first shrinking the file system.
> The most common way this happens is not realizing that each member
> device of a btrfs file system must be separately shrunk. If you do not
> specify a devid, then devid 1 is assumed.
>
> man btrfs filesystem
> "The devid can be found in the output of btrfs filesystem show and
> defaults to 1 if not specified."
>
> I bet that the file system was shunk one time, this shrunk only devid
> 1 which is also /dev/sda1. But then both partitions were shrunk
> thereby truncating sdb1, resulting in these errors.
>
> If that's correct, you need to change the sdb1 partition back to its
> original size (matching the size of the sdb1 btrfs superblock). Scrub
> the file system so sdb1 can be repaired from any prior damage from the
> mistake. Shrink this devid to match the size of the other devid, and
> then change the partition.
>
>
>
>> Gerät      Boot    Anfang      Ende  Sektoren  Größe Kn Typ
>> /dev/sda1  *         2048 496093750 496091703 236,6G 83 Linux
>>
>> thomas@pc1-desktop:~
>> $ sudo btrfs insp dump-s /dev/sda1 | grep dev_item.total_bytes
>> dev_item.total_bytes    253998948352
> This is fine. The file system is 3584 bytes less than the partition.
> I'm not sure why it doesn't end on a 4KiB block boundary or why
> there's a gap before the start of sda2...but at least it's benign.
>
>


  parent reply	other threads:[~2021-04-02 20:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  7:47 BTRFS error (device sda1): bdev /dev/sdb1 errs: wr 2702175, rd 2719033, flush 0, corrupt 6, gen 0 Thomas
2021-03-13  6:59 ` Chris Murphy
2021-03-13  7:21 ` Wang Yugui
2021-03-13 12:21   ` Thomas
2021-03-13 18:02     ` Chris Murphy
2021-03-20  9:53       ` Thomas Schneider
2021-04-02 20:46       ` Thomas [this message]
2021-04-03 17:28         ` Lukas Straub

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=57292e4b-549d-9ce1-7967-32e6820c80e5@gmail.com \
    --to=74cmonty@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    /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).