为什么 btrfs /home/ 分区在登录时不断挂载 ro?

为什么 btrfs /home/ 分区在登录时不断挂载 ro?

/home我在安装/dev/sdb1btrfs 分区时遇到问题。ro即使我从 U 盘启动、运行检查并确认可以安装它,它仍然会继续安装rw。为什么ro在我的“真实”系统上启动时它仍然会安装?我的 fstab 行看起来像

UUID=ba093e47-a5d2-4753-b39e-64413066d9c8 /home                   btrfs   defaults,subvol=/ 0 2

dmesg向我展示:

[   36.655791] BTRFS: error (device sdb1: state A) in __btrfs_free_extent:3053: errno=-117 Filesystem corrupted
[   36.655795] BTRFS info (device sdb1: state EA): forced readonly
[   36.655796] BTRFS error (device sdb1: state EA): failed to run delayed ref for logical 574194106368 num_bytes 16384 type 176 action 2 ref_mod 1: -117
[   36.655799] BTRFS: error (device sdb1: state EA) in btrfs_run_delayed_refs:2127: errno=-117 Filesystem corrupted
[   50.043538] BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
[   50.043553] BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 992, gen 0
[   50.058816] BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
[   50.058828] BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 993, gen 0
[   50.059196] BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
[   50.059199] BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 994, gen 0

我在跑Fedora 38

更新

在实时系统 ( Fedora 36) 上我运行btrfs check /dev/sdb1并得到:

$ sudo btrfs check /dev/sdb1
Opening filesystem to check...
Checking filesystem on /dev/sdb1
UUID: ba093e47-a5d2-4753-b39e-64413066d9c8
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 890685730816 bytes used, no error found
total csum bytes: 865299716
total tree bytes: 3958702080
total fs tree bytes: 2745729024
total extent tree bytes: 193478656
btree space waste bytes: 706285981
file data blocks allocated: 2916973436928
 referenced 946788216832
# smartctl -a /dev/sdb1
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-5.17.5-300.fc36.x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Samsung based SSDs
Device Model:     Samsung SSD 860 EVO 1TB
Serial Number:    S599NE0M906370Y
LU WWN Device Id: 5 002538 e0990fd94
Firmware Version: RVT03B6Q
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Wed Aug  9 23:29:31 2023 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x53) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    (  85) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       7874
 12 Power_Cycle_Count       0x0032   096   096   000    Old_age   Always       -       3676
177 Wear_Leveling_Count     0x0013   097   097   000    Pre-fail  Always       -       39
179 Used_Rsvd_Blk_Cnt_Tot   0x0013   100   100   010    Pre-fail  Always       -       0
181 Program_Fail_Cnt_Total  0x0032   100   100   010    Old_age   Always       -       0
182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0013   100   100   010    Pre-fail  Always       -       0
187 Uncorrectable_Error_Cnt 0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   071   049   000    Old_age   Always       -       29
195 ECC_Error_Rate          0x001a   200   200   000    Old_age   Always       -       0
199 CRC_Error_Count         0x003e   100   100   000    Old_age   Always       -       0
235 POR_Recovery_Count      0x0012   099   099   000    Old_age   Always       -       199
241 Total_LBAs_Written      0x0032   099   099   000    Old_age   Always       -       82270594760

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
  256        0    65535  Read_scanning was never started
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

更新2

btrfs我从实时系统(实际上是我系统的根分区)对我的其他分区进行了检查,这就是我得到的结果:

# btrfs check /dev/sda3
Opening filesystem to check...
Checking filesystem on /dev/sda3
UUID: c8ff2d36-e51d-410e-b4f5-64b0b0f4a331
[1/7] checking root items
[2/7] checking extents
data backref 2606956544 root 257 owner 607657 offset 0 num_refs 0 not found in extent tree
incorrect local backref count on 2606956544 root 257 owner 607657 offset 0 found 1 wanted 0 back 0x560968e1b9e0
incorrect local backref count on 2606956544 root 257 owner 615849 offset 0 found 0 wanted 1 back 0x560968134cf0
backref disk bytenr does not match extent record, bytenr=2606956544, ref bytenr=0
backpointer mismatch on [2606956544 8192]
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 29946847232 bytes used, error(s) found
total csum bytes: 27541272
total tree bytes: 1149894656
total fs tree bytes: 1045790720
total extent tree bytes: 65536000
btree space waste bytes: 236775382
file data blocks allocated: 42231439360
 referenced 61500862464

由于某种原因,该分区似乎存在问题,可能导致/dev/sdb1无法正确安装?很奇怪但是...

# smartctl -a /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-5.17.5-300.fc36.x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Samsung based SSDs
Device Model:     Samsung SSD 860 EVO 1TB
Serial Number:    S5B3NR0NB18446P
LU WWN Device Id: 5 002538 e30b15691
Firmware Version: RVT04B6Q
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        In smartctl database 7.3/5319
ATA Version is:   ACS-4 T13/BSR INCITS 529 revision 5
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Wed Aug  9 23:42:26 2023 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (    0) seconds.
Offline data collection
capabilities:            (0x53) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    (  85) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       5877
 12 Power_Cycle_Count       0x0032   097   097   000    Old_age   Always       -       2778
177 Wear_Leveling_Count     0x0013   099   099   000    Pre-fail  Always       -       11
179 Used_Rsvd_Blk_Cnt_Tot   0x0013   100   100   010    Pre-fail  Always       -       0
181 Program_Fail_Cnt_Total  0x0032   100   100   010    Old_age   Always       -       0
182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0013   100   100   010    Pre-fail  Always       -       0
187 Uncorrectable_Error_Cnt 0x0032   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0032   072   051   000    Old_age   Always       -       28
195 ECC_Error_Rate          0x001a   200   200   000    Old_age   Always       -       0
199 CRC_Error_Count         0x003e   100   100   000    Old_age   Always       -       0
235 POR_Recovery_Count      0x0012   099   099   000    Old_age   Always       -       211
241 Total_LBAs_Written      0x0032   099   099   000    Old_age   Always       -       17129640751

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

