Autor: Didier Kryn Fecha: A: dng Asunto: Re: [DNG] Premounting a partition other than /usr
Le 21/09/2024 à 13:06, Ralph Ronnquist via Dng a écrit : > On Sat, Sep 21, 2024 at 12:41:11PM +0200, Didier Kryn wrote:
>> Le 20/09/2024 à 22:56, Ralph Ronnquist via Dng a écrit :
>>> On Fri, Sep 20, 2024 at 08:08:08AM -0700, Marc Shapiro via Dng wrote:
>>>> Several years ago I was trying to premount a separate partition for
>>>> /lib/modules. I have multiple releases bootable on the system and I wanted
>>>> a single place to store the modules, since they can take up a lot of disk
>>>> space.
>>>>
>>>> I tried everything that I could think of, or find online, but nothing
>>>> worked. I gave up on it, then, all of a sudden, it was premounting! The
>>>> odd thing is that it is NOT being done the same as /usr (in
>>>> /usr/share/initramfs-tools/init). In fact, since I had given up on it there
>>>> is NO entry for it at all in /etc/fstab!
>>>>
>>>> It has been this was since Daedalus, maybe since Chimaera, and is still
>>>> premounting without an /etc/fstab entry in Excalibur (although it is on
>>>> /usr/lib/modules in Excalibur).
>>>>
>>>> Does anyone have any idea how this could be happening? I'm not complaining,
>>>> since it was what I originally wanted to do, but I would like to know HOW it
>>>> is happening. Even / has to have an entry in fstab. How can this be mounting
>>>> without an entry?
>>> It's not hard to have rootfs /lib/modules mounted by initramfs init
>>> scripting or (post-pivot) startup scripting; the initramfs
>>> /lib/modules only needs to include modules to access the rootfs
>>> drive(s). Though I can't say how it's done on your system.
>>>
>> Premounting is done during initramfs init. The fstab is not available at
>> that time.
>>
>> One way is getting rid of Debian's initramfs and write your own. This
>> way you premount everything you want where you want. I recommend doing like
>> Debian for /run and /var/tmp: mount them on tmpfs. I think in this case you
>> need to get rid of the kernel packages and build your own kernel, wrapped in
>> some way with your initramfs. Alternatively you may boot into a dedicated
>> partition instead of initramfs and then switsh_root to the Debian rootfs.
>> You keep Debian for userspace only. It just takes a lot of work.
> Well, the "normal" initramfs-tools picks up custom scripting from
> /etc/initramfs-tools/scripts so you can easily inject something there.
> For example, an init-bottom/ script, which is invoked after that the
> to-be root filesystem $[rootmnt} is mounted but before switch_root,
> can add mounts below that (and it may even read the
> ${rootmnt}/etc/fstab as a guide, if it needs to be somewhat generic).
> If that mounting needs modules then those would best be in the
> initramfs /lib/modules tree.
>
> It's all sh scripting; very open and transparent. The actual /init is
> found as /usr/share/initramfs-tools/init.
Just great. Didn't know that. My experience is from 15y ago.