• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Replace a Failed Btrfs Device

by admin

The Problem

Originally the btrfs file system is build on multiple disks.

# btrfs filesystem show
Label: 'MYBTRFS' uuid: 09138ad8-eb2f-4c7c-aef7-90482a67c45c
Total devices 3 FS bytes used 768.00KiB
devid 1 size 5.00GiB used 1.52GiB path /dev/xvdb
devid 2 size 5.00GiB used 520.00MiB path /dev/xvdc
devid 3 size 5.00GiB used 1.51GiB path /dev/xvdd

For some reason one disk is faulty and needs to be replaced.

# btrfs filesystem show
Label: 'MYBTRFS' uuid: 09138ad8-eb2f-4c7c-aef7-90482a67c45c
Total devices 3 FS bytes used 768.00KiB
devid 1 size 5.00GiB used 1.52GiB path /dev/xvdb
devid 3 size 5.00GiB used 1.51GiB path /dev/xvdd
*** Some devices missing

The Solution

1. Mount the btrfs with “-o degraded” option from existing good volume:

# mount -o degraded /dev/xvdd /mnt/btrfs

2. Replace the absent disk with the missing one:

# btrfs replace start 2 /dev/xvdc /mnt/btrfs

3. Balance the file system:

# btrfs filesystem balance

If any error, please check the output of “dmesg”. You may also need to contact your support team if there are errors in dmesg.

Filed Under: Linux

Some more articles you might also be interested in …

  1. UNIX / Linux : How to install and configure mutt
  2. date: command not found
  3. module: command not found
  4. swaks: command not found
  5. extrace Command Examples in Linux
  6. grub-script-check: command not found
  7. cryfs: A cryptographic filesystem for the cloud
  8. sreport Command Examples in Linux
  9. “aws workmail” Command Examples
  10. unshadow: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright