Author image Nikolay Martynov
and 1 contributors


Filesys::Btrfs - Simple wrapper around Linux btrfs util.


Version 0.01


Simple wrapper around Linux btrfs util. Btrfs util is used to manage btrfs filesystem: manage snapshots, subvolumes and etc. Only subset of btrfs options is supported (hopefuly it is useful subset).

For more information about btrfs util please see btrfs manpage.

WARNING This module is hightly experimental (as btrfs itself). API can change in the future.


    use Filesys::Btrfs;

    my $btrfs = Filesys::Btrfs->new($mount_point);

Note: all methods croak if error occures.



Default path to look for btrfs program: /sbin/btrfs.


Filesys::Btrfs->new($mount_point, %options);

Create new Filesys::Btrfs object.

    my $btrfs = Filesys::Btrfs->new('/mnt/disk');

Mount point of btrfs filesystem. Filesystem has to be mounted before this module can be used. All methods of Filesys::Btrfs object operate with paths absolute or relative to mount point.


Additional options. Currently only one option is supported: btrfs_cmd - specifies different path to btrfs util.


Returns path to btrfs util being used.


Returns mount point being used.


Returns version of btrfs util being used.


Get list of all subvolumes. Returns hashref of (subvolume_name => id).


If $dir is specified then only subvolumes located in this directory are returned.


Create new subvolume in $dir.


Delete subvolume in $dir.


Set subvolume with $id to be mounted by default.


Force a sync on filesystem.


Balance the chunks across the device.


Nikolay Martynov, <kolya at>


Please report any bugs or feature requests to bug-filesys-btrfs at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Filesys::Btrfs

You can also look for information at:



Copyright 2011 Nikolay Martynov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.