1 unstable release
new 0.1.5 | Jan 15, 2025 |
---|
#141 in Operating systems
106 downloads per month
59KB
1.5K
SLoC
A command line tool to conveniently mount, unmount, (un)lock and safely power off storage devices on Linux with as few keystrokes as possible.
Uses UDisks as its backend, but may support other backends in the future (as well as other *nix systems).
See below for installation instructions.
Usage
Mounting / activating
The default action is to mount the filesystem(s) on the most recently discovered device:
$ om
Activate device:
1) /dev/sda1 My USB (12.5G)
2) /dev/mmcblk0 My memory card (116.5G)
Device [1]: ⏎
/dev/sda1: mounted at `/run/media/user/My USB`.
Devices are listed from most to least recent.
om
also supports encrypted devices:
$ om
Activate device:
1) /dev/mmcblk0 My memory card (116.5G)
Device [1]: ⏎
Passphrase to unlock /dev/mmcblk0: <REDACTED>⏎
/dev/mmcblk0: unlocked.
/dev/dm-1: mounted at `/run/media/user/My memory card`.
Unmounting / deactivating
Use om -u
to unmount, lock (if encrypted) and power off a device for
safe removal (if applicable). If symlinked to um
, running it is
equivalent to om -u
:
$ um # ...same as `om -u`
Deactivate device:
1) /dev/sdc1 My HDD (1.6T)
• /run/media/user/My HDD
Device [1]: ⏎
/dev/dm-1: unmounted.
/dev/sdc1: locked.
/dev/sdc: powered off.
Listing system devices
By default, om
hides devices considered "system". You can use the
-a
flag to include all devices in the list.
Installation
Using Cargo
Since om
is written in Rust, it can be installed using Cargo[^1]:
$ cargo install om-rs
For convenience, you may symlink om
as um
(a handy shortcut for om -u
):
$ (cd ~/.cargo/bin/ && ln -s om um)
Nix and NixOS
Using Flakes
On flake-enabled NixOS, add om
to your system flake inputs:
inputs.om = {
url = "git+https://codeberg.org/undltd/om.git";
inputs.nixpkgs.follows = "nixpkgs"; # to use your system's nixpkgs version
};
...and add om.packages.${system}.default
to
environment.systemPackages
(where ${system}
is your current system
architecture).
Alternatively, om
can be added to your profile:
$ nix profile install git+https://codeberg.org/undltd/om.git
Without flakes
On a NixOS system without flakes enabled, om
can be installed
system-wide using simply fetchTarball
(idea borrowed from
agenix):
# /etc/nixos/configuration.nix
{ pkgs, ... }:
let om = builtins.fetchTarball "https://codeberg.org/undltd/om/archive/main.tar.gz";
in {
environment.systemPackages = [
...
(pkgs.callPackage "${om}/default.nix" {})
...
];
}
Roadmap
- Figure out a an optimal approach to internationalizaition and translation of UI messages.
- Handle common errors (like device busy) inside ui instead of simply returning them from main as is.
- Investigate running on FreeBSD (currently compiles but panics because of minor UDisks implementation differences) / other BSD.
- Explore "fuzzy" non-interactive use - a way to specify the desired device on the command line upfront by providing a part of device path or label.
- A potential "auto" mode: activating / deactivating the most recent device without confirmation.
- A possible "headless" mode (e.g., for invokation by desktop keybindings) with freedesktop.org notifications on success / failure.
- Support handling LVM and other less common devices.
[^1]: Unfortunately, the package name om
is already taken on
crates.io by a discontinued /
retracted package, hence om-rs
. Nevertheless, it is preferred to
call this package om
when packaged elsewhere, since the -rs
suffix is not really meaningful.
Dependencies
~9–20MB
~294K SLoC