Maximising SD Card Life 24/7

BY: mm0fmf(3:770/3)

m> I've used Pi's since as soon as I could buy them but I've never run one m> 24/7 before so I'd like to ensure I've done sufficient to maximise SD m> Card life. m> Not sure what Pi you have, but if it's a 4, have you thought about going with USB instead of SD card? I've currently got my BBS running on a RPi 4 with everything on a USB drive. 128 GB flash drive the size of my thumbnail plugged into one of the USB 3.0 ports. Works fine, and I don't have to worry about read/write cycles.

-Craig

Reply to
Craig Dooley
Loading thread data ...

BY: Tauno Voipio(3:770/3)

TV> TV> I'm just curious: What makes a Flash memory on an USB interface TV> more durable than a Flash memory on a SD card? TV> I'm not really sure. it's my understanding that SD cards will wear out because of read/write cycles eventually. I've never heard that said of a USB flashdrive. But I'm not an expert on either.

-Craig

Reply to
Craig Dooley

I've used Pi's since as soon as I could buy them but I've never run one

24/7 before so I'd like to ensure I've done sufficient to maximise SD Card life.

All this PI does is sit accepting SSH connections and acts as a gateway to allow tunnelling or SOCKS5 proxying. It also lets me send WOL magic packets to other local computers to wake them up so I don't need to leave those computers running 24/7. That's all working fine.

However, I'd like to maximise the SC Card life where possible so I have mounted a few places onto tmpfs to minimise writes to the card. I have a couple of cron jobs running that tickle the dynamic DNS provider and another that reboots the Pi every 24 hours as a crude and simple way of ensuring not the tmpfs log space doesn't fill.

The following are mounted onto tmpfs:

tmpfs on /tmp type tmpfs (rw,nosuid,noatime,size=102400k) tmpfs on /var/spool/mqueue type tmpfs (rw,nosuid,noatime,size=30720k,mode=700,gid=12) tmpfs on /var/tmp type tmpfs (rw,nosuid,noatime,size=30720k) tmpfs on /var/log type tmpfs (rw,nosuid,noatime,size=102400k,mode=755)

There is no swap running as all this does is SSH connection handling.

I have plenty of old small (8Gb) SD Cards to replace the one in use but I don't want to have to be copying a new one more often than needed.

Is there anything else that really needs doing or is this sufficient?

Reply to
mm0fmf

