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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. ln Command Examples in Linux
  2. How to find the inode size of an ext2/ext3/ext4 filesystem?
  3. lastlog Command Examples in Linux
  4. Understanding /etc/group file
  5. CentOS / RHEL 7 : How to Change the machine-id
  6. Search XML Attributes PowerShell XPath
  7. “yum history” command examples to display, rollback, redo, undo yum transactions
  8. IBM DB2 Installation on Red Hat Enterprise Linux
  9. How to Remove a Dead Mulitpath Device without Reboot in CentOS/RHEL
  10. Determining disk usage in Linux using “du” command

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright