[Rear-users] Fwd: [ rear-Bugs-2983100 ] Debian and LVM partitions

Schlomo Schapiro schlomo at schapiro.org
Wed Sep 15 13:28:47 CEST 2010


Hi,

posting this to the list in case you experienced similar problems. I
just understood the root cause (and thanks to self for writing comments
in scripts...)

----------------------------------------------------------

I took another look into ReaR and found the actual bug in
lib/mkdr-functions.sh:

FindPhysicalDevices () {
        # all phsical devices have queue subdirectory in /sys/block/* to
adjust the
        # IO scheduling. Logical devices (DM, MD, RAM, ...) don't have it
        #
        # we use the queue subdir to find out the physical devices from
the logical ones
        for d in $(ls -d /sys/block/*/queue) ; do

I just realized that on Ubuntu 10.04 (and possibly also other recent
kernels) there IS a queue subdir also for virtual devices. ReaR uses the
existence of the queue subdir (see comment in source above) to distinguish
between physical and virtual devices. I have seen that on the same Ubuntu
the entries in /sys/block are all symlinks to something else where
*/physical/* is part of the path of the physical devices :-)

We need to compare against older kernels if this is also true there or if
there was a change in sysfs which we need to follow.

A correct solution for the issue would improve the detection of physical
vs. virtual block devices.

-----------------------------------------------------------

Kind Regards,
Schlomo


-------- Original-Nachricht --------
Betreff: [ rear-Bugs-2983100 ] Debian and LVM partitions
Datum: Wed, 15 Sep 2010 11:25:45 +0000
Von: SourceForge.net <noreply at sourceforge.net>
An: noreply at sourceforge.net

Bugs item #2983100, was opened at 2010-04-07 11:16
Message generated for change (Comment added) made by schlomoschapiro
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=859452&aid=2983100&group_id=171835

Please note that this message will contain a full copy of the comment
thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Portability & Compatibility
Group: Version 1.7
Status: Open
Resolution: Accepted
Priority: 7
Private: No
Submitted By: Slobodan Aleksic (saleksic)
Assigned to: Schlomo Schapiro (schlomoschapiro)
Summary: Debian and LVM partitions

Initial Comment:
I installed latest ReaR as .deb an by hand in Debian Squeeze and Lenny.
Always the same  problem with LVM partitions with a non LVM installation
no problems. I tracked it down to the /dev/dm-x Partitions which have no
corrsponding /dev/dm-x  under /dev. This seems to be Debian specific. (I
guess)

rear.log:
2010-04-03 18:10:18 Using 'blkid' for vol_id
2010-04-03 18:10:18 Relax & Recover Version 1.7.23 / 2009-12-09
2010-04-03 18:10:18 Combining configuration files
2010-04-03 18:10:18 Skipping /etc/rear/os.conf (file not found or empty)
2010-04-03 18:10:18 Skipping /etc/rear/mkbackup.conf (file not found or
empty)
2010-04-03 18:10:25 Including conf/Linux-x86_64.conf
2010-04-03 18:10:26 Including conf/GNU/Linux.conf
2010-04-03 18:10:26 Skipping /usr/share/rear/conf/Debian.conf (file not
found or empty)
2010-04-03 18:10:26 Skipping /usr/share/rear/conf/Debian/x86_64.conf
(file not found or empty)
2010-04-03 18:10:26 Skipping /usr/share/rear/conf/Debian/testing.conf
(file not found or empty)
2010-04-03 18:10:26 Skipping
/usr/share/rear/conf/Debian/testing/x86_64.conf (file not found or empty)
2010-04-03 18:10:29 Including /etc/rear/site.conf
2010-04-03 18:10:29 Including /etc/rear/local.conf
2010-04-03 18:10:29 Creating build area '/tmp/rear.22244'
2010-04-03 18:10:29 Running mkbackup workflow
2010-04-03 18:10:29 Running 'prep' stage
2010-04-03 18:10:49 Including prep/default/01_progress_start.sh
2010-04-03 18:10:53 Including prep/GNU/Linux/28_include_vmware_tools.sh
2010-04-03 18:10:58 Including prep/ISO/default/30_check_iso_dir.sh
2010-04-03 18:11:03 Including prep/ISO/default/32_check_cdrom_size.sh
2010-04-03 18:11:03 ISO Directory '/root/backup/rear/'
[/dev/mapper/customers-root] has 6132 MB free space
2010-04-03 18:11:05 Including prep/ISO/GNU/Linux/32_verify_mkisofs.sh
2010-04-03 18:11:05 Using '/usr/bin/mkisofs' to create ISO images
2010-04-03 18:11:06 Including prep/ISO/Linux-x86_64/33_find_isolinux.sh
2010-04-03 18:11:07 Including prep/default/99_progress_stop.sh
2010-04-03 18:11:07 Finished running 'prep' stage in 38 seconds
2010-04-03 18:11:07 Running 'dr' stage
2010-04-03 18:11:08 Including dr/default/01_mk_config_dir_recovery.sh
2010-04-03 18:11:09 Including dr/default/09_only_include_vg.sh
2010-04-03 18:11:31 Including dr/GNU/Linux/10_describe_physical_devices.sh
2010-04-03 18:11:31 BUG BUG BUG ! I could not determine a device node
for 'dm-0', I tried '/dev/dm-0' and '/dev/dm-0'
2010-04-03 18:11:31 ERROR Abnormal error occured. Please check
/tmp/rear.log for details.


cat /proc/partitions :
major minor  #blocks  name

   3        0   10240000 hda
   3        1     248976 hda1
   3        2    9984397 hda2
 254        0    9506816 dm-0
 254        1     475136 dm-1

cat /etc/rear/local.conf

OUTPUT=ISO
MODULES_LOAD=( vmxnet )
ISO_DIR=/root/backup/rear/

No modifications in site.conf (empty)


----------------------------------------------------------------------

>Comment By: Schlomo Schapiro (schlomoschapiro)
Date: 2010-09-15 13:25

Message:
Hi,

I took another look into ReaR and found the actual bug in
lib/mkdr-functions.sh:

FindPhysicalDevices () {
        # all phsical devices have queue subdirectory in /sys/block/* to
adjust the
        # IO scheduling. Logical devices (DM, MD, RAM, ...) don't have it
        #
        # we use the queue subdir to find out the physical devices from
the logical ones
        for d in $(ls -d /sys/block/*/queue) ; do

I just realized that on Ubuntu 10.04 (and possibly also other recent
kernels) there IS a queue subdir also for virtual devices. ReaR uses the
existence of the queue subdir (see comment in source above) to distinguish
between physical and virtual devices. I have seen that on the same Ubuntu
the entries in /sys/block are all symlinks to something else where
*/physical/* is part of the path of the physical devices :-)

We need to compare against older kernels if this is also true there or if
there was a change in sysfs which we need to follow.

A correct solution for the issue would improve the detection of physical
vs. virtual block devices.

HTH,
Schlomo

----------------------------------------------------------------------

Comment By: MatSim (kofi2k)
Date: 2010-09-14 18:16

Message:
Hi,

This seems also to appear on Ubuntu (here LTS 10.04, amd64). Seems to be
Debian-family specific.

Tested with latest stable (1.7.23) and development relase built with
rpmbuild and alien (1.7.25)

Didn't have time to test the patch though.

Best wishes
Mathieu



----------------------------------------------------------------------

Comment By: Jens Heidbüchel (jehe)
Date: 2010-08-17 20:56

Message:
Hi,

I modified mkdr-functions.sh a bit. I do not know if it is generic but it
does the trick for creating the ISO image. Recovery is untested by now.

Kind regards,
Jens.

Diff:

--- mkdr-functions.sh.orig      2010-08-17 20:45:33.342137770 +0200
+++ mkdr-functions.sh   2010-08-17 20:47:00.295270425 +0200
@@ -12,6 +12,9 @@
        /dev/cciss?c*)
                echo "${1%p*}"
                ;;
+       /dev/mapper/*)
+               echo $1
+               ;;
        *)
                Log "Could not guess physical device for '$1'"
                return 1
@@ -36,8 +39,12 @@
        elif test -b $device2 ; then
                echo $device2
        else
-               Log "BUG BUG BUG ! I could not determine a device node for
'$1', I tried '$device' and '$device2'"
-               return 1
+               if test -d /sys/block/$1/dm ; then
+                       echo /dev/mapper/$(cat /sys/block/$1/dm/name)
+               else
+                       Log "BUG BUG BUG ! I could not determine a device
node for '$1', I tried '$device' and '$device2'"
+                       return 1
+               fi
        fi

        # TODO: Try to find the device by looking at the MAJOR:MINOR
numbers as a last alternative


----------------------------------------------------------------------

Comment By: Schlomo Schapiro (schlomoschapiro)
Date: 2010-04-07 12:07

Message:
Hi,

this is indeed sad, thank you for pointing it out. So far ReaR assumed,
that we have a corresponding device node for every device in
/proc/partitions in /dev.

Maybe you can add something smart to lib/mkdr-functions.sh to understand
what should be done here or to understand, when it is safe to ignore this
device?

Kind Regards,
Schlomo

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=859452&aid=2983100&group_id=171835




More information about the rear-users mailing list