• 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. Linux Network File System (NFS) interview questions
  2. “resize2fs: Permission denied to resize filesystem” error while online resize of a filesystem
  3. pinky Command Examples in Linux
  4. Shell/Bash Script to Find Prime Numbers in Linux
  5. Linux OS Service ‘microcode_ctl’
  6. lvextend command examples in Linux
  7. How To Setup UDEV Rules For RAC OCR And Voting Devices on Partitions
  8. How to Use Udev Rules to Create oracleasm Disks in CentOS/RHEL 8
  9. Linux / UNIX : How to create primary partition using fdisk
  10. How to gzip all or specific files in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright