RAID1 中的 BTRFS 显示磁盘空间增加了一倍

RAID1 中的 BTRFS 显示磁盘空间增加了一倍

我的所有 GUI 程序都开始显示总空间为 16TB,可用空间为 8TB,而实际应该是总空间为 8TB,可用空间为 4TB。有什么想法出错了,如何修复?

我的btrfsRAID 1 配置开始显示两倍的磁盘空间和可用空间,就好像我的配置更改为 RAID0 一样,但事实并非如此。

我有两个相同的 8TB 磁盘,最近升级到5.3.0-46-generic #38~18.04.1-Ubuntu

我的 /etc/fstab 条目如下所示,其中 UUID 是 /dev/sda 和 /dev/sdb 的 blkid UUID:

UUID=1b962b21-3130-498b-9543-e84c90f12fdf /mountpoint btrfs defaults 0 0

$ sudo btrfs fi df /mountpoint (这似乎没问题)

Data, RAID1: total=6.43TiB, used=3.58TiB 
Data, single: total=1.00GiB, used=0.00B 
System, RAID1: total=64.00MiB, used=1.12MiB 
Metadata, RAID1: total=9.03GiB, used=5.19GiB 
GlobalReserve, single: total=512.00MiB, used=0.00B

$ sudo btrfs fi 使用/挂载点

Overall:
    Device size:          14.55TiB
    Device allocated:         12.89TiB
    Device unallocated:        1.66TiB
    Device missing:          0.00B
    Used:              7.17TiB
    Free (estimated):          3.69TiB  (min: 3.69TiB)
    Data ratio:               2.00
    Metadata ratio:           2.00
    Global reserve:      512.00MiB  (used: 0.00B)

Data,single: Size:1.00GiB, Used:0.00B
   /dev/sdb    1.00GiB

Data,RAID1: Size:6.43TiB, Used:3.58TiB
   /dev/sda    6.43TiB
   /dev/sdb    6.43TiB

Metadata,RAID1: Size:9.03GiB, Used:5.19GiB
   /dev/sda    9.03GiB
   /dev/sdb    9.03GiB

System,RAID1: Size:64.00MiB, Used:1.12MiB
   /dev/sda   64.00MiB
   /dev/sdb   64.00MiB

Unallocated:
   /dev/sda  852.97GiB
   /dev/sdb  851.97GiB

$ sudo btrfs device stats两台设备均未显示任何错误,我刚刚完成全面清理,但问题并未解决。所有文件均可访问,似乎没有损坏。

当我进入 Nautilus 时,选择卷上的所有文件并右键单击属性,内容:总计显示正确的数字,与$ du -h /mountpoint

更新

输出$ blkid /dev/sda

/dev/sda: LABEL="B1" UUID="1b962b21-3130-498b-9543-e84c90f12fce" UUID_SUB="58408830-2442-416f-8e6a-e55bfb430764" TYPE="btrfs" PTTYPE="dos"

输出$ blkid /dev/sdb

/dev/sdb: LABEL="B1" UUID="1b962b21-3130-498b-9543-e84c90f12fce" UUID_SUB="65bd227f-d2c2-4b5b-a73b-a540989c7d41" TYPE="btrfs"

输出/etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=d65dd525-0111-4c6e-a865-b9a912e59e51 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=D7F2-12D3  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

# mount BTRFS 2 x 8TB RAID1 
UUID=1b962b21-3130-498b-9543-e84c90f12fce /media/user/B1 btrfs defaults 0 0

# mount old test disks
/dev/disk/by-uuid/1b40a350-7573-4f29-aef6-8be2f34cd111 /mnt/1b40a350-7573-4f29-aef6-8be2f34cd111 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=TEST2 0 0
/dev/disk/by-uuid/56effa28-df91-4b70-b73e-7665856e829e /mnt/56effa28-df91-4b70-b73e-7665856e829e auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=TEST1 0 0

关于 UUID,几年前我使用以下命令格式化了两个磁盘: $ sudo mkfs.btrfs -m raid1 -d raid1 /dev/sda /dev/sdb

输出为$sudo btrfs fi show

Label: 'B1'  uuid: 1b962b21-3130-498b-9543-e84c90f12fce
    Total devices 2 FS bytes used 3.59TiB
    devid    1 size 7.28TiB used 6.44TiB path /dev/sda
    devid    2 size 7.28TiB used 6.45TiB path /dev/sdb

所以我不知道为什么,但它们具有相同的 uuid。

答案1

根据https://btrfs.wiki.kernel.org/index.php/Balance_Filters并感谢对我的问题的评论,btrfs balance功能是正确的答案。

$sudo btrfs balance start -v -dusage=0 /mountpoint解决了我的问题。

输出:

Dumping filters: flags 0x1, state 0x0, force is off
  DATA (flags 0x2): balancing, usage=0
Done, had to relocate 1 out of 6603 chunks

此后,可用空间再次正确显示。

相关内容