Deutsch   English   Français   Italiano  
<vqobf9$1m25v$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.sys.raspberry-pi
Subject: Re: How to boot from SD but run from US
Date: Tue, 11 Mar 2025 03:42:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <vqobf9$1m25v$2@dont-email.me>
References: <1737795373@f2060.n280.z2.fidonet.org>
	<17474966@f275.n229.z1.fidonet.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 11 Mar 2025 04:42:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="fb3f8814a23c1b5929be502852c6d2d1";
	logging-data="1771711"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18jxBlw4dqzUp4B8//LjW1U"
User-Agent: Pan/0.162 (Pokrosvk)
Cancel-Lock: sha1:oZnmZ0RFUhh1So7ynbV/HVXXBHs=
Bytes: 2531

On Wed, 26 Feb 2025 17:45:00 +1300, Dave Vandermeer wrote:

> Actually I did read somewhere that it is possible. Technically you
> only need to use the SD card to boot to init, so modify your
> /etc/fstab to change the location of your root partition to the
> device of the USB drive.

The root volume (mounted on “/”) is the one volume that cannot be
mounted/dismounted directly in the normal way on a Linux system.
Instead, the kernel offers a special system call, pivot_root(2)
<https://manpages.debian.org/pivot_root(2)>, for handling setup of the
root volume.

At boot time, the initial root volume is the contents of the initrd
(“initial RAM disk”) image loaded by the bootloader along with the
kernel. This contains, among other things, some minimal startup script
that interprets the “root=” option that was passed to the kernel as
its command line from the bootloader. At the end of initrd processing,
it finds this volume, mounts it on a temporary directory somewhere,
and uses pivot_root to swap that with the initrd root. The initrd
filesystem (which is not root any more) is now mounted on that
temporary directory and can be dismounted from it in the normal way,
and all further processing can continue with the new root filesystem
as “/”.

In a sense, the entry in /etc/fstab for the filesystem to mount on “/”
is redundant in that it can never be used: accessing it means being
able to open /etc/fstab in the first place, and you can only do that
if the proper “/” is already mounted.