On the road again

The article contains an example of systemd unit which adds a file as a loop block device (can be used for LVM testing purposes).

Create "/etc/systemd/system/setup-loopback-loop0.service" file with following content:

[Unit]
Description=Setup loop0 device
DefaultDependencies=no
After=systemd-udev-settle.service
Before=lvm2-activation-early.service
Wants=systemd-udev-settle.service

[Service]
ExecStart=-/sbin/losetup /dev/loop0 /srv/disk0
RemainAfterExit=true
Type=oneshot

[Install]
WantedBy=local-fs.target

Start newly created service:

systemctl start setup-loopback-loop0

You can check that unit file is loaded:

systemctl list-unit-files --no-pager | grep loop

Check unit dependencies:

systemd-analyze --no-pager critical-chain setup-loopback-loop0.service
Add comment