Re: [systemd-devel] Reducing unmount/mount of partitions on soft-reboot

2024-03-14 Thread Lennart Poettering
On Mi, 13.03.24 16:57, Aditya Gupta (adit...@linux.ibm.com) wrote:

> Hello,
>
> I tried systemd-soft-reboot on a RHEL system, and it's amazing in terms
> of it's ability to do a userspace reboot, within fraction of time of a
> full system reboot. For example, for a Power system taking around 50
> seconds to do a normal reboot, it took around 4-5 seconds for a
> systemd-soft-reboot.
>
> I have a question on further optimisation. After soft-reboot, I notice
> much of the time is taken up by .device and .mount services. This was my
> observation based on 'systemd-analyze blame'. Please do let me know if
> I am seeing the wrong numbers, or if there's a better way to know.
>
> Is there some way to 'pass-through' these mounts ? That is, I might not
> need to unmount and remount my boot/root paritions.

Bind mount the relevant mounts from the current system into
/run/nextroot/ if you are using that.

If you are not using /run/nextroot/ then you can also define the mount
via a .mount unit (rather letting it be auto-generated via /etc/fstab
+ systemd-fstab-generator), and then set DefaultDependencies=no in it,
so that it does not get an implicit Conflicts= dependency on umount.target.

This is briefly documented on the systemd-soft-reboot.service man page btw.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] Reducing unmount/mount of partitions on soft-reboot

2024-03-13 Thread Aditya Gupta

On 13/03/24 18:09, Luca Boccassi wrote:


On Wed, 13 Mar 2024 at 12:30, Aditya Gupta  wrote:

Hello,

I tried systemd-soft-reboot on a RHEL system, and it's amazing in terms
of it's ability to do a userspace reboot, within fraction of time of a
full system reboot. For example, for a Power system taking around 50
seconds to do a normal reboot, it took around 4-5 seconds for a
systemd-soft-reboot.

I have a question on further optimisation. After soft-reboot, I notice
much of the time is taken up by .device and .mount services. This was my
observation based on 'systemd-analyze blame'. Please do let me know if
I am seeing the wrong numbers, or if there's a better way to know.

Is there some way to 'pass-through' these mounts ? That is, I might not
need to unmount and remount my boot/root paritions.

I tried finding this in available documentation, sorry if I missed it. I
did find this ability to 'pass-through' resources/file
descriptors/sockets to next boot, by modifying the service files, but
don't know how and if I can do a similar thing with mounts.

Pre-prepare the additional mounts in /run/nextroot/, after preparing
the new rootfs, so that they are ready ahead of time.


Thanks for the idea Luca Boccassi ! Makes sense.
Guess it's supported in this way then.


Thanks,

- Aditya Gupta



Re: [systemd-devel] Reducing unmount/mount of partitions on soft-reboot

2024-03-13 Thread Luca Boccassi
On Wed, 13 Mar 2024 at 12:30, Aditya Gupta  wrote:
>
> Hello,
>
> I tried systemd-soft-reboot on a RHEL system, and it's amazing in terms
> of it's ability to do a userspace reboot, within fraction of time of a
> full system reboot. For example, for a Power system taking around 50
> seconds to do a normal reboot, it took around 4-5 seconds for a
> systemd-soft-reboot.
>
> I have a question on further optimisation. After soft-reboot, I notice
> much of the time is taken up by .device and .mount services. This was my
> observation based on 'systemd-analyze blame'. Please do let me know if
> I am seeing the wrong numbers, or if there's a better way to know.
>
> Is there some way to 'pass-through' these mounts ? That is, I might not
> need to unmount and remount my boot/root paritions.
>
> I tried finding this in available documentation, sorry if I missed it. I
> did find this ability to 'pass-through' resources/file
> descriptors/sockets to next boot, by modifying the service files, but
> don't know how and if I can do a similar thing with mounts.

Pre-prepare the additional mounts in /run/nextroot/, after preparing
the new rootfs, so that they are ready ahead of time.


[systemd-devel] Reducing unmount/mount of partitions on soft-reboot

2024-03-13 Thread Aditya Gupta
Hello,

I tried systemd-soft-reboot on a RHEL system, and it's amazing in terms
of it's ability to do a userspace reboot, within fraction of time of a
full system reboot. For example, for a Power system taking around 50
seconds to do a normal reboot, it took around 4-5 seconds for a
systemd-soft-reboot.

I have a question on further optimisation. After soft-reboot, I notice
much of the time is taken up by .device and .mount services. This was my
observation based on 'systemd-analyze blame'. Please do let me know if
I am seeing the wrong numbers, or if there's a better way to know.

Is there some way to 'pass-through' these mounts ? That is, I might not
need to unmount and remount my boot/root paritions.

I tried finding this in available documentation, sorry if I missed it. I
did find this ability to 'pass-through' resources/file
descriptors/sockets to next boot, by modifying the service files, but
don't know how and if I can do a similar thing with mounts.

Thanks,
Aditya Gupta