Ways to query udiskie for information
See original GitHub issueI’m trying to automate some stuff right now (basically mount a specific LUKS partition as part of a bigger process) which requires me to figure out the current device ID of a partition. While this is almost trivial as root (parsing the output of tools like blkid
or lsblk
) it’s a lot more tedious to do as a regular user.
I’m not even sure yet what the best way of implementing it will be. All I really need is a list of devices managed via udiskie/udisks2 (typically those not managed by /etc/fstab
) with device file, file system, uuid, label, mount point (if any) and maybe size. So far I’ve been trying to build a bash script but the output of udisksctl
is quite annoying to parse and working with dbus from bash is just plain masochism. You’d think that info is easy to get but alas…
So I could think of two ways to make this work in conjunction with udiskie:
- A cli tool like
udiskie-info
could be used to access information in simple readable format. For exampleudiskie-info
could output a simple list of block devices mounted/mountable via udisksudiskie-info --blkid
could output information in the typicalblkid
formatting. (In case anyone is wondering, nativeblkid
doesn’t return reliable information when run as non-root.)- The output formatting options of
lsblk
could also serve as inspiration.
- If udiskie were to provide a (documented) Python API people could use that in a simple Python script and call it where needed. I’d really like that, actually.
Let me know what you think. If you know a better way of doing what I’m trying to do I’ll be happy as well.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Hey,
I’ve added a very basic
udiskie-info
. However, my main concern was a use-case of my own, so it may not address all your needs. Let me know if you’d like something changed/added or otherwise feel free to close the issue.(Note that the exact command line interface may still change. This is also the reason that I will not add “official” documentation for this utility yet.)
Usage examples:
At this time, you can only have one output column, but several filters.
That’s really cool, thanks for adding!
(btw it didn’t quite work when you mentioned it but now it does.)