An Experiment with BTRFS

Hai friends,

Last one week fully i spent time wit BTRFS.

Btrfs is a new copy on write filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration. Initially developed by Oracle, Btrfs is licensed under the GPL and open for contribution from anyone.

Linux has a wealth of filesystems to choose from, but we are facing a number of challenges with scaling to the large storage subsystems that are becoming common in today’s data centers. Filesystems need to scale in their ability to address and manage large storage, and also in their ability to detect, repair and tolerate errors in the data stored on disk.

Btrfs is under heavy development, but every effort is being made to keep the filesystem stable and fast. As of 2.6.31, we only plan to make forward compatible disk format changes, and many users have been experimenting with Btrfs on their systems with good results. Please email the Btrfs mailing list if you have any problems or questions while using Btrfs.

Note that Btrfs does not yet have a fsck tool that can fix errors. While Btrfs is stable on a stable machine, it is currently possible to corrupt a filesystem irrecoverably if your machine crashes or loses power on disks that don’t handle flush requests correctly. This will be fixed when the fsck tool is ready.


The main Btrfs features include:

* Extent based file storage (2^64 max file size)
* Space efficient packing of small files
* Space efficient indexed directories
* Dynamic inode allocation
* Writable snapshots
* Subvolumes (separate internal filesystem roots)
* Object level mirroring and striping
* Checksums on data and metadata (multiple algorithms available)
* Compression
* Integrated multiple device support, with several raid algorithms
* Online filesystem check
* Very fast offline filesystem check
* Efficient incremental backup and FS mirroring
* Online filesystem defragmentation

Subvolumes and snapshots:

Subvolumes effectively allow a single instance of Btrfs to have multiple root directories, all using the file system as a pooled store. These roots are labeled and can be mounted separately by label. (There is always a “default” root which is mounted by default.) Subvolumes can also be nested inside other subvolumes, where they appear as subdirectories. Subvolumes are always created empty.

Snapshots are writeable copy-on-write clones of whole subvolumes; snapshotting itself is an atomic operation. Snapshots of individual subdirectories are not possible.

Create subvolume:

thasu@tha-admin-da ~ $ sudo btrfs subvolume create /home/thasu/Desktop/subvol
[sudo] password for thasu:
Create subvolume ‘/home/thasu/Desktop/subvol’

To take snapshot:

thasu@tha-admin-da ~ $ sudo btrfs subvolume snapshot /home/thasu/Desktop/subvol  /home/thasu/Desktop/snap
Create a snapshot of ‘/home/thasu/Desktop/subvol’ in ‘/home/thasu/Desktop/snap’

See the disk free:
thasu@tha-admin-da ~ $ sudo btrfs filesystem df /home/thasu/Desktop/subvol
Metadata: total=128.00MB, used=9.18MB
Data: total=6.02GB, used=4.59GB
System: total=12.00MB, used=4.00KB

See the list of volumes:
thasu@tha-admin-da ~ $ sudo btrfs subvolume list /home/thasu/Desktop/subvol
ID 256 top level 5 path thasu/Desktop/subvas
ID 257 top level 5 path thasu/Desktop/snapcopy
ID 267 top level 5 path thasu/Desktop/subvol
ID 268 top level 5 path thasu/Desktop/snap

To delete the subvolume:
thasu@tha-admin-da ~ $ sudo btrfs subvolume delete /home/thasu/Desktop/subvolu
Delete subvolume ‘/home/thasu/Desktop/subvolu’

Take the copy of snapshot:
thasu@tha-admin-da ~ $ sudo btrfs subvolume snapshot /home/thasu/Desktop/snap /home/thasu/Desktop/snap_copy
Create a snapshot of ‘/home/thasu/Desktop/snap’ in ‘/home/thasu/Desktop/snap_copy’

Recover the data:
thasu@tha-admin-da ~ $ mv /home/thasu/Desktop/snap_copy/deleted /home/thasu/Desktop/subvol

some use-full links:

Brief story of BTRFS
Ubuntu 10.10 BTRFS link
BTRFS usecases

For Help:

BTRFS mailing list

IRC on in the channel #btrfs

—Will be Continue— 😉


One thought on “An Experiment with BTRFS

  1. Good day I was fortunate to find your Topics in bing
    your post is excellent
    I obtain much in your blog really thank your very much
    btw the theme of you blog is really splendid
    where can find it

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s