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 <74cmo...@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.
>
>

Reply via email to