Package Details: mkinitcpio-btrfs 0.4.3-1

Git Clone URL: https://aur.archlinux.org/mkinitcpio-btrfs.git (read-only)
Package Base: mkinitcpio-btrfs
Description: mkinitcpio hook containing advanced features for btrfs-based root devices
Upstream URL: https://github.com/xtfxme/mkinitcpio-btrfs
Licenses: BSD
Submitter: xtfxme
Maintainer: vlad (xtfxme)
Last Packager: vlad
Votes: 73
Popularity: 1.164407
First Submitted: 2010-01-06 04:17
Last Updated: 2015-07-09 12:27

Required by (0)

Sources (3)

  • btrfs_config
  • btrfs_hook
  • btrfs_install

Latest Comments

falconindy commented on 2014-08-12 17:39

Is this hook ever going to be updated to make use of modernities like udev-based assembly? Large portions of the "run_hook" function and mount handler are redundant/superfluous in 2014.

It would also be nice if this package were renamed as well to make it more obvious that this is off the beaten path. It's unnecessary for most btrfs users who just want a bootable system.

visit commented on 2014-02-28 21:15

sysfu, I never played with snapper, but in your previous comment I saw ".snapshots/2/snapshot/root". This looks like snapper is storing the root subvolume some folders deeper in the .snapshots directory. So, this will not work with mkinitcpio-btrfs, as we expect the snapshot directly in /__snapshot.

sysfu commented on 2014-02-27 23:34

I've created a related github issue for the snapper project here https://github.com/openSUSE/snapper/issues/54

It seems that the /.snapshots directory must be an actual btrfs subvolume and not a symlink in order for snapper to work properly.

sysfu commented on 2014-02-27 23:33

using the btrfs subvolume delete command does indeed remove the /.snapshots dir, however now that snapper has created a few timeline snapshots in that directory, they cannot be moved using the mv command. Attempts to do so created hundreds of errors like the one below.

mv: cannot remove ‘.snapshots/2/snapshot/root/.gnome2/accels’: Read-only file system

Furthermore, I've already tried essentially the same thing, and it only seems to cause snappers automatic hourly snapshot creation to fail with the errors which I already posted about it /var/log/snapper.log.

visit commented on 2014-02-27 19:55

sysfu, try
# btrfs su de /.snapshots
instead

sysfu commented on 2014-02-27 18:57

@visit, suggested procedure fails on the rm command

[root@host /]# rm -r .snapshots/
rm: cannot remove ‘.snapshots/’: Operation not permitted

visit commented on 2014-02-27 11:52

sysfu, you need to create the symlink in /.

# cd /
# mv .snaphots/* /var/lib/btrfs/__snapshot/
# rm -r .snapshots
# ln -s /var/lib/btrfs/__snapshot .snapshots

And change the param back to:
BTRFS_DIR_SNAPSHOT="/__snapshot"

sysfu commented on 2014-02-27 10:34

@visit: I tried again by deleting the __active/.snapshots btrfs subvolume and all contents. cd'd into /var/lib/btrfs__active then ran this command

# ln -s /var/lib/btrfs/__snapshot .snapshots

this created a symbolic link as shown here:
[/var/lib/btrfs/__active] # ls -lad .s*
lrwxrwxrwx 1 root root 25 Feb 27 02:22 .snapshots -> /var/lib/btrfs/__snapshot/

Rebooted but seeing these errors appear in /var/log/snapper.log:
2014-02-27 02:24:25 ERR libsnapper(1786) FileUtils.cc(SDir):84 - open failed path://.snapshots (Too many levels of symbolic links)
2014-02-27 02:24:25 ERR libsnapper(1786) Snapshot.cc(initialize):348 - reading failed

I think __active/.snapshots must be a btrfs subvolume, and not a symbolic link.

visit commented on 2014-02-27 06:34

sysfu, you symlinked in the wrong direction. Try to create a symlink .snapshots -> /var/lib/btrfs/__snapshot in /__active and change your config back. Snapper should create snapshots in /var/lib/btrfs/__snapshot then.

sysfu commented on 2014-02-27 05:53

@visit/xtfxme

I have the btrfs root mounted at /var/lib/btrfs via an entry in /etc/fstab.

First I tried removing the __snapshot dir and replacing it with a symlink to __active/.snapshots/ like so

# ls -l /var/lib/btrfs/
drwxr-xr-x 1 root root 152 Jan 17 06:29 __active/
drwxr-xr-x 1 root root 152 Jan 17 06:29 __rollback/
lrwxrwxrwx 1 root root 19 Feb 26 20:34 __snapshot -> __active/.snapshots/

Then I rebooted the system and tried a rollback at boot. mkinitcpio-btrfs failed to find any snapshots to rollback to.

Then I tried modifying the line in /etc/defaults/btrfs_advanced like so:
BTRFS_DIR_SNAPSHOT="/__active/.snapshots"

rebuild initrd with "mkinitcpio -p linux" command and rebooted. This time I was able to successfully roll back to one of the automatically created snapshots made by the snapper utility.

While this works it seems a bit kludgy to me. I would prefer to have the snapper utility store the scheduled snapshots in /__snapshot instead of /__active/.snapshots.

I examined the documentation and code for the snapper utility at http://snapper.io and https://github.com/openSUSE/snapper respectively, and could not find any facility for changing the default location of the snapshots.

I'll open a github issue to see if the author would be willing to add this capability.

All comments