Setup (subvolumes btrfs) and boot directly from it

  • Hi, did someone know howto setup subvolumes under btrfs and let the System boot from a subvolume?? For now, i found a solution where i have a Debian 8 with Btrfs Subvolume Snapshot Boot Environment. Here i can create subvolumes and make them bootable in grub. But this is not what i'm searching for. I would like to press the whole "/" to a subvolume and will boot from this subvolume...


    regards nightcrawler

  • @subzero79 is experienced in btrfs subvolumes and snapshots. He may be able to help you.


    Greetings
    David

    "Well... lately this forum has become support for everything except omv" [...] "And is like someone is banning Google from their browsers"


    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

    Upload Logfile via WebGUI/CLI
    #openmediavault on freenode IRC | German & English | GMT+1
    Absolutely no Support via PM!

  • The best way to do this is to install Debian 7 on a btrfs root, then install OMV via packages. Here are my install notes:


    1. Install Debian on BTRFS root
    a. Boot install media
    b. Choose Advanced Options | Graphical expert install
    c. Partition disk
    i. Choose manual partitioning
    ii. Initialize disk w/ MSDOS partition table
    iii. Create btrfs partition on /
    d. After partition table is written and before installing base system, switch to a terminal and create subvolumes:

    Code
    btrfs sub create /target/run
    btrfs sub create /target/tmp
    btrfs sub create /target/var/tmp
    btrfs sub create /target/var/spool
    btrfs sub create /target/var/log
    btrfs sub create /target/var/crash
    btrfs sub create /target/var/lib/rrdcached


    2. Complete install with only standard system utilities


    3. From a terminal, Install OpenMediaVault

    Code
    echo "deb http://packages.openmediavault.org/public kralizec main" > /etc/apt/sources.list.d/openmediavault.list
    wget -O - http://packages.openmediavault.org/public/archive.key | apt-key add -
    apt-get update
    apt-get install openmediavault postfix
    omv-initsystem


    4. Reboot


    5. From a terminal, install OMV-Extras.org

    Code
    wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all.deb
    dpkg -i openmediavault-omvextrasorg_latest_all.deb
    apt-get update


    6. Install backport kernel
    a. In OMV GUI, click System | OMV-Extras.org
    b. Click the Kernel tab
    c. Click Install Backports 3.16 kernel


    7. From a terminal, install btrfs-tools

    Code
    apt-get install -t wheezy-backports btrfs-tools


    8. Reboot


    9. Finish OMV configuration from GUI

  • Here are my install notes


    @davidh2k once enquired in the btrfs channel about formatting volumes in btrfs with an older kernel. The conclusion was not to do it, you lose features.


    So as for know, in wheezy best option would be to boot any high distro with an updated kernel and format the drive, then manually start moving files around or debootstrap (and install kernel), edit fstab for uuid and and install grub.


    What I did was to convert the volume (ext4) with systemrescuecd (kernel 3.14 if i recall) which was much more simpler that the things i mention before, but I am not clear about the cons of this procedure.



  • Hi, and with an GPT HDD? And i would like to put the whole System into a subvolume, like "/" and boot from this subvolume....
    Something like here but without encrypction:


    http://www.bilder-upload.eu/sh…ile=94482b-1431347184.jpg



  • @davidh2k once enquired in the btrfs channel about formatting volumes in btrfs with an older kernel. The conclusion was not to do it, you lose features.


    According to the btrfs wiki, the disk format isn't unstable. I definitely wouldn't run an old kernel, but I haven't had any problems with the single-device root filesystem I created from the installer. Snapshots, at least, are working flawlessly. I did wait to create my data volumes until I was running on the latest kernel/tools.




    What I did was to convert the volume (ext4) with systemrescuecd (kernel 3.14 if i recall) which was much more simpler that the things i mention before, but I am not clear about the cons of this procedure.


    I tested both methods on VMs. I selected mine because it was faster, required only the Debian install media, and there's no fiddling after install to fix things. If you do screw up, you're at the very first step in the install--just restart and try again.



    Hi, and with an GPT HDD?


    You can use GPT, but you don't need to unless your disk is > 2TB.



    And i would like to put the whole System into a subvolume, like "/" and boot from this subvolume....


    The Debian installer doesn't support installing to a subvolume. If you really want to boot from a subvolume you'll have to create a snapshot of / after install, use btrfs sub set-default to set your new snapshot as the default subvolume, and make sure fstab and grub are up to date. Once you've successfully booted into the subvolume, you can mount and delete the files from the original root.


    Why do you want to have your root on a subvolume? For easy rollbacks? In my personal experience, changing the default subvolume or editing fstab/grub as a way to rollback is error prone, and has left me with a system that doesn't boot more than once. I prefer to use Snapper (http://snapper.io) to manage my snapshots. It creates snapshot subvolumes under /.snapshots, and makes rolling back single files or entire snapshots painless. Subvolumes aren't included in snapshots even if they're mounted under the subvolume you snapshot (which is why I created the subvolumes in my original post), so it doesn't matter that they're under /.

  • The tutorial on the Snapper documentation page has a basic introduction.


    The Debian package doesn't automatically create the root config, so you'll have to do that yourself:

    Code
    snapper create-config -f btrfs -t default /


    You can have snapper automatically create pre/post snapshots for you when you upgrade by running

    Code
    snapper create --command "apt-get upgrade" --description "Upgrade"


    The tutorial doesn't show it, but the diff and undochange commands will take a filename as an optional parameter if you only want to see/undo changes on a single file.


    One of the killer features is that Snapper will take and manage hourly snapshots for you automatically. You can enable this by editing the configs in /etc/snapper/configs. I use the following config to save the last 12 hours of snapshots, a week of daily snapshots, a month of weekly snapshots, and a year of monthly snapshots for my /home subvolume:


    The snapper and snapper-configs man pages have everything else.

  • chente

    Closed the thread.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!