Cannot reduce the size of the Btrfs partition

btrfs

I need to free up 4T on my LVM which is mainly taken by a Btrfs filesystem
mounted on /data.
I did:

# btrfs fi resize -h
btrfs filesystem resize: too few arguments
usage: btrfs filesystem resize [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path>

    Resize a filesystem

    If 'max' is passed, the filesystem will occupy all available space
    on the device 'devid'.
    [kK] means KiB, which denotes 1KiB = 1024B, 1MiB = 1024KiB, etc.

so it looks I should do:

btrfs filesystem resize -4T /data

which gives an error:

Resize '/data' of '-4T'
ERROR: unable to resize '/data': Invalid argument

what am I doing wrong?

Best Answer

You seem to be running a newer version of the Btrfs tools

$ btrfs --version
Btrfs v3.12
$ btrfs filesystem resize -h
btrfs filesystem resize: too few arguments
usage: btrfs filesystem resize [devid:][+/-]<newsize>[gkm]|[devid:]max <path>

    Resize a filesystem

    If 'max' is passed, the filesystem will occupy all available space
    on the device 'devid'.

although the help has been updated (I get the same "help" message as you do in Btrfs tools v4.4), the command still only accepts kKmMgG.

You should use:

btrfs filesystem resize -4096G /data

to reduce the size by 4 terabytes.

Please note that contrary to some other tools that make a distinction between k=1000 and K=1024, for btrfs filesystem resize both lower and upper case this means multiples of 1024.

Related Question