Hello community, here is the log from the commit of package rear for openSUSE:Factory checked in at 2015-10-28 17:30:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rear (Old) and /work/SRC/openSUSE:Factory/.rear.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rear" Changes: -------- --- /work/SRC/openSUSE:Factory/rear/rear.changes 2015-10-20 00:05:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rear.new/rear.changes 2015-10-28 17:30:43.000000000 +0100 @@ -1,0 +2,12 @@ +Fri Oct 16 13:02:44 CEST 2015 - jsm...@suse.de + +- Enhanced SLE12-SP1-btrfs.patch so that for mounted btrfs + subvolumes that have the 'no copy on write' attribute set + those btrfs subvolumes are recreated with that attribute set + (by using 'chattr' on the btrfs subvolume directory), + see https://github.com/rear/rear/issues/556 + (bsc#946006 fate#318701). +- Enhanced SLE12-SP1-btrfs-example.conf so that also lsattr is + in the recovery system (useful but not strictly required). + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ SLE12-SP1-btrfs-example.conf ++++++ --- /var/tmp/diff_new_pack.wJg7WI/_old 2015-10-28 17:30:44.000000000 +0100 +++ /var/tmp/diff_new_pack.wJg7WI/_new 2015-10-28 17:30:44.000000000 +0100 @@ -41,8 +41,9 @@ # On SLE12-SP1 with default btrfs subvolumes what is mounted at '/' is a btrfs snapshot subvolume # that is controlled by snapper so that snapper is needed in the recovery system. # In SLE12-SP1 some btrfs subvolume directories (/var/lib/pgsql /var/lib/libvirt/images /var/lib/mariadb) -# have the "no copy on write (C)" file attribute set so that chattr is needed in the recovery system. -REQUIRED_PROGS=( "${REQUIRED_PROGS[@]}" snapper chattr ) +# have the "no copy on write (C)" file attribute set so that chattr is required in the recovery system +# and accordingly also lsattr is useful to have in the recovery system (but not strictly required): +REQUIRED_PROGS=( "${REQUIRED_PROGS[@]}" snapper chattr lsattr ) # Snapper setup by the recovery system uses /usr/lib/snapper/installation-helper # that is linked to all libraries where snapper is linked to # (except libdbus that is only needed by snapper). ++++++ SLE12-SP1-btrfs.patch ++++++ --- /var/tmp/diff_new_pack.wJg7WI/_old 2015-10-28 17:30:44.000000000 +0100 +++ /var/tmp/diff_new_pack.wJg7WI/_new 2015-10-28 17:30:44.000000000 +0100 @@ -65,8 +65,8 @@ # its top-level/root subvolume is the btrfs default subvolume which gets mounted when no other subvolume is specified. diff -rp -U17 rear-1.17.2/usr/share/rear/layout/prepare/GNU/Linux/13_include_mount_subvolumes_code.sh rear-1.17.2.SLE12-SP1-btrfs/usr/share/rear/layout/prepare/GNU/Linux/13_include_mount_subvolumes_code.sh --- rear-1.17.2/usr/share/rear/layout/prepare/GNU/Linux/13_include_mount_subvolumes_code.sh 2015-06-08 09:50:38.000000000 +0200 -+++ rear-1.17.2.SLE12-SP1-btrfs/usr/share/rear/layout/prepare/GNU/Linux/13_include_mount_subvolumes_code.sh 2015-10-02 13:22:15.000000000 +0200 -@@ -19,206 +19,300 @@ btrfs_subvolumes_setup() { ++++ rear-1.17.2.SLE12-SP1-btrfs/usr/share/rear/layout/prepare/GNU/Linux/13_include_mount_subvolumes_code.sh 2015-10-16 12:09:06.000000000 +0200 +@@ -19,206 +19,309 @@ btrfs_subvolumes_setup() { # where $device is the device node where the filesystem was already created by 13_include_filesystem_code.sh # (usually a harddisk partition like e.g. /dev/sda1): device=$1 @@ -188,6 +188,15 @@ fi echo "btrfs subvolume create $recovery_system_mountpoint/$subvolume_path" ) >> "$LAYOUT_CODE" ++ # Btrfs subvolumes 'no copy on write' attribute setup: ++ if grep -q "^btrfsnocopyonwrite $subvolume_path\$" "$LAYOUT_FILE" ; then ++ info_message="Setting 'no copy on write' attribute for subvolume $subvolume_path" ++ Log $info_message ++ ( ++ echo "# $info_message" ++ echo "chattr +C $recovery_system_mountpoint/$subvolume_path" ++ ) >> "$LAYOUT_CODE" ++ fi done < <( grep "^btrfsnormalsubvol $device $mountpoint " "$LAYOUT_FILE" ) ########################################### # Btrfs default subvolume setup: @@ -381,3 +390,56 @@ if test "$subvolume_path" = "$default_subvolume_path" ; then Log "On $device btrfs default subvolume $default_subvolume_path already mounted at $subvolume_mountpoint, no remounting needed" continue +diff -rp -U17 rear-1.17.2/usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh rear-1.17.2.SLE12-SP1-btrfs/usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh +--- rear-1.17.2/usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh 2015-06-25 09:07:56.000000000 +0200 ++++ rear-1.17.2.SLE12-SP1-btrfs/usr/share/rear/layout/save/GNU/Linux/23_filesystem_layout.sh 2015-10-16 12:06:18.000000000 +0200 +@@ -256,23 +256,49 @@ read_filesystems_command="$read_filesyst + if test -z "$btrfs_subvolume_path" ; then + # When btrfs_subvolume_path is empty (in particular when the traditional mount command is used) + # try to find the mountpoint in /etc/fstab and try to read the subvol=... option value if exists + # (using subvolid=... can fail because the subvolume ID can be different during system recovery). + # Because both "mount ... -o subvol=/path/to/subvolume" and "mount ... -o subvol=path/to/subvolume" work + # the subvolume path can be specified with or without leading '/': + btrfs_subvolume_path=$( grep " $subvolume_mountpoint btrfs " /etc/fstab | grep -o 'subvol=[^ ]*' | cut -s -d '=' -f 2 ) + fi + # Remove leading '/' from btrfs_subvolume_path (except it is only '/') to have same syntax for all entries and + # without leading '/' is more clear that it is not an absolute path in the currently mounted tree of filesystems + # instead the subvolume path is relative to the toplevel/root subvolume of the particular btrfs filesystem + # (i.e. a subvolume path is an absolute path in the particular btrfs filesystem) + # see https://btrfs.wiki.kernel.org/index.php/Mount_options + test "/" != "$btrfs_subvolume_path" && btrfs_subvolume_path=${btrfs_subvolume_path#/} + echo "btrfsmountedsubvol $device $subvolume_mountpoint $mount_options $btrfs_subvolume_path" + fi + done < <( eval $read_mounted_btrfs_subvolumes_command ) ++ ######################################## ++ # No copy on write attributes of mounted btrfs subvolumes: ++ echo "# Mounted btrfs subvolumes that have the 'no copy on write' attribute set." ++ echo "# Format: btrfsnocopyonwrite <btrfs_subvolume_path>" ++ lsattr_command="$( type -P lsattr )" ++ if test -x "$lsattr_command" -a -x "$findmnt_command" ; then ++ for subvolume_mountpoint in $( $findmnt_command -nrv -o TARGET -t btrfs ) ; do ++ # The 'no copy on write' attribute is shown as 'C' in the lsattr output (see "man chattr"): ++ if $lsattr_command -d $subvolume_mountpoint | cut -d ' ' -f 1 | grep -q 'C' ; then ++ btrfs_subvolume_path=$( $findmnt_command -nrv -o FSROOT $subvolume_mountpoint ) ++ # Remove leading '/' from btrfs_subvolume_path (except it is only '/') to have same syntax for all entries and ++ # without leading '/' is more clear that it is not an absolute path in the currently mounted tree of filesystems ++ # instead the subvolume path is relative to the toplevel/root subvolume of the particular btrfs filesystem ++ # (i.e. a subvolume path is an absolute path in the particular btrfs filesystem) ++ # see https://btrfs.wiki.kernel.org/index.php/Mount_options ++ test "/" != "$btrfs_subvolume_path" && btrfs_subvolume_path=${btrfs_subvolume_path#/} ++ if test -n "btrfs_subvolume_path" ; then ++ echo "btrfsnocopyonwrite $btrfs_subvolume_path" ++ else ++ echo "# $subvolume_mountpoint has the 'no copy on write' attribute set but $findmnt_command does not show its btrfs subvolume path" ++ fi ++ fi ++ done ++ else ++ echo "# Attributes cannot be determined because no executable 'lsattr' and/or 'findmnt' command(s) found." ++ fi + fi + + ) >> $DISKLAYOUT_FILE + # End writing output to DISKLAYOUT_FILE. + Log "End saving filesystem layout" +