• 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 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. lvmdiskscan Command Examples in Linux
  2. How to use the “screen” command in Linux
  3. arch-chroot Command Examples in Linux
  4. lcov: command not found
  5. cryptsetup Command Examples in Linux
  6. useradd: command not found
  7. pacman –remove Command Examples in Linux
  8. How to mount and umount a file system in Linux
  9. dpkg-reconfigure Command Options
  10. How to configure interface in “Promiscuous Mode” in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright