Btrfsでdfで空き容量があるように見えるのに容量が無いと言われてreadonlyにされてしまう

最近Btrfsで利用中にroにされてしまうという症状が起きます.
こんな感じで怒られてroになる.
dfは87%とかで未だ空きはあるように見える.
/に使ってるとこでremount,rwも効かず再起動しないと戻せず辛い.

[ 2196.878532] BTRFS: error (device dm-1) in btrfs_truncate_inode_items:4647: errno=-28 No space left
[ 2196.878537] BTRFS info (device dm-1): forced readonly
[ 2196.881248] BTRFS error (device dm-1): pending csums is 1241088

FAQだったようでここを参照しながら

別のsystemで確認してbtrfs fi balance start -dusage=5を叩いてみました.

$ sudo btrfs fi show
Label: none uuid: e54de82f-1fdb-4f9a-b529-0952b0ea3454
        Total devices 1 FS bytes used 465.89GiB
        devid 1 size 542.28GiB used 542.28GiB path /dev/mapper/x220--vg-root

$ sudo mount -o ro /dev/mapper/x220--vg-root /mnt
$ sudo btrfs fi df /mnt
Data, single: total=538.27GiB, used=462.41GiB
System, single: total=4.00MiB, used=80.00KiB
Metadata, single: total=4.01GiB, used=3.48GiB
GlobalReserve, single: total=512.00MiB, used=0.00B
$ sudo btrfs fi balance start -dusage=5 /mnt
ERROR: error during balancing '/mnt': Read-only file system
There may be more info in syslog - try dmesg | tail
$ sudo mount -o remount,rw /mnt
$ sudo btrfs fi balance start -dusage=5 /mnt
Done, had to relocate 0 out of 546 chunks

しかしあまり変わらず暫く利用しているとまたエラーに.しかし今度はdisk fullと怒られるけどroにはならなかったです.以下のページによると,

This means the bigger the -dusage value, the more work balance will have to do (i.e. taking fuller and fuller blocks and trying to free them up by putting their data elsewhere). Also, if your FS is 55% full, using -dusage=55 is ok, but there isn’t a 1 to 1 correlation and you’ll likely be ok with a smaller dusage number, so start small and ramp up as needed.

ということで-dusage=90にしてみると結構空いた感じです.
上の方では別systemで起動して実行しましたが,オンラインでも大丈夫でした.但し処理中はかなり重くなります.そして処理に200分程かかりました.

$ sudo btrfs fi balance start -dusage=90 /
Done, had to relocate 186 out of 530 chunks
$ sudo btrfs fi show
Label: none  uuid: e54de82f-1fdb-4f9a-b529-0952b0ea3454
        Total devices 1 FS bytes used 446.08GiB
        devid    1 size 542.28GiB used 449.27GiB path /dev/mapper/x220--vg-root

この後数GBのデータを書いてみたり溜まっていたapt upgradeとかしてみましたが今のところ大丈夫そうです.
ちなみにこのfsがあるSSD(INTEL SSDSA2CW600G3)も長く使っているのでそっちも心配だったのですが,smartctl-t longしたり-aの以下のあたり見る感じでは未だ行けそう?

9 Power_On_Hours 0x0032 100 100 000 Old_age Always – 36565
228 Workload_Minutes 0x0032 100 100 000 Old_age Always – 2193912
232 Available_Reservd_Space 0x0033 100 100 010 Pre-fail Always – 0
233 Media_Wearout_Indicator 0x0032 095 095 000 Old_age Always – 0

#適当なとこでsecure eraseしておきたい…….

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です