This discussion is archived
6 Replies Latest reply: Sep 14, 2012 9:07 AM by Dude! RSS

btrfs filesystem layout recommendations

jwmitchell Newbie
Currently Being Moderated
Does Oracle have any recommendations on laying out a btrfs filesystem? For instance, another distro supporting btrfs recommended something like creating an "__active" and "__snapshot" subvolumes under the btrfs root. Then creating the / filesystem under __active and snapshots under __snapshot. Seems like a good idea to keep things clean and separate. But are there any Oracle recommendations? When the UEK2/btrfs IOS is released, how will it build the btrfs filesystem? From those who may have experience with btfs, what are your thoughts?
  • 1. Re: btrfs filesystem layout recommendations
    Dude! Guru
    Currently Being Moderated
    Are you referring to: https://wiki.archlinux.org/index.php/Installing_on_Btrfs_root ?

    Putting root (/) in a btrfs subvolume is a good idea as this is apparently necessary to create a snapshot.

    Regarding your other thread about btrfs... I'm currently doing some more testing and will do some update on my howto. I did not reply further because I did not have any luck starting from a system were /var is a btrfs subvolume. Perhaps there is something wrong with the driver or there is some other boot parameter or trick required.

    But having root as subvolume works fine. When creating a subvolume for root, it will be necessary to change the boot parameter to include, e.g. root="/dev/sda3 rootflags=subvol=__active".

    To create a snapshot after the system has started with subvol=__active, e.g.

    mkdir /mnt/root
    mount /dev/sda3 /mnt/root
    btrfs subvolume snapshot /mnt/root/__active /mnt/root/__snapshot/13-SEP-2012

    or

    btrfs subvolume snapshot / /snapshot-13-SEP-2012


    # btrfs subvolume list /
    ID 256 top level 5 path __active
    ID 257 top level 5 path __snapshot/test
    ID 258 top level 5 path __active/before-updating-2011-05-24


    I think Avi Miller can give some advices about BtrFS. I found his Btrfs tour on youtube.

    Edited by: Dude on Sep 13, 2012 2:25 PM
  • 2. Re: btrfs filesystem layout recommendations
    Avi Miller Guru
    Currently Being Moderated
    jwmitchell wrote:
    But are there any Oracle recommendations? When the UEK2/btrfs IOS is released, how will it build the btrfs filesystem? From those who may have experience with btfs, what are your thoughts?
    We recommending using a subvolume for root and our new UEK ISO automatically creates a subvolume for root during the install process. We don't however create the more complex layout that Arch does for example.
  • 3. Re: btrfs filesystem layout recommendations
    Dude! Guru
    Currently Being Moderated
    Sorry to interfere, I hope it's ok. I noticed that one actually does not need an explicit subvolume to create a snapshot:

    # btrfs subvol list -p /

    # btrfs subvolume snapshot / /test
    Create a snapshot of '/' in '//test'

    # btrfs subvol list -p /
    ID 256 parent 5 top level 5 path test

    So apparently even without showing any existing subvolume, the "subvolume snapshot" command works.

    What is the advantage of having root in an explicit subvolume?
    Is there a particular name recommended, such as "__active", like the OP outlined?
  • 4. Re: btrfs filesystem layout recommendations
    Avi Miller Guru
    Currently Being Moderated
    Dude wrote:
    Sorry to interfere, I hope it's ok. I noticed that one actually does not need an explicit subvolume to create a snapshot:
    Correct.
    What is the advantage of having root in an explicit subvolume?
    Means you can do snapshot comparisons against the subvolume at any time, i.e. if your active / partition is a subvolume, and you snapshot it, you can see both in the snapshot/subvolume list and compare them. You can also snapshot the previous snapshot or revert back, etc.
    Is there a particular name recommended, such as "__active", like the OP outlined?
    Not really. You can chose whatever works for your own sysadmin style. Ubuntu uses a different naming convention to Arch, for example.
  • 5. Re: btrfs filesystem layout recommendations
    jwmitchell Newbie
    Currently Being Moderated
    Dude wrote:
    Are you referring to: https://wiki.archlinux.org/index.php/Installing_on_Btrfs_root ?
    Yes, but I've seen similar guidance in forums from a variety of distros.

    Regarding your other thread about btrfs... I'm currently doing some more testing and will do some update on my howto. I did not reply further because I did not have any luck starting from a system were /var is a btrfs subvolume. Perhaps there is something wrong with the driver or there is some other boot parameter or trick required.
    Thanks for continuing to look at this. I'm interested in what you find. However I've decided making /var a subvolume isn't such a great idea after all. I originally thought btrfs subvolumes worked similar to their ZFS counterparts, in other words, a snapshot of the / filesystem would propogate down through the various subvolumes. But after reading through the documents on https://btrfs.wiki.kernel.org discovered that isn't the case. This would seem to limit the value of btrfs subvolumes since I can't get a point-in-time snapshot of the entire filesystem.
  • 6. Re: btrfs filesystem layout recommendations
    Dude! Guru
    Currently Being Moderated
    Isn't BtrFS is ready for production, and if so, is there documentation?

    There are various sites with information about BtrFS, usually without any version information, and some seem obsolete using depreciated commands.

    I spent some reading at http://www.funtoo.org/wiki/BTRFS_Fun. It seems to provide a nice overview and seems fairly recent.

    Perhaps the following explains the trouble with /var subvolume you experienced at system startup:

    +... only subvolumes can be mounted in a VFS hierarchy. It is a fundamental aspect to remember: you cannot mount a sub-part of a subvolume in the VFS...+

    In addition to the information from Avi, I find the following useful:

    +... When you create a brand new BTRFS filesystem, the system not only creates the initial root subvolume (numbered 0) but also tags it as being the default subvolume...+

    And last not least, another reason to create a subvolume for root, rather than using the initial root subvolume. I might have been confusing the "root subvolume" vs. "root in a subvolume", if I understand correctly:

    It is highly advised to not use the root subvolume when deploying a new Funtoo instance or put any kind of data on it in a more general case. Rolling back a data snapshot will be much easier and much less error prone (no copy process, just a matter of 'swapping' the subvolumes).

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points