This commit is contained in:
2025-07-06 16:25:50 +08:00
parent 100a9c61f0
commit 92f685d3d2

45
content/blog/btrfs-fix.md Normal file
View File

@@ -0,0 +1,45 @@
---
title: 'Btrfs Fix'
date: 2025-07-06T13:12:10+08:00
draft: true
summary: some summary
---
```
sudo btrfs scrub start /
sudo btrfs scrub status /
```
```
sudo dmesg | grep BTRFS | bat
```
确定块大小
```
sudo btrfs inspect-internal dump-super /dev/mapper/root1 | grep -i sector
```
定位到 2537392 扇区错误,在服务器上的是:
```
3420: 124352.. 124384: 2537365.. 2537397: 33: 43046457: shared
```
在备份中的是:
```
3321: 124352.. 124384: 5818956505..5818956537: 33: 5789786767:
```
在服务器上,我们取 logical 10393157632 和它前面一个扇区处的数据 10393153536
```
sudo btrfs-map-logical -l 10393157632 -b 40960 /dev/mapper/root1
```
得到物理偏移后,把数据 dd 出来:
```
sudo dd if=/dev/mapper/root1 bs=4096 skip=$((10393157632/4096)) count=1 of=/dev/shm/b1
```