It sounds like you usage is a fit for running with the root file system readonly. If you make all the SD card filesystems readonly, then that gets rid of the problems (except things like bad contacts etc :-( )

How to get to running a readonly root filesystem depends on your setup, but I'm sure there is advice out there.

Reply to
Jim Jackson

If you can, put the root filesystem on a USB connected thumbdrive or SSD.

--
Chris Elvidge 
England
Reply to
Chris Elvidge

I meant to say it's a Pi Zero W but forgot.

Reply to
mm0fmf

I'm just curious: What makes a Flash memory on an USB interface more durable than a Flash memory on a SD card?

--

-TV
Reply to
Tauno Voipio

It's flash whether the interface is SD or USB - there is a write limit!

Reply to
Jim Jackson

I don't know.

My day job is writing semiconductor models (think QEMU-like). We've done loads of NAND, NOR, UFS, eMMC, SdCard/MMC device and controllers, MobileStorage, NVMe models for our customers with varying levels of realism. Our customers have never been keen to discuss wear levelling, it's considered commercially confidential by them and isn't released even under NDA.

Reply to
mm0fmf

Nothing in principle, except the quality and type of the flash memory (there are a lot of types) and the on-board controller. All flash memory (including SLC SSDs) are subject to write wear due to the mechanism and write amplification due to large block sizes - how quickly they wear depends on the flash technology used, the sophistication of the controller (wear levelling, TRIM etc) and the quality of manufacture. Micro SD cards tend to be towards the bottom end of everything - NVMe SSDs sold for data centre use tend to be towards the top.

USB sticks are very variable IME but the good ones are a lot better than any micro SD card.

--
Steve O'Hara-Smith                          |   Directable Mirror Arrays 
C:\>WIN                                     | A better way to focus the sun 
The computer obeys and wins.                |    licences available see 
You lose and Bill collects.                 |    http://www.sohara.org/
Reply to
Ahem A Rivet's Shot

IIRC the on-device controller on any type of SSD is a lot smarter than the ones fitted to a built-down-to-price semi-disposable SD card, and one place this shows up is in dealing with card wear, i.e EEPROM ageing defects. I don't think any SD card can remove a bad memory page from the active pages map and replace it with one of the spares - something most SSDs can do - because for starters SD memory pages are relatively large (4Kb?) and pricing says they don't have any list of spare pages or a controller that could handle remapping.

I'm told that the better (enterprise grade) SSDs will drop into read-only mode when they find a prefefined unfixable number of defects. This means the data content can be retrieved without errors. Lower spec SSDs and all SD cards will merrily go on writing data well past that point.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

SSDs wear out too - eventually - just the same as an HDD. The difference is that SSDs data pages (a) survive many more read/zero/write cycles than those in SD cards and (b) have a set of spare data pages that can be remapped to replace failing ones. Cheap as chips SD cards don't do this either.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

Dana Sat, 20 Mar 2021 11:42:38 +1300, Craig Dooley napis'o:

I've got few of USB flash drives that died. Or got read only.

Reply to
Nikolaj Lazic

I haven't got a singe failed one, and my oldest (still in use) is a massive

128M - from the days when that was the biggest you could get!

I particularly like that it has a mechanical write protect switch and slim but tough case. I can't tell you the make - all the writing has long since worn away!

--
W J G
Reply to
Folderol

Thanks. I found an article from 2016 about making root read only FS for a Pi. I'll give that a test run tomorrow and see how it goes.

Reply to
mm0fmf

The "PiCore" version of Tiny Core Linux runs on the Pi with the core system entirely in RAM. It should be possible to have that boot from a read-only partition, though it might be easiest to remount it read-only after booting to avoid modifying the boot scripts.

By remastering PiCore with all your required software "built-in" it would be possible to run everything in RAM and unmount the SD card entirely after boot.

--
__          __ 
#_ < |\| |< _#
Reply to
Computer Nerd Kev

I wouldn't worry about it. I have 10 Pi zeros working 24/7 as CCTV cameras. Each day they record between 1-5GB of new images recovering space by removing images that are a few days old. The SD cards (32GB) wear out every 3 or 4 years.

--
Nev 
It causes me a great deal of regret and remorse 
that so many people are unable to understand what I write.
Reply to
nev young

Andy, it's possible that you're worrying needlessly.

I have 25 RPi cards here, some since the RPi was first released - and (touch wood) SD card wear-out hasn't been an issue. Many are doing very little, and those supporting the Pi-Star software (DMR hotspots) do have the system running mostly read-on (that's built into the Pi-Star software). I'm not using any programs which drive the system into paging.

For one that's doing APT weather satellite reception and regularly creating image data I do have a 128 GB USB stick for storing that data, specifically to reduce wear on the SD card. The only other thing I do these days is to buy as big an SD card as I can. That's 32 GB now (I don't know whether the RPi or the PC I use for imaging would take 64 GB).

I suspect that unless you are repeatedly writing a "lot" of data, or needing to page, there's no need to worry.

73, David GM8ARV
--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

Me too. (Me, Two!)

Used on RPI as "larger storage", both went read-only in action.

The first one did not survive a reboot, and became a Teflon drive. A non-stick. Not a USB memory device at all. It just went away.

The other was still readable to recover from, on a PC, but was discarded after!

Currently on 2nd SD card and 3rd USB stick.

There is no magic to USB drives that means "they don't wear out".

--
--------------------------------------+------------------------------------ 
Mike Brown: mjb[-at-]signal11.org.uk  |    http://www.signal11.org.uk
Reply to
Mike

Another interesting solution to try. I have been using various flavours of Debian since 2003 so Raspbian on the Pi just feels the same. But this again sounds like it's worth doing.

Reply to
mm0fmf

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.