Linux command
systemctl-mount-image 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Mount
systemctl mount-image [unit] [/path/to/image] [/path/in/unit]
Example
systemctl mount-image [unit] [/path/to/image] [/path/in/unit] root:ro,nosuid
Create
systemctl mount-image --mkdir [unit] [/path/to/image] [/path/in/unit]
Example
systemctl mount-image --read-only [unit] [/path/to/image] [/path/in/unit]
说明
systemctl mount-image mounts a disk image file into a running unit's mount namespace. This is only supported for units running with their own mount namespace (using RootImage=, PrivateMounts=, etc.). Added in systemd 248. The image is dissected using systemd's Discoverable Disk Image (DDI) support, automatically finding and mounting the appropriate partitions. Partition names and mount options can be specified after the path using the `PARTITION:OPTIONS` syntax.
参数
- --mkdir
- Create destination directory if it doesn't exist
- --read-only
- Mount the image read-only
- --no-block
- Do not wait for the operation to complete
FAQ
What is the systemctl-mount-image command used for?
systemctl mount-image mounts a disk image file into a running unit's mount namespace. This is only supported for units running with their own mount namespace (using RootImage=, PrivateMounts=, etc.). Added in systemd 248. The image is dissected using systemd's Discoverable Disk Image (DDI) support, automatically finding and mounting the appropriate partitions. Partition names and mount options can be specified after the path using the `PARTITION:OPTIONS` syntax.
How do I run a basic systemctl-mount-image example?
Run `systemctl mount-image [unit] [/path/to/image] [/path/in/unit]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --mkdir do in systemctl-mount-image?
Create destination directory if it doesn't exist