8000 EXCLUDE_COMPONENTS in 200_partition_layout.sh by jsmeix · Pull Request #3455 · rear/rear · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

EXCLUDE_COMPONENTS in 200_partition_layout.sh #3455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions usr/share/rear/conf/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3483,22 +3483,25 @@ DIRECTORY_ENTRIES_TO_RECOVER=()
####
# How to exclude something ----- EXCLUDES -------
#
# You cannot exclude a device (e.g. /dev/sdg) directly. Instead you have to exclude everything
# ON that device and then the dependency tracker will automatically exclude the device from the
# recovery (because there won't be any recovery information for that "unnecessary" device).
#
# Furthermore, you have to exclude MD devices and LVM2 volume groups separately
# Normally a whole device (e.g. a disk device /dev/sdX) is not excluded directly
# (for exceptional cases see EXCLUDE_COMPONENTS below).
# Instead specific things on a device are excluded.
# When everything on a device is excluded then via the dependency tracker
# the whole device gets automatically excluded from the recovery
# because there is no recovery information left for that device.
#
# You have to exclude MD devices and LVM2 volume groups separately
# as there is no automatic detection of these dependencies.
#
# Exclude filesystems by specifying their mountpoints. Will be automatically added to the
# $BACKUP_PROG_EXCLUDE array during backup to prevent the excluded filesystems' data to
# be backed up
# examples: /tmp
# Exclude filesystems by specifying their mountpoints.
# Will be automatically added to the $BACKUP_PROG_EXCLUDE array during backup
# to prevent the excluded filesystems' data to be backed up.
# Examples: /tmp
# /media/bigdisk
EXCLUDE_MOUNTPOINTS=()
#
# Exclude MD devices
# examples: /dev/md0
# Examples: /dev/md0
# /dev/md/0
EXCLUDE_MD=()
#
Expand All @@ -3508,13 +3511,27 @@ EXCLUDE_MD=()
# otherwise "rear recover" would try to recreate the filesystems onto non-existing LVs.
EXCLUDE_VG=()
#
# Exclude any component from the recovery image.
# EXCLUDE_COMPONENTS: Exclude any component from the recovery.
# Some component types need a prefix:
# - filesystems: "fs:/var/cache"
# - physical volumes: "pv:/dev/sda2"
# - swap: "swap:/dev/mapper/system-swap"
# Volume groups look like: "/dev/system".
# If in doubt about the correct syntax, consult /var/lib/rear/layout/disktodo.conf
# See /var/lib/rear/layout/disktodo.conf for the correct syntax of a specific component.
# Because EXCLUDE_COMPONENTS excludes any component from the recovery
# it can be used in exceptional cases to exclude unwanted whole disks.
# For example EXCLUDE_COMPONENTS+=( /dev/sdX ) excludes the disk /dev/sdX
# and via the dependency tracker usually also partitions and filesystems on it
# provided the diks behaves normally (i.e. the disk and things on it can be recognized properly).
# To exclude an unneeded problematic disk when the disk or things on it cannot be recognized properly
# EXCLUDE_COMPONENTS+=( /dev/sdX ) may work to exclude the disk with its partitions and filesystems.
# To exclude a problematic disk with higher level storage objects on it
# its matching components may have to be specified separately for example like
# EXCLUDE_COMPONENTS+=( /dev/sdX fs:/mountpoint pv:/dev/sdXN ) or similar as needed.
# Verify that all what belongs to /dev/sdX is marked as 'done' in /var/lib/rear/layout/disktodo.conf
# and that all what belongs to /dev/sdX is commented out in /var/lib/rear/layout/disklayout.conf
# to ensure there is no recovery information left as 'todo' or not commented out
# for a disk which should be excluded from the recovery.
EXCLUDE_COMPONENTS=()
#
# Only include LVM2 volume groups - the opposite of EXCLUDE_VG (handy if you only want vg00 to be included)
Expand Down Expand Up @@ -3549,7 +3566,7 @@ AUTOEXCLUDE_AUTOFS=
# Excluding files in the /tmp directory when an internal backup method is used
# is achieved via a different default setting:
# BACKUP_PROG_EXCLUDE=( '/tmp/*' ... ) above
# so that /tmp filesystem will be recreated as an empty filesystem
# so a /tmp filesystem will be recreated as an empty filesystem
# cf. https://github.com/rear/rear/pull/2261
AUTOEXCLUDE_PATH=( /media /run /mnt /tmp )
#
Expand Down
30 changes: 26 additions & 4 deletions usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ extract_partitions() {
# does not work with partition types that are not in the supported list
# cf. https://github.com/rear/rear/pull/2803#issuecomment-1124800884
if ! [[ "$disk_label" = "msdos" || "$disk_label" = "gpt" || "$disk_label" = "gpt_sync_mbr" || "$disk_label" = "dasd" ]] ; then
Error "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
DebugPrint "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
else
Error "Unsupported partition table '$disk_label' on $device (must be one of 'msdos' 'gpt' 'gpt_sync_mbr' 'dasd')"
fi
fi


Expand Down Expand Up @@ -357,14 +361,32 @@ extract_partitions() {
# device=/dev/mapper/mpathbp1 ; partition_prefix=mpathbp
partition_name="${device%/*}/${partition_prefix#*/}$partition_nr"
partition_device="$( get_device_name $partition_name )"
test -b "$partition_device" || Error "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
if ! test -b "$partition_device" ; then
if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
DebugPrint "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
else
Error "Invalid 'part $device' entry (partition device '$partition_device' is no block device)"
fi
fi
# Ensure syntactically correct 'part' entries of the form
# part disk_device partition_size start_byte partition_label flags partition_device
# Each value must exist and each value must be a single non-blank word.
# When $junk contains something one of the values before was more than a single word:
test "$junk" && Error "Invalid 'part $device' entry (some value is more than a single word)"
if test "$junk" ; then
if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
DebugPrint "Invalid 'part $device' entry (some value is more than a single word)"
else
Error "Invalid 'part $device' entry (some value is more than a single word)"
fi
fi
# When $flags is empty at least one value is missing:
test "$flags" || Error "Invalid 'part $device' entry (at least one value is missing)"
if ! test "$flags" ; then
if IsInArray "$device" "${EXCLUDE_COMPONENTS[@]}" ; then
DebugPrint "Invalid 'part $device' entry (at least one value is missing)"
else
Error "Invalid 'part $device' entry (at least one value is missing)"
fi
fi
# Some basic checks on the values happen in layout/save/default/950_verify_disklayout_file.sh
echo "part $device $size $start $type $flags $partition_device"
done < $TMP_DIR/partitions
Expand Down
0