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
Skip invalid disk drives (zero sized, no media) when saving layout #3047
Merged
Conversation
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
pcahyna
force-pushed
the
skip-invalid-drives
branch
from
September 11, 2023 14:19
431cf22
to
c59b3c7
Compare
pcahyna
referenced
this pull request
Sep 11, 2023
In layout/save/GNU/Linux/200_partition_layout.sh do not error out when there is no partition label type value for a 'disk' entry in disklayout.conf 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 #2810
jsmeix
reviewed
Sep 12, 2023
jsmeix
reviewed
Sep 12, 2023
jsmeix
approved these changes
Sep 12, 2023
@pcahyna |
jsmeix
reviewed
Sep 12, 2023
@jsmeix I believe I addressed all review comments in last 3 commits. |
jsmeix
approved these changes
Sep 13, 2023
@pcahyna |
This prevents errors when parted is called on an invalid device.
Introduce function is_disk_valid, which performs checks for disk usability beyond validating the device name. In some cases the device name may be valid, but there are no data, typically because it is a drive with removable media and there is no medium in the tray. Happens typically with card (e.g. SD card) readers with empty slot. This is a normal occurrence, so do not Error out, only display a message and skip the device.
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)
pcahyna
force-pushed
the
skip-invalid-drives
branch
from
September 13, 2023 09:37
66081aa
to
db191aa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Details:
Type: Enhancement
Impact: Normal
Reference to related issue (URL): fixes ReaR fails while verifying the disklayout when a disk has a 0 size #2958
How was this pull request tested?
rear savelayout
on Fedora 36 with empty USB SD card readerI show the relevant log excerpt and the corresponding part of
disklayout.conf
, if any.same result
This reproduces Empty SD card slot appears as /dev/sdb disk without partition type #2810
rear savelayout
on Fedora 36 with empty USB SD card reader andAUTOEXCLUDE_DISKS=n
same result
AUTOEXCLUDE_DISKS=n
Brief description of the changes in this pull request:
This is a normal occurrence, so do not Error out, only display a message and skip the device.
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 fails while verifying the disklayout when a disk has a 0 size #2958 (comment)