diff --git a/man/systemd-dissect.xml b/man/systemd-dissect.xml
index 84f4a4ab10..b0a67da594 100644
--- a/man/systemd-dissect.xml
+++ b/man/systemd-dissect.xml
@@ -206,9 +206,12 @@
Attach the specified disk image to an automatically allocated loopback block device,
and print the path to the loopback block device to standard output. This is similar to an invocation
- of losetup --find --show, but will validate the image as DDI before attaching, and
- derive the correct sector size to use automatically. Moreover, it ensures the per-partition block
- devices are created before returning. Takes a path to a disk image file.
+ of losetup --find --show --partscan, but will validate the image as DDI before
+ attaching, and derive the correct sector size to use automatically. Moreover, it ensures the
+ per-partition block devices are created before returning and attempts to enable direct IO mode, if
+ possible. Takes a path to a disk image file.
+
+ If combined with output of the block device name is suppressed.
@@ -556,6 +559,16 @@
+
+
+
+
+ If combined with , suppresses output of the used loopback
+ block device path.
+
+
+
+
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index cc538c4b92..6d238ecddf 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -101,6 +101,7 @@ static bool arg_via_service = false;
static RuntimeScope arg_runtime_scope = _RUNTIME_SCOPE_INVALID;
static bool arg_all = false;
static uid_t arg_uid_base = UID_INVALID;
+static bool arg_quiet = false;
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
@@ -181,6 +182,7 @@ static int help(void) {
" --discover Discover DDIs in well known directories\n"
" --validate Validate image and image policy\n"
" --shift Shift UID range to selected base\n"
+ " -q --quiet Suppress output of chosen loopback block device\n"
"\nSee the %2$s for details.\n",
program_invocation_short_name,
link,
@@ -329,6 +331,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "system", no_argument, NULL, ARG_SYSTEM },
{ "user", no_argument, NULL, ARG_USER },
{ "all", no_argument, NULL, ARG_ALL },
+ { "quiet", no_argument, NULL, 'q' },
{}
};
@@ -343,7 +346,7 @@ static int parse_argv(int argc, char *argv[]) {
if (r < 0)
return r;
- while ((c = getopt_long(argc, argv, "hmurMUlxa", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hmurMUlxaq", options, NULL)) >= 0) {
switch (c) {
@@ -585,6 +588,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_all = true;
break;
+ case 'q':
+ arg_quiet = true;
+ break;
+
case '?':
return -EINVAL;
@@ -1991,7 +1998,9 @@ static int action_attach(DissectedImage *m, LoopDevice *d) {
if (r < 0)
return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
- puts(d->node);
+ if (!arg_quiet)
+ puts(d->node);
+
return 0;
}