Ticket #623 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

SLES11 SP2 : incorrect mountlist during mondoarchive

Reported by: ddiaz Owned by: bruno
Priority: high Milestone: 3.0.3
Component: mondo Version: 3.0.1
Severity: major Keywords:
Cc:

Description (last modified by bruno) (diff)

Versions are : mindi-2.1.1-1.sles11 afio-2.5-64 mindi-busybox-1.18.5-1.sles11 mondo-3.0.1-1.sles11

With SLES 11 SP2 the mountlist is created incorrectly during backup, which is causing troubles during restore. The mountlist has to be edited manually during restore.

$ df result:
/dev/mapper/vg00-lv_tmp       ext3       2064208    620164   1339188  32% /tmp
/dev/mapper/vg00-lv_usr       ext3       5160576   3917264    981168  80% /usr

From mondoarchive.log, mountlist.txt file content is:

/dev/dm-5 /tmp ext3 2097152
/dev/dm-7 /usr ext3 5242880

SLES 11 SP2 has links in /dev/vg00 pointing to dm-X devices - that's the difference from SLES 11 SP1. This problem doesn't exist with SLES 11 SP1.

Change History

comment:1 Changed 2 years ago by bruno

  • Status changed from new to assigned
  • Description modified (diff)

comment:2 Changed 2 years ago by ddiaz

function ListAllLogicalVolumesSortedBydm?() in analyze-my-lvm will sort dm-0, dm-1, dm-10, dm-11, dm-2, dm-3, dm-4, dm-5, dm-6, dm-7, dm-8, dm-9 instead of dm-0, dm-1, dm-2, dm-3, dm-4, dm-5, dm-6, dm-7, dm-8, dm-9, dm-10, dm-11.

Replace in ListAllLogicalVolumesSortedBydm?() function :

sort -t'|' $MINDI_TMP/sorteddm | cut -d'|' -f2 

by

cut -d'-' -f2- $MINDI_TMP/sorteddm | sort -t'|' -n | cut -d'|' -f2
Last edited 2 years ago by bruno (previous) (diff)

comment:3 Changed 2 years ago by msross

This is true for RHEL 6.* (CentOS). Udev rules 10-dm.rules and 11-dm-lvm.rules create symbolic links for the /dev/mapper/<vg>-<lv> and /dev/<vg>/<lv> devices to the dm-X nodes. These links are resolved by readlink in Mindi's MakeMountlist?.

I would think that the /dev/mapper/ devices would be preferred here since they should remain consistent.

comment:4 follow-up: ↓ 5 Changed 2 years ago by bruno

  • Status changed from assigned to closed
  • Resolution set to fixed

Should be fixed in rev [3037].

comment:5 in reply to: ↑ 4 Changed 2 years ago by msross

Replying to bruno:

Should be fixed in rev [3037].

I may be confused on the original post but the sort fix does not resolve the mountlist issue described; the mountlist will still use the dynamically created /dev/dm-N nodes versus the /dev/mapper/<vg>-<lv> nodes.

Under RHEL and Cent (version 6+ at the least) there is no guarantee the logical volumes will link to the same dm-N nodes across boots and it is recommended that the /dev/mapper/<vg>-<lv> nodes be used to reference the logical volume devices.

The issue presented itself to me when restoring from a library disk of backups. The library disk has a logical volume (for easy identification) to store multiple mondo backups. During restore there were conflicts partitioning the LVM partitions due to the dm-N nodes not being allocated the same as when the backup was created; one of the restore dm-N nodes being used allocated to the library disk in the restore environment.

In MakeMountlist? (~1078) the readlink sets the current partition to the dm-N node. Additionally there is an check on the next line to ensure that the readlink did not resolve to a /dev/mapper node which leads me to wonder if there is a case I am missing where the mapper node is undesired? In any case I changed the block as follows.

Original:

current_partition=`readlink -f $c_p`
[ "`echo "$current_partition" | grep -F "/dev/mapper"`" != "" ] && current_partition="$c_p"
[ "`echo "$useless_dev" | grep -F "$current_partition"`" ] && continue

Modified:

current_partition=`readlink -f $c_p`
if [ "`echo "$current_partition" | grep -F "/dev/mapper"`" != "" ]; then
    current_partition="$c_p"
elif [ "`echo $current_partition | grep -E '^/dev/dm-'`" ]; then
    current_partition=$(MINDI_LIB/analyze-my-lvm --givemapperofdm $current_parition)
fi
[ "`echo "$useless_dev" | grep -F "$current_partition"`" ] && continue

comment:6 Changed 2 years ago by bruno

Patch adopted in rev [3046]

Note: See TracTickets for help on using tickets.