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

flatcar-install: make sure blkid returns one device #125

Conversation

ader1990
Copy link
Contributor

In some cases where path disk devices have multiple copies, blkid should return only one device for label.

According to https://linux.die.net/man/8/blkid, the -l would be perfect for this, as it returns the regular block device first.

Fixes: flatcar/Flatcar#1506

In some cases where path disk devices have multiple copies, `blkid` should return only one device for label.

According to https://linux.die.net/man/8/blkid, the `-l` would be perfect for this, as it returns the regular block device first.

Fixes: flatcar/Flatcar#1506
@krnowak
Copy link
Member

krnowak commented Sep 11, 2024

man blkid for --list-one says as follows:

Look up only one device that matches the search parameter specified with the --match-token option. If there are multiple devices that match the specified search parameter, then the device with the highest priority is returned, and/or the first device found at a given priority (but see below note about udev). Device types in order of decreasing priority are: Device Mapper, EVMS, LVM, MD, and finally regular block devices. If this option is not specified, blkid will print all of the devices that match the search parameter.

So looks like regular block device is of lowest priority. I'm not sure if it matters, though - we still want to have just one device, so this seems to be an alright change. What else we could do is to slap | head -n1 instead, but this is as justified as your -l and arguably hackier. I'm inclined to approve it.

@ader1990
Copy link
Contributor Author

Thanks @krnowak! I will try to look for another alternative this week, and if I do not find a more suitable approach, I will merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

flatcar-install fails when using path disk devices with multiple copies
2 participants