Target oem-unattended drive by size?

57 views
Skip to first unread message

Alex Gooch

unread,
May 19, 2023, 12:32:27 PM5/19/23
to kiwi
Hello all!

I am wanting to target a specific drive to install my OS, and I have been using the following options in my appliance.kiwi file:

<oem-unattended>true</oem-unattended>
<oem-unattended-id>/dev/sda</oem-unattended-id>

The issue that I run into is that the different systems that will get this image may identify the drive differently than others. One constant is that I will always want to target the smaller drive. Are there any capabilities with kiwi that can do this?

I appreciate all of the help!
 Alex

Marcus Schäfer

unread,
May 21, 2023, 12:56:57 PM5/21/23
to kiwi-...@googlegroups.com
Hi Alex,

looks like you are making progress, congrats :)

> I am wanting to target a specific drive to install my OS, and I have
> been using the following options in my appliance.kiwi file:
>
> <oem-unattended>true</oem-unattended>
> <oem-unattended-id>/dev/sda</oem-unattended-id>

yeah using unix device names is not really ideal as they are
non persistent

> The issue that I run into is that the different systems that will get
> this image may identify the drive differently than others. One constant
> is that I will always want to target the smaller drive. Are there any
> capabilities with kiwi that can do this?

Unfortunately you cannot select by a size constraint that says "smaller than".
However you can say:

<type ... kernelcmdline="rd.kiwi.oem.maxdisk=3G" .../>

which will only take install devices <= 3G into account.

Other than that you can select the install device also by an ID filter.
If you don't have a devicepersistency attribute set in your XML
description the default device list is created from the devices
found in "/dev/disk/by-id/". These values contains customer ID
strings, e.g

/dev/disk/by-id/nvme-PC_SN730_NVMe_WDC_512GB_20521C803698

which is my local storage disk. If you can find a filter pattern
that would filter out the devices you don't want and results in
one device left that could be taken by the unattended mode you
can also set:

<oemconfig>
<!-- filter out every device matching -->
<oem-device-filter>/dev/ram</oem-device-filter>
</oemconfig>

Which I use to filter out all ramdisk devices. The matching
code does this:

if [[ ${disk_device} =~ ${kiwi_oemdevicefilter} ]];then
message="${disk_device} filtered out by rule:"
message="${message} ${kiwi_oemdevicefilter}"
info "${message}" >&2
continue
fi

So your filter expression can use everything that the "=~" bash
operator understands

It highly depends on your hardware situation if filtering will help though.

Let us know if this helps you

Regards,
Marcus
--
Public Key available via: https://keybase.io/marcus_schaefer/key.asc
keybase search marcus_schaefer
-------------------------------------------------------
Marcus Schäfer Brunnenweg 18
Tel: +49 7562 905437 D-88260 Argenbühl
Germany
-------------------------------------------------------
signature.asc

Alex Gooch

unread,
May 22, 2023, 3:33:57 PM5/22/23
to kiwi
Thank you! I will give this a try and let you know how it goes!

Alex Gooch

unread,
May 25, 2023, 11:22:25 AM5/25/23
to kiwi
This worked perfectly for me! Thank you
Reply all
Reply to author
Forward
0 new messages