[dm-devel] Choosing the device name in kpartx.

Andre Caldas andre.em.caldas at gmail.com
Sun Oct 2 05:10:50 UTC 2016


Dear developers,

I am writing a script using kpartx. It seems to be a very very nice
tool that will make my life a lot easier!

As I understood it, when I call
$ kpartx -a disk.img
kpartx chooses a "device name" X, detects the partitions and their
numbers N, and creates device nodes with naming
XpN.

As I understood it, the correct way to know what name X was chosen, is
to parse the output. I am not comfortable on depending on the format
of something that looks to be intended for humans and not computers.

I think it would be really nice if I could choose the name X myself.
Of course, I would get an error if the name is already in use...

In my script, I know the partition numbers. I can choose the delimiter
with "-p". In my opinion, it would be nice if:
1. I could chose X myself; or
2. If there was an option to get the output of kpartx to be just the
path to the "root" device; or
3. If there was an option to get the output of kpartx to be standard
and intended for parsing; or
4. The documentation stated that the output is not supposed to change
in future versions of kpartx.

Well... maybe I just missed the "correct" way to script with kpartx.
In this case, I would be happy with some guidance... :-)

In my script, I create a file with dd, partition it using sfdisk, then
mount it using kpartx/mount.


Thank you for your time and patience...
André Caldas.




More information about the dm-devel mailing list