Skip to content
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

Avoid log messages about multiple disk partitions with identical name #1483

Merged
merged 1 commit into from Sep 14, 2017

Conversation

OliverO2
Copy link
Contributor

@OliverO2 OliverO2 commented Sep 12, 2017

Problem:

Original gpt disk partitions may be unnamed. As parted requires a name for each gpt partition, ReaR currently supplies "rear-noname" for originally unnamed partitions. This leads to systemd log messages during rear recover and in boot logs:

Dev dev-disk-by\x2dpartlabel-rear\x2dnoname.device appeared twice with different sysfs paths

Solution:

To supply unique names for unnamed partitions, just use the basename of the partition's device path, e.g. sda1, sda2, ...

The suggested change also strips unnecessary quotes from parted invocations.

Tested on Ubuntu 16.04.3 LTS (gpt only).

@schlomo
Copy link
Member

schlomo commented Sep 12, 2017

Good catch. Can you tell us why you fix the type name during recovery and not already during the mkrescue phase? In usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh this name is initially generated, I think that there you could already set such a unique name.

@OliverO2
Copy link
Contributor Author

Nameless partitions seem fine with the UEFI spec, so it's actually a parted limitation which might go away in a future version of parted or with some other partitioning tool. Keeping "rear-noname" around as a marker for an originally unnamed partition has two advantages:

  • As better tools become available we could re-create a true-to-original partition table.
  • The user can edit disklayout.conf and add partitions without having to worry about assigning unique partition names.

Tools background: The parted manual page is actually out of date with respect to the mkpart command, but the user's manual clearly states A name must be specified for a ‘gpt’ partition table. In contrast, gparted does not have this restriction.

Copy link
Member

@jsmeix jsmeix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From plain looking at the code it looks good:
Simple and straightforward plus an explanatory comment
so that in case of issues there others can easily fix things properly,
cf. https://github.com/rear/rear/wiki/Coding-Style

@jsmeix jsmeix added enhancement Adaptions and new features minor bug An alternative or workaround exists labels Sep 12, 2017
@jsmeix jsmeix added this to the ReaR v2.3 milestone Sep 12, 2017
@jsmeix
Copy link
Member

jsmeix commented Sep 14, 2017

If there are no strict objections
I would like to merge it soon...

@jsmeix jsmeix merged commit 625b506 into rear:master Sep 14, 2017
@OliverO2 OliverO2 deleted the fix/disk-partitions branch November 8, 2017 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adaptions and new features fixed / solved / done minor bug An alternative or workaround exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants