Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vmvuej$26rno$4@dont-email.me>
Deutsch   English   Français   Italiano  
<vmvuej$26rno$4@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: The Natural Philosopher <tnp@invalid.invalid>
Newsgroups: comp.sys.raspberry-pi
Subject: Re: How to boot from SD but run from USB?
Date: Fri, 24 Jan 2025 11:44:19 +0000
Organization: A little, after lunch
Lines: 90
Message-ID: <vmvuej$26rno$4@dont-email.me>
References: <nfra6l-cif1.ln1@q957.zbmc.eu> <vmvm45$25d2c$1@dont-email.me>
 <QCn*CFn5z@news.chiark.greenend.org.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 24 Jan 2025 12:44:19 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5af49c680f799441de4f1696bcbc9123";
	logging-data="2322168"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+xpcaXbzW6vwlT7YV7nCd33MoLyKSlg54="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:MoBZVWTtLboQ667MJsDacUjyKxs=
Content-Language: en-GB
In-Reply-To: <QCn*CFn5z@news.chiark.greenend.org.uk>
Bytes: 4590

On 24/01/2025 09:37, Theo wrote:
> The Natural Philosopher <tnp@invalid.invalid> wrote:
>> On 23/01/2025 22:12, Chris Green wrote:
>>> Is it simply a matter of leaving /boot on the SD card and changing /
>>> to being a USB drive or does one need to edit something in /boot
>>> somewhere?
>>
>> AFAICR what you do is simply edit a file and tell it that / is not where
>> it thinks it is
>>
>> But it depends on exactly what you want to happen
>>
>> The boot process is as follows (I think: Others will correct If I've got
>> it wrong)
>>
>> The  Pi firmware looks on the SD card for a Vfat partition, and in there
>> is a file called cmdline.txt
>>
>> e.g.
>> console=serial0,115200 console=tty1 root=PARTUUID=778a9e44-02
>> rootfstype=ext4 fs
>> ck.repair=yes rootwait noswap=1
>>
>> That file tells the boot loader wher the root directory is to be found
>> that it is to  grab the kernel off
> 
> Not quite.  If you do it this way, the kernel comes from the SD card and the
> cmdline is the *kernel* command line, ie it tells that kernel where to find
> its root FS once it has started.  That means you need to ensure that the
> kernel on the SD card remains updated, because any kernel on USB storage
> will be ignored.
> 
Oh yes, you are right there. If you only adjust that line, you will 
still have the fstab on the USB drive mounting the SD boot partition in 
/boot/firmware.  So the kernel will get updated OK automagically.

It is however needlessly messy which is why I went all USB/SSD and 
ditched the SDcard.



> If you did that way, you could set it up with just a FAT /boot partition on
> the SD and then your ext4 rootfs on USB, and adjust the cmdline and
> /etc/fstab to match.  That way any updates would deploy the SD card /boot.
> 
Yes. Exactly.
> However if you ever want to re-image your rootfs you have to remember that
> you also need to re-image your SD and set up this arrangement again.
> Otherwise you'd be booting old kernels from SD with your new USB rootfs.
> 
> By using bootcode.bin only on SD (something I've not tried), you can use
> standard OS images on your USB without any changes.
> Or you could boot direct from USB on those Pis that support it with no SD.
> 

Ultimately, that is IMHO the better approach. As long as the Pi can 
recognise and boot from USB, leave the SD card out altogether.,

IIRC the most successful approach was in the end, for me, to simply 
install raspios on the USB drive  and forget the SD card altogether.

Later Pis are perfectly happy to try the SD card like an old PC trying a 
floppy drive, to boot, but on failure simply look at the USB drives.

And the fact that the boot process uses PARTUUID rather then physical 
devices means its agnostic between SDCARD and USBdrive.

The only change I made somewhere was to stop the Pi endlessly trying to 
access the SDcard that was no longer there.

in /boot/firmware/config.txt

#since we are booting from SSD
# disable constant SD scan
# We wouldn't be here on an SD card boot

dtparam=sd_poll_once

I really do advise people not to try and split between SDcard and USB. 
Just install the OS on the USB to start with.

It works with later pis automatically

-- 
"Anyone who believes that the laws of physics are mere social 
conventions is invited to try transgressing those conventions from the 
windows of my apartment. (I live on the twenty-first floor.) "

Alan Sokal