第一にスーパーブロックが壊れている場合です。スーパーブロックとは、mountしようとしたストレージがBtrfsに属していることを示すと共に、各種管理情報を保持しているメタデータです。このデータにはバックアップされていますので、スーパーブロックが壊れている場合は次のコマンドによって復元できます。 # btrfs rescue super-recover /dev/sdb2 ERROR: the device is busy 0475login:Penguin2021/12/17(金) 18:23:19.92ID:WDpFyAGb 第二にroot treeが壊れている場合です。root treeとは、どの場所にどんなデータ/メタデータが配置されているかを管理するメタデータです。壊れたroot treeを復元するには次のようにします。
# mount -o usebackuproot /dev/sdb2 /mnt << 行末はマウントポイントを指定ということか?
$ lsblk
sdb 8:16 0 149.1G 0 disk ├─sdb1 8:17 0 260M 0 part ├─sdb2 8:18 0 146.9G 0 part /media/jin/debian └─sdb3 8:19 0 2G 0 part
# mount -o usebackuproot /dev/sdb2 /media/jin/debian
# mount -o usebackuproot /dev/sdb2 /media/jin/debian mount: /media/jin/debian: wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error. # んんん〜? 0476login:Penguin2021/12/17(金) 18:31:24.82ID:WDpFyAGb ファイルシステムの復元(最終手段) # btrfs check --repair /dev/sdb2 このコマンドは矛盾のあるデータは容赦無く削除するなどして無理矢理にでもmountできるようにするためのものであり、かつ、必ずしも成功するとは限りません。このため、他に打つ手がまったく無くなったときの最後の手段として使用してください
# btrfs check --repair /dev/sdb2 enabling repair mode WARNING: Do not use --repair unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no fsck can successfully repair all types of filesystem corruption. Eg. some software or hardware bugs can fatally damage a volume. The operation will start in 10 seconds. Use Ctrl-C to stop it. 10 9 8 7 6 5 4 3 2 1 Starting repair. Opening filesystem to check... ERROR: /dev/sdb2 is currently mounted, use --force if you really intend to check the filesystem # << マウントしてない状態でやるのか 0477login:Penguin2021/12/17(金) 18:31:28.34ID:WDpFyAGb # btrfs check --repair /dev/sdb2 enabling repair mode WARNING:
Do not use --repair unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no fsck can successfully repair all types of filesystem corruption. Eg. some software or hardware bugs can fatally damage a volume. The operation will start in 10 seconds. Use Ctrl-C to stop it. 10 9 8 7 6 5 4 3 2 1 Starting repair. Opening filesystem to check... Checking filesystem on /dev/sdb2 UUID: 3a396f2a-5ad7-47af-9bbd-343195f050f2 [1/7] checking root items parent transid verify failed on 579682304 wanted 1415 found 1372 parent transid verify failed on 579682304 wanted 1415 found 1372 parent transid verify failed on 579682304 wanted 1415 found 1372 Ignoring transid failure ERROR: child eb corrupted: parent bytenr=578355200 item=136 parent level=1 child bytenr=579682304 child level=1 ERROR: failed to repair root items: Input/output error # 0478login:Penguin2021/12/17(金) 18:36:00.69ID:WDpFyAGb 警告 開発者からアドバイスがない限り、--repair は使用しないでください。 ということを理解した上で、そのうえで行ってください。 fsck はあらゆる種類のファイルシステムの破損を正常に修復することができます。例えば いくつかのソフトウェアやハードウェアのバグは、ボリュームに致命的な損傷を与える可能性があります。
[1/7] ルートアイテムのチェック parent transid verify failed on 579682304 wanted 1415 found 1372 parent transid verify failed on 579682304 wanted 1415 found 1372 parent transid verify failed on 579682304 wanted 1415 found 1372 トランシッドの失敗を無視する ERROR: 子ebが破損: 親 bytenr=578355200 item=136 親レベル=1 子 bytenr=579682304 子レベル=1 ERROR: ルートアイテムの修復に失敗しました。入出力エラー #
<<以上機械翻訳
# btrfs rescue super-recover /dev/sdb2
ERROR: the device is busy <<先に実行したコマンドでこの意味がわからなかったが、
We are going to rebuild the chunk tree on disk, it might destroy the old metadata on the disk, Are you sure? [y/N]: y Chunk tree recovery aborted # おわた dmesg どうなった?
# dmesg | tail [11570.040916] usb 6-3: Product: WN-G300UA [11570.040920] usb 6-3: Manufacturer: I-O DATA DEVICE, INC. [11570.040923] usb 6-3: SerialNumber: 00e04c000001 [11570.857132] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [11570.884652] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [11571.107981] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [11571.163660] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [11572.726292] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [14120.958897] sysctl (11524): drop_caches: 3 [14143.358555] Adding 2097148k swap on /dev/sda3. Priority:-2 extents:1 across:2097148k FS #
>Be prepared 準備して Rule zero is of course to have backups. もちろん、ルールゼロはバックアップをとることです。 This will allow us to sleep well at night and handle a bad drive situation with a much cooler head. これにより、私たちは夜よく眠り、はるかに涼しい頭で悪いドライブ状況に対処することができます。 I can’t stress this enough: have at least three copies in two different locations. これを十分に強調することはできません。2つの異なる場所に少なくとも3つのコピーがあります。 Everything will be easier and less stressful when a drive fails, which will happen. ドライブに障害が発生した場合、すべてが簡単になり、ストレスが軽減されます。
<< sdb の中にあるスナップショットはバックアップになんないのか?
また、このsda中のスナップショットでは、ファイルシステムを復元できないのか1 0484login:Penguin2021/12/17(金) 22:19:55.07ID:WDpFyAGb Then, rule number one is to monitor your hard drive’s health. 次に、ルール1は、ハードドライブの状態を監視することです。 This is also critical because normally you will get the warning at least 24 or 48 hours before total failure so you have a good chance of getting your data out of there before it is too late. 通常、完全な障害が発生する少なくとも24時間または48時間前に警告が表示されるため、手遅れになる前にデータを取得できる可能性が高いため、これも重要です。
Hard drives don’t completely fail from one day to the other but we need to pay attention to them. ハードドライブは、ある日から別の日に完全に故障するわけではありません