Setup (subvolumes btrfs) and boot directly from it

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 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!

      I host parts of the omv-extras.org Repository, the OpenMediaVault Live Demo and the pre-built PXE Images. If you want you can take part and help covering the costs by having a look at my profile page.
    • 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:

      Source Code

      1. btrfs sub create /target/run
      2. btrfs sub create /target/tmp
      3. btrfs sub create /target/var/tmp
      4. btrfs sub create /target/var/spool
      5. btrfs sub create /target/var/log
      6. btrfs sub create /target/var/crash
      7. btrfs sub create /target/var/lib/rrdcached

      2. Complete install with only standard system utilities

      3. From a terminal, Install OpenMediaVault

      Source Code

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

      4. Reboot

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

      Source Code

      1. wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all.deb
      2. dpkg -i openmediavault-omvextrasorg_latest_all.deb
      3. 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

      Source Code

      1. apt-get install -t wheezy-backports btrfs-tools

      8. Reboot

      9. Finish OMV configuration from GUI

      The post was edited 6 times, last by Invictus ().

    • Invictus wrote:

      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.
      chat support at #openmediavault@freenode IRC | Spanish & English | GMT+10
      telegram.me/openmediavault broadcast channel
      openmediavault discord server
    • Invictus wrote:

      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:

      Source Code

      1. btrfs sub create /target/run
      2. btrfs sub create /target/tmp
      3. btrfs sub create /target/var/tmp
      4. btrfs sub create /target/var/spool
      5. btrfs sub create /target/var/log
      6. btrfs sub create /target/var/crash
      7. btrfs sub create /target/var/lib/rrdcached

      2. Complete install with only standard system utilities

      3. From a terminal, Install OpenMediaVault

      Source Code

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

      4. Reboot

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

      Source Code

      1. wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all.deb
      2. dpkg -i openmediavault-omvextrasorg_latest_all.deb
      3. 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

      Source Code

      1. apt-get install -t wheezy-backports btrfs-tools

      8. Reboot

      9. Finish OMV configuration from GUI



      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:

      bilder-upload.eu/show.php?file=94482b-1431347184.jpg


    • subzero79 wrote:


      @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.


      subzero79 wrote:


      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.


      Nightcrawler wrote:

      Hi, and with an GPT HDD?

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


      Nightcrawler wrote:

      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 (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 post was edited 3 times, last by Invictus ().

    • 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:

      Source Code

      1. snapper create-config -f btrfs -t default /


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

      Source Code

      1. 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:

      Source Code

      1. # subvolume to snapshot
      2. SUBVOLUME="/home"
      3. # filesystem type
      4. FSTYPE="btrfs"
      5. # users and groups allowed to work with config
      6. ALLOW_USERS=""
      7. ALLOW_GROUPS="users"
      8. # sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
      9. # directory
      10. SYNC_ACL="yes"
      11. # create hourly snapshots
      12. TIMELINE_CREATE="yes"
      13. # cleanup hourly snapshots after some time
      14. TIMELINE_CLEANUP="yes"
      15. # limits for timeline cleanup
      16. # added one to each period to ensure at least a full week/month/year is kept
      17. TIMELINE_MIN_AGE="0"
      18. TIMELINE_LIMIT_HOURLY="12"
      19. TIMELINE_LIMIT_DAILY="8"
      20. TIMELINE_LIMIT_WEEKLY="5"
      21. TIMELINE_LIMIT_MONTHLY="13"
      22. TIMELINE_LIMIT_YEARLY="0"
      Display All


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