-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2269 from petroniusniger/issue-2247
Initial draft implementation of the new 'mountonly' workflow to use ReaR as rescue system, therein mount the filesystems of the target system so that one can manually repair it (see #2247). This is described in doc/user-guide/04-scenarios.adoc
- Loading branch information
Showing
43 changed files
with
416 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../verify/GNU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../verify/default |
1 change: 1 addition & 0 deletions
1
usr/share/rear/final-mount/default/110_bind_mount_proc_sys_dev_run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../finalize/default/110_bind_mount_proc_sys_dev_run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../finalize/default/900_remount_sync.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/do-mount/default/100_confirm_layout_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../recreate/default/100_confirm_layout_code.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../recreate/default/200_run_layout_code.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../recreate/default/250_verify_mount.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/100_include_partition_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/100_include_partition_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/110_include_lvm_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/110_include_lvm_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/120_include_raid_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/120_include_raid_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/131_include_filesystem_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/131_include_filesystem_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/133_include_mount_filesystem_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/133_include_mount_filesystem_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/135_include_btrfs_subvolumes_generic_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/135_include_btrfs_subvolumes_generic_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/136_include_btrfs_subvolumes_SLES_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/136_include_btrfs_subvolumes_SLES_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/140_include_swap_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/140_include_swap_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/150_include_drbd_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/150_include_drbd_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/160_include_luks_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/160_include_luks_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/170_include_hpraid_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/170_include_hpraid_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/180_include_opaldisk_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/180_include_opaldisk_code.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/GNU/Linux/210_load_multipath.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../prepare/GNU/Linux/210_load_multipath.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/010_prepare_files.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/010_prepare_files.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/250_compare_disks.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/250_compare_disks.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/270_overrule_migration_mode.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/270_overrule_migration_mode.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/300_map_disks.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/310_remove_exclusions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/310_remove_exclusions.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/320_apply_mappings.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/320_apply_mappings.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/500_confirm_layout_file.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/500_confirm_layout_file.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/510_list_dependencies.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/510_list_dependencies.sh |
1 change: 1 addition & 0 deletions
1
usr/share/rear/layout/prep-for-mount/default/520_exclude_components.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../prepare/default/520_exclude_components.sh |
69 changes: 69 additions & 0 deletions
69
usr/share/rear/layout/prep-for-mount/default/540_generate_device_code.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Use the dependencies to order device processing and generate code for them. | ||
|
||
# LAYOUT_CODE is the script to mount the target system based on its disk | ||
# layout (diskrestore.sh). | ||
|
||
save_original_file "$LAYOUT_CODE" | ||
|
||
# Initialize diskrestore.sh: | ||
cat <<EOF >"$LAYOUT_CODE" | ||
#!/bin/bash | ||
# Create "breadcrumb" file (used as interlock by other workflows), | ||
# defined and checked by ./setup/default/002_clean_start.sh | ||
echo "$WORKFLOW" > $BREADCRUMB | ||
LogPrint "Start target system mount." | ||
mkdir -p $TARGET_FS_ROOT | ||
if create_component "vgchange" "rear" ; then | ||
lvm vgchange -a y >/dev/null | ||
component_created "vgchange" "rear" | ||
fi | ||
set -e | ||
set -x | ||
EOF | ||
|
||
# Populate diskrestore.sh with further code to (re)-mount all disk layout components: | ||
all_done= | ||
while [ -z "$all_done" ] ; do | ||
# Cycle through all components and find one that can be mounted. | ||
willdodev= | ||
willdotype= | ||
|
||
cp "$LAYOUT_TODO" "${LAYOUT_TODO}.tmp" | ||
while read status thisdev type; do | ||
# Test if all dependencies are already created. | ||
Debug "Testing $thisdev for dependencies..." | ||
deps=($(grep "^$thisdev\ " "$LAYOUT_DEPS" | cut -d " " -f "2")) | ||
Debug "deps (${#deps[@]}): ${deps[*]}" | ||
|
||
donedeps=0 | ||
for dep in "${deps[@]}" ; do | ||
if grep -q "done $dep " "$LAYOUT_TODO.tmp"; then | ||
let donedeps++ | ||
fi | ||
done | ||
|
||
if [ ${#deps[@]} -eq $donedeps ] ; then | ||
Debug "All dependencies for $thisdev are present, processing..." | ||
willdodev="$thisdev" | ||
willdotype="$type" | ||
break | ||
fi | ||
done < <(grep "^todo" "$LAYOUT_TODO") | ||
rm "$LAYOUT_TODO.tmp" | ||
|
||
# Write the code to mount a device. | ||
if [ -n "$willdodev" ] ; then | ||
do_mount_device "$willdodev" "$willdotype" | ||
|
||
mark_as_done "$willdodev" | ||
else | ||
# No device to be mounted, no additional dependencies can be satisfied. | ||
all_done="y" | ||
fi | ||
|
||
done |
10 changes: 10 additions & 0 deletions
10
usr/share/rear/layout/prep-for-mount/default/550_finalize_script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Add final information to the script. | ||
|
||
cat >> $LAYOUT_CODE <<EOF | ||
set +x | ||
set +e | ||
LogPrint "Disk layout processed." | ||
EOF |
58 changes: 58 additions & 0 deletions
58
usr/share/rear/layout/prep-for-mount/default/600_show_unprocessed.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
# Warn about missing components and for each missing component | ||
# offer the user a way to manually add code that mounts it. | ||
|
||
rear_workflow="rear $WORKFLOW" | ||
rear_shell_history="$( echo -e "vi $LAYOUT_CODE\nless $LAYOUT_CODE" )" | ||
|
||
unset choices | ||
choices[0]="View $LAYOUT_CODE" | ||
choices[1]="Edit $LAYOUT_CODE" | ||
choices[2]="Go to Relax-and-Recover shell" | ||
choices[3]="Continue '$rear_workflow'" | ||
choices[4]="Abort '$rear_workflow'" | ||
|
||
while read status name type junk ; do | ||
missing_component="$name ($type)" | ||
LogUserOutput "No code has been generated to mount $missing_component." | ||
LogUserOutput "To mount $missing_component manually add code to $LAYOUT_CODE or abort." | ||
while true ; do | ||
# The default user input is "Continue" to make it possible to run ReaR unattended | ||
# so that 'rear mountonly' proceeds after the timeout regardless that it probably fails | ||
# when the component is not recreated but perhaps it could succeed in migration mode | ||
# on different replacement hardware where it might be even right to simply "Continue". | ||
# Generate a runtime-specific user_input_ID so that for each missing component | ||
# a different user_input_ID is used for the UserInput call so that the user can specify | ||
# for each missing component a different predefined user input. | ||
# Only uppercase letters and digits are used to ensure the user_input_ID is a valid bash variable name | ||
# (otherwise the UserInput call could become invalid which aborts 'rear mountonly' with a BugError) and | ||
# hopefully only uppercase letters and digits are sufficient to distinguish different missing components: | ||
current_missing_component_alnum_uppercase="$( echo "$missing_component" | tr -d -c '[:alnum:]' | tr '[:lower:]' '[:upper:]' )" | ||
test "$current_missing_component_alnum_uppercase" || current_missing_component_alnum_uppercase="COMPONENT" | ||
user_input_ID="ADD_CODE_TO_RECREATE_MISSING_$current_missing_component_alnum_uppercase" | ||
case "$( UserInput -I $user_input_ID -p "Manually add code that mounts $missing_component" -D "${choices[3]}" "${choices[@]}" )" in | ||
(${choices[0]}) | ||
# Run 'less' with the original STDIN STDOUT and STDERR when 'rear' was launched by the user: | ||
less $LAYOUT_CODE 0<&6 1>&7 2>&8 | ||
;; | ||
(${choices[1]}) | ||
# Run 'vi' with the original STDIN STDOUT and STDERR when 'rear' was launched by the user: | ||
vi $LAYOUT_CODE 0<&6 1>&7 2>&8 | ||
;; | ||
(${choices[2]}) | ||
# rear_shell runs 'bash' with the original STDIN STDOUT and STDERR when 'rear' was launched by the user: | ||
rear_shell "" "$rear_shell_history" | ||
;; | ||
(${choices[3]}) | ||
# Continue with the next missing component: | ||
break | ||
;; | ||
(${choices[4]}) | ||
abort_recreate | ||
Error "User chose to abort '$rear_workflow' in ${BASH_SOURCE[0]}" | ||
;; | ||
# No default case is needed here because the 'while true' loop repeats for invalid user input. | ||
esac | ||
done | ||
done < <(grep "^todo" "$LAYOUT_TODO") | ||
|
Oops, something went wrong.