Swapping from micro-SD card to SSD - better for RAM?

Hello :slight_smile:

I’m running Yunohost on a Raspberry Pi 3, which has 1 GB of RAM.
As far as I know, the RAM is read & written to the micro-SD card that Yunohost boots up from, and where the / (root) folder is.

I recently bought a brand-new 1 TB solid state drive and have it connected via USB, with my yunohost.app folder mounted and bound to it so that the apps run from, and write data to, the SSD instead of the micro-SD card.

I have a few questions.

  1. Would the SSD be a better (more durable) device from which to boot and run Yunohost entirely and to read/write RAM than the micro-SD card?

  2. If so, is there a way to move/copy/transfer everything that’s on the micro-SD card to the SSD, or…

  3. Would a fresh install be better, if I make the SSD into a ‘live’ system and install Yunohost there instead? I’m aware this would require resetting my noho.st domain by asking in the thread on the forum.

Or… just leave everything alone(!)? :laughing:

Why would this be the case ?
For the swap, alright, but RAM ??

If you’re short in RAM, have you considered using zram to compress RAM used (it create a “swap” in the RAM, and it can give you up to 2 to 3 times more available “RAM” for limited CPU cost). That would probably better for performances than using physical swap, even on an SSD.

YES. Without any doubt. SD card are not reliable, fallible and error-prone. They can die without warning at anytime.

You could use dd command to copy one filsystem to the other, then you will need to extend the partition (from the raspberry pi or your desktop with gparted).

You might need to change a config file to make it boot from USB, I don’t remember the procedure.

1 Like

Maybe “as far as I know” isn’t very far :wink:
Where is the RAM normally written to on a Raspberry Pi 3?

I am reinstalling Yunohost on my server today so that it all runs from the SSD.

It is read from and written to… the RAM chip.
Are you sure you are not confusing between RAM and swap, as Lapineige suggests?

maybe that page can be usefull, I had this problem because my ssd case does nt support the USB Attached SCSI Protocol (UASP) and I had to disable it editing a config file in the kernel.
(I am using a rpi4 with 1TB HDD btw, it’s much better than with the micro SD)

I am trying to install from the SSD now but Yunohost is not booting up. I’m on a Raspberry Pi 3 and used dd to flash 2022-12-06-yunohost-lite.img available in a .zip file from build.yunohost.org to my SSD.
Does this .img file only work on micro-SD cards, or is there something else I am missing?

It works from SD cards.
But the Raspberry Pi might not be configured to boot from anything else than the SD card. I don’t have a link with me, but you might search for a tutorial about “booting from external drive” on a Raspberry Pi. If I remember well you have to change an option in raspi-config utility, from the command line (it gives you a graphical interface).

Ah, sorry, I found one and forgot to update the thread – Raspberry Pi 2B v1.2, 3A+, 3B, 3B+ et 4 : Tout migrer sur un SSD (plus de carte SD!)
I’ve managed to get it working, now just need to wait for my domain’s dynamic DNS to be reset. :slight_smile:

1 Like

Speaking of RAM/swap usage and storage devices, I’ve seen people say that Nextcloud requires a lot and can wear down micro-SD cards especially. Could someone clarify please - is it specifically reading/writing data to Nextcloud (or wherever) that causes this, or is it simply having Nextcloud installed that has an effect? Or both?

Nextcloud is indeed creating an high load on storage read/write (I don’t know the details), and often SD card are too slow to use it with enough confort (the app is lagging, slow to react…).
But I don’t know if it’s particularly and issue regarding SD card lifespan… but I would bet on it, they wear quite suddenly sometimes after too much writing…

I also suppose it’s using Nextcloud in general, as it will make a lot of reads to the database and storage space. Just having it installed but not used should not create a serious load on the storage.

Zram on a Pi: Using zram with the Raspberry Pi - Pi My Life Up will use more CPU.

Yes, but it’s very limited (in particular with lz4 compression, a bit less with Zstandard), and probably fairly worth it compared to the performance loss due to swapping. It is on a raspberry pi 4 at least (but it’s quite more powerful).
You might wanna check if your thermals are good now, as if it doesn’t cool correctly during light load that might (slightly) increase the issue, but that should not be a big deal.

1 Like

Thank you, I may try zram on my old “Raspberry Pi 3 Model B Rev 1.2”.

1 Like