Skip to content

Commit

Permalink
Revert "Update 200_partition_layout.sh"
Browse files Browse the repository at this point in the history
This reverts commit 0a1d634.

We now skip disks with no data (like when there is no medium), so
incomplete disk entries (without partition type) should not occur
anymore. Restore the code that aborted when such disks were encountered.
Incomplete entries should not be allowed to occur, as they could confuse
the layout restoration code. Moreover, the layout restoration wipes
all disks in the layout, so if during layout restoration there happens
to be a medium in the drive that was empty during layout save, the data
on the medium would get overwritten and lost. And if there is not medium,
the layout recreation script would fail.

See the discussion at rear#2958 (comment)
  • Loading branch information
pcahyna committed Sep 11, 2023
1 parent dfb84eb commit 431cf22
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,7 @@ Log "Saving disks and their partitions"
continue
fi
disktype=$(parted -s $devname print | grep -E "Partition Table|Disk label" | cut -d ":" -f "2" | tr -d " ")
# We do not error out when there is no partition label type value because
# "rear recover" works in a special case without partition label type value when there is
# only a 'disk' entry but nothing else for this disk exists in disklayout.conf
# which can happen when /dev/sdX is an empty SD card slot without medium,
# see https://github.com/rear/rear/issues/2810
test $disktype || LogPrintError "No partition label type for 'disk $devname' (may cause 'rear recover' failure)"
test $disktype || Error "Invalid 'disk $devname' entry (no partition table type for '$devname')"
if [ "$disktype" != "dasd" ]; then
echo "# Disk $devname"
echo "# Format: disk <devname> <size(bytes)> <partition label type>"
Expand Down

0 comments on commit 431cf22

Please sign in to comment.