Author image Nikolay Martynov
and 1 contributors

NAME

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

VERSION

Version 0.01

SYNOPSIS

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.

Example:

    use Filesys::Btrfs;

    my $btrfs = Filesys::Btrfs->new($mount_point);
    $btrfs->subvolume_create('subvolume');
    ...

Note: all methods croak if error occures.

CONSTANTS

Filesys::Btrfs::BTRFS_CMD

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

METHODS

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

Create new Filesys::Btrfs object.

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

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.

%options

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

$btrfs->btrfs_cmd();

Returns path to btrfs util being used.

$btrfs->mount_point();

Returns mount point being used.

$btrfs->version();

Returns version of btrfs util being used.

$btrfs->subvolume_list($dir);

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

$dir

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

$btrfs->subvolume_create($dir);

Create new subvolume in $dir.

$btrfs->subvolume_delete($dir);

Delete subvolume in $dir.

$btrfs->subvolume_set_default($id);

Set subvolume with $id to be mounted by default.

$btrfs->filesystem_sync();

Force a sync on filesystem.

$btrfs->filesystem_balance();

Balance the chunks across the device.

AUTHOR

Nikolay Martynov, <kolya at cpan.org>

BUGS

Please report any bugs or feature requests to bug-filesys-btrfs at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Filesys-Btrfs. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc Filesys::Btrfs

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

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 http://dev.perl.org/licenses/ for more information.