• 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 Re-Balance BTRFS to Free Disk Space

by admin

The Problem

The BTRFS filesystem has filled on the server, and thus some space needs to be freed up on it. There is a re-balancing feature available in btrfs. The primary purpose of the re-balance feature is to spread block groups across all devices so they match constraints defined by the respective profiles and this is done when btrfs need re-balancing to fix issues with chunks being unbalanced.

The Solution

It is common for a btrfs device to fill up due to the fact that it does not re-balance chunks and the filesystem becomes full due to this.

Re-balance the filesystem as shown in the example below

# mount
/dev/sdb on /var/lib/docker type btrfs (rw,relatime,seclabel,space_cache)
# df -h /var/lib/docker
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 12G 852M 9.8G 8% /var/lib/docker
# btrfs bal start /var/lib/docker
Done, had to relocate 4 out of 4 chunks

Output after re-balancing

# df -h /var/lib/docker
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 12G 851M 11G 8% /var/lib/docker

Filed Under: Linux

Some more articles you might also be interested in …

  1. manpath Command Examples in Linux
  2. cuyo: command not found
  3. cpulimit: command not found
  4. How to use “xfs_admin” command to change parameters of an XFS filesystem
  5. deluser Command Examples in Linux
  6. lspci Command Examples in Linux
  7. pw-play Command Examples in Linux
  8. debman Command Examples in Linux
  9. How to Create a New /boot Partition in CentOS / RHEL
  10. How to fix the “Firefox already running” problem on Linux

You May Also Like

Primary Sidebar

Recent Posts

  • “glab issue” Command Examples
  • “glab auth” Command Examples
  • “glab alias” Command Examples
  • gixy Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright