Btrfs 関連ツールの実行例

Btrfs 関連ツールの実行例をメモ。Btrfs の公式 Wiki よりそのまま引用。

  • mkfs.btrfs: create a filesystem
  • btrfsctl: control program to create snapshots and subvolumes and scan devices
    • Scan all devices looking for btrfs filesystems, or scan just one partition
      • btrfsctl -a
      • btrfsctl -A /dev/sda2
  • Snapshots and subvolumes
    • mount -t btrfs /dev/sda2 /mnt/btrfs
    • btrfsctl -S new_subvol_name /mnt/btrfs
    • btrfsctl -s /mnt/btrfs/snapshot_of_root /mnt/btrfs
      • mount -t btrfs -o subvol=new_subvol /dev/sda2 /mnt/new_subvol
      • mount -t btrfs -o subvol=snapshot_of_root /dev/sda2 /mnt/snap
  • btrfsck: do a limited check of the FS extent trees.
  • btrfs-debug-tree: print all of the FS metadata in text form
    • btrfs-debug-tree /dev/sda2 >& big_output_file
  • If a problem occures you can create an image of the fs with btrfs-image and send it to the devs. (All data will be zeroed, but metadata and the like is preserved.)
    • btrfs-image -c 9 /dev/sda2 /tmp/btrfs_dump.z

https://btrfs.wiki.kernel.org/index.php/Getting_started#Basic_Filesystem_Commands より。