summaryrefslogtreecommitdiffstats
path: root/src/storagetm (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use isatty_safe() moreLennart Poettering2024-08-201-2/+2
|
* storagetm: add --list-devices commandLennart Poettering2024-07-011-4/+15
|
* tree-wide: Use log_setup() everywhereDaan De Meyer2024-04-251-3/+1
| | | | | Otherwise the default log target is the console and we won't use the journal socket even if it is available.
* tree-wide: refuse enumerated device with ID_PROCESSING=1Yu Watanabe2024-04-041-1/+4
| | | | | | When enumerated devices are being processed by udevd, we will receive corresponding uevents later. So, we should not process devices in that case.
* Merge pull request #30700 from yuwata/storagetm-fixletsYu Watanabe2024-01-031-3/+4
|\ | | | | storagetm: several trivial fixlets
| * storagetm: fix use of wrong stat elementYu Watanabe2024-01-021-1/+1
| |
| * storagetm: always hash stat.st_modeYu Watanabe2024-01-021-2/+3
| | | | | | | | To make the hash function consistent with the compare function.
* | storagetm: ensure we pass dev_t* to sd_device_get_devnumMike Gilbert2024-01-021-2/+12
|/ | | | | | | | | On MIPS32 OABI, st_rdev is unsigned long, not dev_t. Use a temporary variable to avoid an incompatible pointer. Bug: https://bugs.gentoo.org/920576 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21278 Fixes: https://github.com/systemd/systemd/issues/30626
* siphash24: introduce siphash24_compress_typesafe() macroYu Watanabe2023-12-251-3/+3
| | | | | | | | To prevent copy-and-paste mistake. This also introduce in_addr_hash_func(). No functional change, just refactoring.
* various: clean up isatty() handlingMike Yuan2023-12-221-2/+2
| | | | As per https://github.com/systemd/systemd/pull/30547#discussion_r1434371627
* storagetm: use path to device node instead of devpathYu Watanabe2023-11-141-2/+3
| | | | | | | | | | | | To make the generated IDs equivalent when - sd_device object is not provided, - sd_device object is provided, but it does not have ID_SERIAL. Follow-up for abc19a6ffaa94893ffc40cc000e5bb4437f67656. This also fixes missing voidification. Fixes CID#1524253.
* storagetm: expose more useful metadata for nvme block devicesLennart Poettering2023-11-131-4/+148
| | | | | | don't let the devices to be announced just as model "Linux". Let's instead propagate the underlying block device's model. Also do something reasonably smart for the serial and firmware version fields.
* storagetm: show connection data also via plymouthLennart Poettering2023-11-131-5/+56
| | | | Pretty!
* storagetm: add new systemd-storagetm componentLennart Poettering2023-11-022-0/+1058
This implements a "storage target mode", similar to what MacOS provides since a long time as "Target Disk Mode": https://en.wikipedia.org/wiki/Target_Disk_Mode This implementation is relatively simple: 1. a new generic target "storage-target-mode.target" is added, which when booted into defines the target mode. 2. a small tool and service "systemd-storagetm.service" is added which exposes a specific device or all devices as NVMe-TCP devices over the network. NVMe-TCP appears to be hot shit right now how to expose block devices over the network. And it's really simple to set up via configs, hence our code is relatively short and neat. The idea is that systemd-storagetm.target can be extended sooner or later, for example to expose block devices also as USB mass storage devices and similar, in case the system has "dual mode" USB controller that can also work as device, not just as host. (And people could also plug in sharing as NBD, iSCSI, whatever they want.) How to use this? Boot into your system with a kernel cmdline of "rd.systemd.unit=storage-target-mode.target ip=link-local", and you'll see on screen the precise "nvme connect" command line to make the relevant block devices available locally on some other machine. This all requires that the target mode stuff is included in the initrd of course. And the system will the stay in the initrd forever. Why bother? Primarily three use-cases: 1. Debug a broken system: with very few dependencies during boot get access to the raw block device of a broken machine. 2. Migrate from system to another system, by dd'ing the old to the new directly. 3. Installing an OS remotely on some device (for example via Thunderbolt networking) (And there might be more, for example the ability to boot from a laptop's disk on another system) Limitations: 1. There's no authentication/encryption. Hence: use this on local links only. 2. NVMe target mode on Linux supports r/w operation only. Ideally, we'd have a read-only mode, for security reasons, and default to it. Future love: 1. We should have another mode, where we simply expose the homed LUKS home dirs like that. 2. Some lightweight hookup with plymouth, to display a (shortened) version of the info we write to the console. To test all this, just run: mkosi --kernel-command-line-extra="rd.systemd.unit=storage-target-mode.target" qemu