ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Long-term booting from USB/SSD/SD card

Mon Jun 22, 2020 7:32 am

Hi all,

I have had a network of remote RPi Zero's running for a little over three years now, all running Raspbian, booting from microSD cards.
They are slowly dying of old age (files are randomly becoming corrupted; only three of the original ten systems remain online, with most of them having died since in the last few months).

All the files my software is creating are all saved into a tmpfs to minimise SD card wear, but understandably there is a limit to their lifespan, and it seems (under my current usage) that it's about three years for the SD cards I'm using (SanDisk ones... top of the line that money could buy back when I set them up in mid 2017).

I am now developing a next-generation system based on the RPi4B, which I understand has recently been updated to support USB booting (or it's in beta, or it's coming soon). In any case, I was interested in this alternative to booting from an SD card from a durability perspective as one of my goals for this next-gen system is a lifespan of at least five years.

I did an admittedly-quick Google and found this thread comparing the speeds of USB stick vs SD card vs USB SSD, but it's several years old, and is focused on speed rather than longevity.

I understand that there is limited knowledge of the RPi4's longevity due to the fact it's new hardware, but in general (based on earlier RPi models and SD/SSD hardware), can I expect longer life by booting Raspbian from a USB3 SSD instead of from a microSD card?

And besides having a tmpfs for my own scripts to be stored in (and for their output to be saved to prior to data upload to my server), is there anything else I can do to maximise system lifespan? e.g. can OS logs and log files for other software that may be running in the background be diverted to the tmpfs as well (or is an SSD fault-tolerant enough that this won't be worth bothering with?)?

Thanks in advance for any advice.
David

epoch1970
Posts: 6034
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Long-term booting from USB/SSD/SD card

Mon Jun 22, 2020 9:54 am

Raspi-config has a read only overlay filesystem option now.
The whole root filesystem gets mapped to RAM for writes.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Long-term booting from USB/SSD/SD card

Tue Jun 23, 2020 1:09 am

epoch1970 wrote:
Mon Jun 22, 2020 9:54 am
Raspi-config has a read only overlay filesystem option now.
The whole root filesystem gets mapped to RAM for writes.
Ah, thanks. That's good to know.

xio15
Posts: 31
Joined: Fri Aug 21, 2020 4:52 pm

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 5:54 pm

I am interested too in increasing the longevity of my setup mainly because I need uninterrupted operation if possible. My headless RPi 4B, 8GB RAM, 32GB microSD will be sitting quietly doing its work. Lock2ram looks interesting and seems to work OK for now. It seems that SD cards failing after a year isn't uncommon.

I have been considering a USB stick or an SSD for longevity, but it is an uncharted territory for me at least. Is there anything else people do? I am not sure how the tmpfs thing or the overlay filesystem option, but I will check.

In the meanwhile, how do you create a mirror image of the bootable microSD? I am thinking that having a regularly refreshed, near-identical copy (system and data) may allow for a quick swap and reboot when the card eventually fails, minimising downtime. Is there a way to create the mirror copy from within running Raspbian (again to minimise disruption)?

W. H. Heydt
Posts: 14376
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 6:08 pm

xio15 wrote:
Sun Aug 30, 2020 5:54 pm
I have been considering a USB stick or an SSD for longevity, but it is an uncharted territory for me at least. Is there anything else people do?
I've been running the root file system from a WD PiDrive HDD since those were launched in March 2016, and converted to a full USB MSD boot when that became possible on a Pi3B. The drive has remained through system version updates and is now doing USB MSD booting for a Pi4B2 running (obviously) RPiOS Buster.

User avatar
HawaiianPi
Posts: 6210
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 7:10 pm

ZPMMaker wrote:
Mon Jun 22, 2020 7:32 am
... can I expect longer life by booting Raspbian from a USB3 SSD instead of from a microSD card?
Yes, an SSD is engineered to be a system drive. SD cards are not.

In fact, many SD card makers will void your warranty if they see that you have used your card as a system drive. However, there are "High Endurance" micro SD cards designed for high write environments, which should last longer in an SBC, but those cards tend to offer less performance.

The small size and lean power requirements of SD cards also limits what can be put into them, so things like large RAM caches for storing data and look-up tables, and other performance and longevity enhancing features you'll find in many SSD models are not present in SD cards.

ZPMMaker wrote:
Mon Jun 22, 2020 7:32 am
And besides having a tmpfs for my own scripts to be stored in (and for their output to be saved to prior to data upload to my server), is there anything else I can do to maximise system lifespan? e.g. can OS logs and log files for other software that may be running in the background be diverted to the tmpfs as well (or is an SSD fault-tolerant enough that this won't be worth bothering with?)?
Yes, you can do that. I often put /tmp and /var/log in tmpfs (and sometimes /var/tmp as well), but some software might not be happy with it. Software shouldn't depend on any /tmp file system persisting after reboots, but I have run into trouble with some applications. And of course /var/log being non-persistent could make troubleshooting more difficult. All of that needs to be taken into consideration when deciding if it's worth bothering with.

There's also F2FS, a file system specifically designed for flash memory devices.

EDIT
Going from a Pi Zero+SD card to a Pi4B+SSD solution is quite a drastic change in terms of size, cost and power consumption. If increased performance is not your goal, then perhaps a high endurance SD card would be a better option.

Also, it is possible to boot a Pi Zero from USB by placing just the bootcode.bin file on an SD card. The card doesn't even have to be mounted to the filesystem, and isn't written to at all, so it's not subject to any wear. I have booted Pi Zero models from SSD just for fun, so I know it can be done.

PERFORMANCE
There is absolutely no comparison in performance on the Pi4B's USB 3.0 ports. An SSD will utterly clobber any SD card or USB flash drive (that isn't an SSD itself).

If performance is your goal then SSD is definitely the way to go. But don't bother with expensive NVMe drives and enclosures, you will just spend more and gain nothing (yes, I have tested it). Get a good SATA-III SSD and adapter or enclosure, like a Crucial MX500 or Samsung 860 EVO SSD and the Eluteng USB 3.0 adapter cable.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

HvdW
Posts: 183
Joined: Tue Jun 17, 2014 12:41 pm

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 8:01 pm

For what it's worth my experience.
RPI 3B+ running on an old 2010 OCZ Vertex 60G SSD which had been replaced on my windows computer a long time ago and was filling up space in a drawer.
Copying done with RPI-clone, fast and easy.
Although USB 2.0 it is still running at much faster speed than on SD.
Happy having made the choice to switch.

PS Explanation can be found here and testing can be found here..
Last edited by HvdW on Mon Aug 31, 2020 8:18 am, edited 4 times in total.
Who knows knows
Who doesn't doesn't

User avatar
HawaiianPi
Posts: 6210
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 8:09 pm

HvdW wrote:
Sun Aug 30, 2020 8:01 pm
Although USB 2 it is still running at much faster speed than on SD.
This is because an SSD will have much higher random IOPS than a micro SD card, and that is apparent even over USB 2.0 (I also have some Pi3 models running from SSD).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

xio15
Posts: 31
Joined: Fri Aug 21, 2020 4:52 pm

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 11:07 pm

xio15 wrote:
Sun Aug 30, 2020 5:54 pm
I am interested too in increasing the longevity of my setup mainly because I need uninterrupted operation if possible. My headless RPi 4B, 8GB RAM, 32GB microSD will be sitting quietly doing its work. Lock2ram looks interesting and seems to work OK for now. It seems that SD cards failing after a year isn't uncommon.

I have been considering a USB stick or an SSD for longevity, but it is an uncharted territory for me at least. Is there anything else people do? I am not sure how the tmpfs thing or the overlay filesystem option, but I will check.

In the meanwhile, how do you create a mirror image of the bootable microSD? I am thinking that having a regularly refreshed, near-identical copy (system and data) may allow for a quick swap and reboot when the card eventually fails, minimising downtime. Is there a way to create the mirror copy from within running Raspbian (again to minimise disruption)?
EDIT: That was log2ram actually.

RonR
Posts: 1975
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 11:35 pm

ZPMMaker wrote:
Mon Jun 22, 2020 7:32 am
can I expect longer life by booting Raspbian from a USB3 SSD instead of from a microSD card?

FWIW...

My Windows computer has been running 24/7/365 (heavy usage) from a C: drive consisting of two Samsung SSD's in RAID mode for well over 10 years now with no signs of aging. The motherboard, case, power supply, and other components have been updated a couple of times in that span, but the SSD's just keep chuggin'. YMMV, of course.

W. H. Heydt
Posts: 14376
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Long-term booting from USB/SSD/SD card

Sun Aug 30, 2020 11:38 pm

One other factor that doesn't get brought up enough...until it's a problem. When selecting an SSD to use with a Pi, pay close attention to the power requirements. There are some SSDs out there that will draw a surprisingly high current, well beyond the spec for the USB ports on a Pi.

That was a significant factor in my choice of HP S600 SSDs. Their peak current is on the order of 300mA.

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Long-term booting from USB/SSD/SD card

Sat Sep 05, 2020 2:01 am

Thanks everyone for the tips. I ended up doing some testing myself and figured out a USB-C SSD was sufficient (ended up using Samsung T5s).

I don't necessarily need high-speed (although that would be beneficial); I just need longevity.

I'm using the Pi 4B because I am also doing deep learning inferences (detecting objects in photos taken by the RPi camera) and a bunch of other data-intensive things, so need some processing grunt that the RPi Zero can't provide. I'm building the systems to have enough battery power for a week, and big-enough solar panels to suit.

Thanks again for the advice.
Last edited by ZPMMaker on Sat Sep 05, 2020 6:42 am, edited 1 time in total.

User avatar
AkulaMD
Posts: 150
Joined: Fri Jun 19, 2020 6:51 am

Re: Long-term booting from USB/SSD/SD card

Sat Sep 05, 2020 4:27 am

HvdW wrote:
Sun Aug 30, 2020 8:01 pm
For what it's worth my experience.
RPI 3B+ running on an old 2010 OCZ Vertex 60G SSD which had been replaced on my windows computer a long time ago and was filling up space in a drawer.
Copying done with RPI-clone, fast and easy.
Although USB 2.0 it is still running at much faster speed than on SD.
Happy having made the choice to switch.

PS Explanation can be found here and testing can be found here..
I'm using the SD Card Copier that come with RP OS for that same purpose. So far everything working just fine.
Raspberry Pi OS (32-bit) with desktop and recommended software
Raspberry Pi 4 Model B 8GB at stock speed (never overclock)

Never overclock your Pi.
Encourage optimization instead.

Seeking Sooth
Posts: 85
Joined: Sun Aug 23, 2020 7:03 pm

Re: Long-term booting from USB/SSD/SD card

Sat Sep 05, 2020 7:40 pm

SSDs are much more stable and long term. I use the Samsung T7. I really have no idea if its the best option but it seems to work.

I am a little disappointed with the data path to the processor for an ssd on USB. Too much is shared with other USB3 devices.

I hope the next pi is designed with a dedicated data path to at least one SSD drive.

The RockPi 4c seems to have a dedicated path but of course its a different beast and it only has 4gb memory.

Whatever you do, try to affix the drive so I doesn't wiggle around too much and stress the connections.

User avatar
rpdom
Posts: 18124
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Long-term booting from USB/SSD/SD card

Sat Sep 05, 2020 7:52 pm

Seeking Sooth wrote:
Sat Sep 05, 2020 7:40 pm
I am a little disappointed with the data path to the processor for an ssd on USB. Too much is shared with other USB3 devices.
It's a very considerable improvement on previous Pis with USB2 shared with the Ethernet interface.
Unreadable squiggle

ZPMMaker
Posts: 111
Joined: Sun Aug 23, 2015 11:04 am
Location: Australia

Re: Long-term booting from USB/SSD/SD card

Sun Sep 06, 2020 1:06 am

Seeking Sooth wrote:
Sat Sep 05, 2020 7:40 pm
Whatever you do, try to affix the drive so I doesn't wiggle around too much and stress the connections.
Yep, it's all inside an enclosure, with each item/PCB all secured in place so there can be no movement at all. :)

Return to “General discussion”