forthebadge forthebadge Gem Version

This gem was last updated on the 15.05.2022 (dd.mm.yyyy notation), at 23:56:46 o'clock.

The goals for the mountpoints project

The mountpoints project shall simply display the available mountpoints for USB devices. This should ideally work on Linux as well on Windows - and, if possible, on other operating systems as well.

Simple usage example

Consider using the mountpoints gem like this, after installation:

require 'mountpoints'
pp Mountpoints[] # This will (quietly) return an Array, which contains the mounted devices.

Alternative you can use it from the commandline, in which case it will report to you (the user) what it has found, such as "Discovered mountpoint /mnt/usb1/." or something like that.

Commandline flags

The flag --extra-verbose can be used to report more information about the mountpoints (on Linux).

Storing the mountpoints internally

The current policy is to store all mountpoints as directories, that is via a trailing /. So if the mountpoint is normally /Mount/USB1 then this will be stored as /Mount/USB1/.

The reason I document this here is so that I can refer to this policy in case anything changes - and if this document is updated. As of May 2022 this is the case. This may be subject to change one day, but I expect this to remain as long as the mountpoints gem will be made available here on rubygems.org.

Using the project on windows

On Linux we can simply use "fdisk -l" and this should work fine. If fdisk is not available then df may suffice. (Since as of the rewrite in May 2022 the mountpoints gem now defaults to df on linux, actually.)

On Windows we have to use another way. I picked wmic.

Usage example for wmic:

wmic logicaldisk where "drivetype=3" get DeviceID

This then gets parsed and the last line is assumed to be the currently inserted USB harddisc. This evidently may break for many use cases, in particular when there are several USB devices mount, which is why I document this here - but for my own simple use cases this actually works, and I verified that this indeed does work for simple use cases.

In *May 2022 two ad-hoc methods were added called:

Mountpoints.windows1
Mountpoints.windows2

These will run the corresponding wmic commands via `` backticks as well as output the command that is run.

Regular users won't really need to run this, but in the event that something isn't right you can use these two methods conveniently. It's mostly for debugging, though, so most users will not need to run this.

Contact information

If your creative mind has ideas and specific suggestions to make this gem more useful in general, feel free to drop me an email at any time, via:

shevy@inbox.lt

Before that email I used an email account at Google gmail, but in 2021 I decided to slowly abandon gmail for various reasons. In part this is because the UI annoys me (on non-chrome browser loading takes too long), but also because of Google's attempt to establish mass surveillance via its federated cohorts sniffing (FLoC). I do not know what happened at Google, but enough is enough - there is only so much you can take while supporting greed. When it comes to data mining done by private groups, ultimately the user became the product.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment, due to reallife time constraints. I will, however had, read feedback eventually. Patches and code changes are welcome too, of course, as long as they are in the spirit of the project at hand, e. g. fitting to the general theme. For this I may make use of github as a discussion site, but this has a low priority right now.