How to make a btrfs snapshot?

Posted by MountainX on Ask Ubuntu See other posts from Ask Ubuntu or by MountainX
Published on 2012-04-21T22:52:25Z Indexed on 2012/06/11 16:48 UTC
Read the original article Hit count: 305

Filed under:
|

My /home partition consists of an entire physical disk. It is formatted as btrfs. I want to snapshot it. I'm confused regarding subvolume naming, in particular.

I am aware that there are similar questions, but each similar question seems to be asking something different from what I'm asking (and they are older, which means probably outdated, given the rapid development of btrfs). For example, the answer to this question is apparently not the answer to my question because my /home partition is a separate volume and the man page for btrfs shows a different command for creating snapshots now.

another similar problem, no solid solution.
someone else as confused as me on the naming issues

My question:

Starting simple: is this the correct command to take a simple snapshot of my home partition?

btrfs subvolume snapshot /home/@home /home/@home_snapshot_20120421

I got really brave and tested it and it does not work. The error is error accessing /home/@home. As shown below, @home is listed.

I'm obviously confused on subvolume names. Do I need to use them in creating snapshots? Some examples show taking snapshots of home using /home as the source parameter, but based on examples of root volumes, it seems to me that I need to use /home/@home.

Would this command work? And if not, why?

btrfs subvolume snapshot /home /home/@home_snapshot_20120421

Is the @ just a naming convention? Is it meaningful at all?

Here's some output that may be relevant:

btrfs subvolume list /home
ID 256 top level 5 path @home

I'm not sure what that means, exactly. When I try btrfs device scan it gives an error (e.g. unable to scan the device /dev/sda1). My file system doesn't have any errors. Everything is fine.

© Ask Ubuntu or respective owner

Related posts about backup

Related posts about btrfs