我打电话吗btrfs check --repair /dev/sda

更新3

运行上述命令后,我的错误似乎已修复:

# btrfs check /dev/sda3
Opening filesystem to check...
Checking filesystem on /dev/sda3
UUID: c8ff2d36-e51d-410e-b4f5-64b0b0f4a331
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 29946847232 bytes used, no error found
total csum bytes: 27541272
total tree bytes: 1149894656
total fs tree bytes: 1045790720
total extent tree bytes: 65536000
btree space waste bytes: 236775382
file data blocks allocated: 42231439360
 referenced 61500862464

当启动我的系统时,我的 /home partiution finally got mountedrw` 再次出现,耶!这是一个奇怪的问题,我想知道会发生什么......

哎哟,启动系统后一分钟,我的分区ro再次进入模式:

$ mount | grep home
/dev/sdb1 on /home type btrfs (ro,relatime,seclabel,ssd,discard=async,space_cache,subvolid=5,subvol=/)

我再次从实时 USB 启动,现在看来两个分区都正常:

# btrfs check /dev/sdb1
Opening filesystem to check...
Checking filesystem on /dev/sdb1
UUID: ba093e47-a5d2-4753-b39e-64413066d9c8
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 890685755392 bytes used, no error found
total csum bytes: 865299740
total tree bytes: 3958702080
total fs tree bytes: 2745729024
total extent tree bytes: 193478656
btree space waste bytes: 706284856
file data blocks allocated: 2916973461504
 referenced 946788241408
[root@localhost-live liveuser]# btrfs check /dev/sda3
Opening filesystem to check...
Checking filesystem on /dev/sda3
UUID: c8ff2d36-e51d-410e-b4f5-64b0b0f4a331
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 29930229760 bytes used, no error found
total csum bytes: 27525076
total tree bytes: 1149861888
total fs tree bytes: 1045872640
total extent tree bytes: 65437696
btree space waste bytes: 236752423
file data blocks allocated: 41929781248
 referenced 61485907968

看起来,当我在登录屏幕上时,我的主分区已安装rw,并且仅在登录 Plasma 期间,它才会安装ro。当我跑步时,$ journalctl | grep -i btrfs我收到很多消息,包括:

Aug 09 21:50:14 DesktopRon kernel: RIP: 0010:__btrfs_free_extent+0xb26/0x11a0
Aug 09 21:50:14 DesktopRon kernel:  ? __btrfs_free_extent+0xb26/0x11a0
Aug 09 21:50:14 DesktopRon kernel:  ? __btrfs_free_extent+0xb26/0x11a0
Aug 09 21:50:14 DesktopRon kernel:  ? __btrfs_free_extent+0xb26/0x11a0
Aug 09 21:50:14 DesktopRon kernel:  ? __btrfs_free_extent+0xb26/0x11a0
Aug 09 21:50:14 DesktopRon kernel:  __btrfs_run_delayed_refs+0x7a2/0x11d0
Aug 09 21:50:14 DesktopRon kernel:  btrfs_run_delayed_refs+0x59/0x200
Aug 09 21:50:14 DesktopRon kernel:  ? btrfs_reduce_alloc_profile+0x8c/0x180
Aug 09 21:50:14 DesktopRon kernel:  btrfs_preempt_reclaim_metadata_space+0x97/0x1c0
Aug 09 21:50:14 DesktopRon kernel: BTRFS: error (device sdb1: state A) in __btrfs_free_extent:3053: errno=-117 Filesystem corrupted
Aug 09 21:50:14 DesktopRon kernel: BTRFS info (device sdb1: state EA): forced readonly
Aug 09 21:50:14 DesktopRon kernel: BTRFS error (device sdb1: state EA): failed to run delayed ref for logical 574194106368 num_bytes 16384 type 176 action 2 ref_mod 1: -117
Aug 09 21:50:14 DesktopRon kernel: BTRFS: error (device sdb1: state EA) in btrfs_run_delayed_refs:2127: errno=-117 Filesystem corrupted
Aug 09 21:50:19 DesktopRon abrt-notification[3148]: System encountered a non-fatal error in __btrfs_free_extent()
Aug 09 21:50:20 DesktopRon kernel: BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
Aug 09 21:50:20 DesktopRon kernel: BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 992, gen 0
Aug 09 21:50:20 DesktopRon kernel: BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
Aug 09 21:50:20 DesktopRon kernel: BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 993, gen 0
Aug 09 21:50:20 DesktopRon kernel: BTRFS warning (device sdb1: state EA): csum failed root 1936 ino 7242 off 1142784 csum 0xa13863de expected csum 0xa13843de mirror 1
Aug 09 21:50:20 DesktopRon kernel: BTRFS error (device sdb1: state EA): bdev /dev/sdb1 errs: wr 0, rd 0, flush 0, corrupt 994, gen 0

如何让分区在启动时再次装入rw模式?

答案1

btrfs check /dev/sdb1建议揭露根本原因。在未挂载的文件系统上

答案2

好吧,我想我已经弄清楚我的问题是由syncthing我的预感引起的,我手中没有任何合乎逻辑的东西可以明显地指出我的方向。我仍然想知道问题的详细原因是什么 - 如果有人可以帮助我,那就太好了!

结果禁用syncthing只能让它变得更好,但没有解决问题,即这仍然没有解决!

相关内容