raspme
Posts: 4
Joined: Thu Mar 31, 2016 8:32 pm

PI3 microSD and wear leveling

Thu Mar 31, 2016 9:04 pm

Hi all,
I'm new to this forum and Raspberry PI and I'm thinking of using a PI 3 and Raspbian to replace my old home web server.
It will be used for home automation (mysql, PHP, apache) and as a FTP server for a few video camera recording (movement only).
As there will be quite an amount of data written to the card, I've searched and did not found any microSD with explicit wear leveling. The best I found so far are:
- Transcend High Endurance and Transcend Ultimate. These models use MLC chips (and even high quality MLC for the high endurance model), and error correction.
- Sandisk Extreme and Extreme Pro. Although not much detail... On Sandisk website, the SD sized card has explicit wear leveling, but no indication for the microSD card.
Do these cards works well in 64GB capacity?
I've also read it's possible to change filesystem type to a better one optimized for SD memory. Which one would you recommend, and do you have any good tutorial?
In this case, is it best to buy one of these 64GB, or more classic but bigger capacity 128GB one? (but it's hard to avoid the TLC ones as its never indicated).
Thanks for you help!
Regards

richc.us
Posts: 1
Joined: Thu Mar 31, 2016 10:54 pm

Re: PI3 microSD and wear leveling

Thu Mar 31, 2016 11:04 pm

I've been running the Pi2 as an LAMP server and with a few ticks from a camera for a little while using the 64GB Samsung EVO microSD. No problems using so far. I'm in the midst of trying to clone the card to a 64GB Samsung EVOplus to put in a new Pi3 but haven't had success with the first attempt ... although Pi3 boots with Raspian on a 16GB card.

evilkitty
Posts: 370
Joined: Tue Apr 15, 2014 11:39 pm

Re: PI3 microSD and wear leveling

Fri Apr 01, 2016 11:03 am

Personally i use G.Skill cards on my Pi's, largest card i use is a 32gb though, i used there class 6 16gb card on my B r2 board running as a server for a couple months shy of 2 years, never once got corrupted even with a power supply that was on a little under 4.75v with a load from time to time

i upgraded to a class 10 32gb card and a B+ board recently and got a 2A supply from thepihut
you can do all your frequent writes on a flash drive or usb hdd, you could put only the boot partition on the sd card
i use a ram disk for temporary data (very frequent writes)

i did do stuff to minimize writes like turning off logging in apache2
My Pi Server: http://imgur.com/a/6xIUI | Thermostat: http://imgur.com/a/4LVnT

drgeoff
Posts: 9344
Joined: Wed Jan 25, 2012 6:39 pm

Re: PI3 microSD and wear leveling

Fri Apr 01, 2016 2:58 pm

The only difference between SD and micro-SD cards of the same technology, capacity and manufacturer is the form factor. The innards are the same.

raspme
Posts: 4
Joined: Thu Mar 31, 2016 8:32 pm

Re: PI3 microSD and wear leveling

Fri Apr 01, 2016 9:28 pm

Thanks for your answers.
I wasn't sure microSD had the same wear leveling as SD card has. If it's the case, I can just use classic linux FS (EXT3, EXT4, XFS...) :-)
Do all 64GB cards works with PI2 or PI3? I don't like Samsung cards as I'm pretty sure they use some TLC cells (as their SSD do). For safety, I prefer the transcend ones, which clearly indicates MLC cells when used.
Clearly it's better to set /var/log in ramdisk to minimize writes.

I still hesitate with a more classic low power system such as a Celeron J1900 with an SSD which can also host some VM. I don't konw what the processing power difference compares.

Is the Raspian distribution reliable and secure (security corrections quickly available) compared to a x86 distribution?
Does it work reliably 24/7/365?

evilkitty
Posts: 370
Joined: Tue Apr 15, 2014 11:39 pm

Re: PI3 microSD and wear leveling

Fri Apr 01, 2016 11:17 pm

I run both of my pi's 24/7/365.25, only down time has been a result of power outages, large scale hardware changes, or a software change that requires a reboot, like enabling a D18B20, large scale software change (clean install upgrade to jessie)
i how have a battery backup for my pi server, which seems to keep it running for around 3.5 hours if the power goes out (also runs Internet/phone modem, network switch, and router)

as long as you are not using rasbian wheezy which is EOL you will get security updates
i suggest installing unattended-upgrades so you don't have to bother with updates
the larger the capacity of a card the more total endurance it will have, given MLC > TLC at the same capacity, i would doubt 16gb MLC > 64GB TLC
I would expect 16GB MLC to last as long as 21.3GB TLC in theory, but i could be wrong

A Raspberry pi B r2 would use less than 1/2 the power a J1900 (not counting the motherboard, ram, etc)
given the performance would be high, but it would use more electricity

i would not put /var/log on a ram disk (limited ram space), i would but that on some disposable flash drive and just replace it when you expect it to fail soon
My Pi Server: http://imgur.com/a/6xIUI | Thermostat: http://imgur.com/a/4LVnT

raspme
Posts: 4
Joined: Thu Mar 31, 2016 8:32 pm

Re: PI3 microSD and wear leveling

Sun Apr 03, 2016 7:40 pm

TLC memory supports around 3 times less writes than MLC. So you would need a 48GB TLC to last as much as a 16GB MLC.
For SLC, it's even better as it can usually handle at least 50 times more writes than MLC. Sadly, finding SLC hardware is very hard.
The PI sound very interesting. The main drawback I see is the USB LAN and the lack of SATA.
How does the performance compare to an Intel x86 hardware?

evilkitty
Posts: 370
Joined: Tue Apr 15, 2014 11:39 pm

Re: PI3 microSD and wear leveling

Sun Apr 03, 2016 8:16 pm

My Pi Server: http://imgur.com/a/6xIUI | Thermostat: http://imgur.com/a/4LVnT

drgeoff
Posts: 9344
Joined: Wed Jan 25, 2012 6:39 pm

Re: PI3 microSD and wear leveling

Sun Apr 03, 2016 8:25 pm

raspme wrote: How does the performance compare to an Intel x86 hardware?
Depends on how you define performance.

In terms of raw processing power and ability to support oodles of RAM, modern x86 stuff wins easily. But for systems that don't need that, x86 is way behind in power consumption, heat generation, cost, ease of interfacing to non-USB peripherals, size, unwanted RF generation etc.


raspme
Posts: 4
Joined: Thu Mar 31, 2016 8:32 pm

Re: PI3 microSD and wear leveling

Wed Apr 06, 2016 9:20 pm

Thanks everyone for your messages.
I think this time I'll go for the J1900 with Xen.
For my next projects requiring a bit more power than Arduino, I'll think about Raspberry :-)

stevech
Posts: 144
Joined: Sun Jul 15, 2012 11:53 pm

Re: PI3 microSD and wear leveling

Thu Apr 07, 2016 6:05 am

SD cards (and other MLC NAND flash things like cameras, TVs) have a flash controller chip in addition to the NAND array.

The controller is very clever about wear leveling, bad-block remapping, and so on.

Here's one popular vendor of controller chips sold (only) to OEMs of flash devices.
http://www.phison.com/English/Main.asp

The only thing I'd worry a bit about is a flash device that is almost full, and you have a high rate of file deletes or file-rewrites.

levelcrow
Posts: 47
Joined: Tue Aug 12, 2014 5:04 pm

Re: PI3 microSD and wear leveling

Sun Apr 10, 2016 6:16 pm

I was really into the flash memory stuff last year, I spent quite a bit of time searching online about information on flash and wear leveling. My conclusion is probably something you've already found and don't want to hear again:

There's no good way to tell what sort of wear leveling you're going to get with a flash drive or (micro)SD card.

Try as I might, I could find little to no information for what brands or devices employ a dynamic or static wear leveling, or whether unallocated space is utilized for dynamic wear leveling. A lot of people online claim that the wear leveling isn't well documented as it might differ even between batches of the same USB drive or SD card. The Sandisk Extreme was the only flash brand I could find with explicitly stated static wear leveling, IIRC.

There are 2 more conclusions I came to:
1. Sandisk probably has the best wear leveling for USB drives and SD cards. I suspect this because Sandisk seems to be very proprietary regarding its flash technology.

2. The wear leveling most likely isn't as important as it might seem - particularly if you move over root to a USB drive. Rather, it appears that controller failure is more likely a culprit of flash failure. It seems like the crystal used for clock generation is a weak point for many cheaper USB drives. The reports of bona fide flash failure - read-only status and all - were slim online. In fact, I could find only one report of flash failure - which was performed on purpose and still took a very large number of write-erase cycles despite testing methodology designed to minimize write-erase cycles preceding failure. In this case, the data ended up as read-only - the theoretically predicted behavior of flash failure. Other flash failure reports had loss of access to the data. This could be a controller failure or a crystal failure. I've only had 2 USB drive failures in my lifetime and both appeared to be controller failures.

Here's a back of the envelope calculation I did near the end of my flash memory phase:

If I use a USB flash drive as root and leave 1 gigabyte of space unallocated and the flash drive controller uses this unallocated space for dynamic wear leveling, and the cells can take 10000 write-erase cycles before being worn out, and I write 1 gigabyte of data a day (which you can check using 'iostat') - then in theory, it should take at least 10000 days before the flash fails - 27 years. However, it will most certainly take more that this amount of time because the writing of 1 gigabyte involves shifting of the block pool such that there's more than 1 gigabyte of free blocks circulating - not even taking the manufacturer overprovisioned blocks into account. People claim that write-erase cycles - in practice - are often much greater than what is listed on manufacturer specs. This was backed up by an academic paper written by Simona Boboila. It should be noted that the same academic paper was unable to fail a Memorex flash drive using static wear leveling using intentionally high write-erase methodology. The paper was written 6 years ago. In addition to this, I personally do not write 1 gigabyte of data a day. My usage is more like 300-600 megabytes - and this is without adjustments to the vm dirty ratio or other parameters that can minimize disk writes and maximize RAM usage.

My personal conclusion was that the wear leveling just isn't a realistic concern. People have intentionally worn out SD cards before, but IIRC it took months of nonstop writing to induce this. Perhaps a USB drive might be more robust and more commonly possess better wear algorithms - though I'm not sure if this is really the case. It just doesn't seem like a big deal, theoretically and practically.

Data corruption - however, is a real thing that I've run into plenty of times. A stable power source is key.

stevech
Posts: 144
Joined: Sun Jul 15, 2012 11:53 pm

Re: PI3 microSD and wear leveling

Sun Apr 10, 2016 8:23 pm

Today's high capacity MLC NAND flash, with 4 level sensing, has a very high bit error rate. Not just from writing, but from 'read disturbances" where the stored charge is degraded from reading or writing a physically nearby cell.

So these multi-level high capacity devices (say, more than 4GB per chip) rely on heavy use of error correcting codes (ECC). This means that a LOT of controller compute time, with ASIC help, is needed to get reliable operation. ECC faults (uncorrectable) contribute to the wear leveling strategy.

Some say that we need a new fundamental technology because 4 level is so very dependent on aggressive ECC.
Where this really comes up more than USB flash, or SD card flash, are the chips and die used in solid state disk products - which so far, are working very well. But perhaps we're nearing the limits of what can be done with this geometry size.

User avatar
patrikg
Posts: 168
Joined: Sun Mar 18, 2012 10:19 pm

Re: PI3 microSD and wear leveling

Sun Apr 10, 2016 8:59 pm

Thank you for sharing this information.

What do you suggest the best way to more secure the data then just to use the old rotating discs.
Is this something to be worried about.When using nand technology. I have once teer down a usb memory stick.

People should make backup of their data even if they store it on nand.
Could RAID/chip be the solution in the some SSD discs.
So if one chip fail you don't loose the data.
Or should i be more worried about the internal controller in the SSD to fail.

levelcrow
Posts: 47
Joined: Tue Aug 12, 2014 5:04 pm

Re: PI3 microSD and wear leveling

Sun Apr 10, 2016 11:35 pm

I don't know if you were asking me or not; I did most of my search focused on using flash drives. However, it seems like SSDs have much greater disclosure regarding type of wear leveling and also give more control in regards to overprovisioning. A lot of the sites I ran into claimed that SSDs are now as reliable as - if not more than - platter style HDs. I wouldn't be surprised, especially considering the result of the Boboila paper - unable to wear out a static leveling USB drive from 2010. I imagine the wear leveling algorithms and controller hardware have progressed since then, SSDs must be pretty reliable by now. Also, it seems like SSDs are held to a different standard of quality and design than USB drives - likely as USB drives are primarily sold for low throughput data storage/transport.

My personal solution towards the uncertainties of flash memory is that I routinely backup important files to an additional flash drive through scripts that run at start up. I also back up important files to Google Drive through the script - which I think is currently the most reliable way to ensure everything remains accessible. The cloud is here and a degree of disk space is free.

Burcu Dogan at Google actually wrote an interface to go between Google Drive and Linux. It's called "drive" and is maintained by Emmanuel Odeke.
https://github.com/odeke-em/drive

Using it with yes allows for automatic syncing of disk contents to Google Drive.
https://en.wikipedia.org/wiki/Yes_(Unix)

raspberryblower
Posts: 1
Joined: Wed Jun 28, 2017 8:33 am

Re: PI3 microSD and wear leveling

Wed Jun 28, 2017 9:33 am

Here's one I've come across that does mention wear-levelling in the description:
Delkin Devices 32 GB MicroSDHC 660X UHS-I U3
https://www.amazon.co.uk/gp/product/B00NQX1F6G

I haven't tried it in a Raspberry Pi unfortunately, so I can't vouch for it working. But I thought I'd mention it anyway in case anyone does want to try it.

doublehp
Posts: 77
Joined: Wed May 02, 2012 1:11 am

Re: PI3 microSD and wear leveling

Mon Oct 09, 2017 4:46 pm

I was using SDHC cards on rPi, and I am tired of burning cards every 6 months. So, I was advised to buy MMC, but I wanted to be sure they are better than SD. And I found this page.

https://web.archive.org/web/20140805113 ... eid=900195
states:
e-MMC products integrates NAND flash memory and a controller chip in a single package to perform error corrections, wear leveling and bad-block
This means, all eMMC cards include Wear Leveling.

So, in emergency, I have bought an eMMC card plus the micro SD adapter on Amazon. Now, I am still looking for wear leveling in SD cards. For now, I have found various contradictory peaces of information. For SD and SDHC, each manufacturer was free to do any mess; it's said (but I have not found any proof yet) that SDXC implies WL.

This item states it can do WL:
Delkin Devices 32 GB MicroSDHC 660X UHS-I U3 Memory Card
https://www.amazon.co.uk/gp/product/B00NQX1F6G
(SDHC UHS-1 U3)

https://www.sandisk.fr/oem-design/indus ... rial-cards
Sandisk Industrial are given for 192TB written ...

Out of those OEM-industrial cards (which are not supported by the official chat room), using any standard end user Sandisk card ( https://www.sandisk.fr/home/memory-cards ) in an rPi breaks the waranty. Still, for booting an rPi, they recommend the High Endurance stream (which is also called video surveillance https://www.sandisk.fr/home/memory-card ... ce-microsd ). Both are SDXC white-white; but the industrial has the word industrial written on it.

I was said that eMMC probably includes a better WL algorythm than any micro SD card. I can't proof check it.

Here is what I have been said by the Sandisk support chat:
- all Sandisk cards do WL; but knowing which WL algorythm is used is an industrial secret. Ultra cards do it, even if it's not mentionned on the product page (it's officially written on the Extreme page).
- here is the complete list of end-user items https://www.sandisk.fr/home/memory-cards ; they all should include WL, and are all supported by the live chat
- the OEM cards are not supported by the live chat; in example the Industrial range: https://www.sandisk.fr/oem-design/indus ... rial-cards . For OEM cards, support should be seeked at the reseller.
- any end-user card inserted in an rPi looses it's waranty
- when you have an rPi, and want to insert some stuff in the SD hole, it's recommended to choose a High Endurance model (also called video-surveillance) https://www.sandisk.fr/home/memory-card ... ce-microsd . They are very similar to industrial cards, except they don't have the INDUSTRIAL word.

It was impossible for me to get them tell me the percentage of hidden reserved space (used for reallocation when a block is found dead).

I have found someone providing the same feedback about sandisk here:
https://reprage.com/post/what-are-the-b ... spberry-pi
for the fact using their cards in a rPi voids the waranty, but they still recommend high endurance ...

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6864
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: PI3 microSD and wear leveling

Tue Oct 10, 2017 8:48 am

The warranty wording from Sandisk is a little underhand - https://www.sandisk.com/about/legal/war ... ranty-emea
This warranty does not cover use of the Product in connection with the following uses or devices (as determined by SanDisk): (i) normal wear and tear, (ii) video monitoring, security, and surveillance devices, (iii) internet protocol/network cameras, (iv) in-car recording devices/dashboard cameras/black box cameras, (v) display devices that loop video, (vi) continuous recording set top box devices, (vii) continuous data logging devices like servers, or (viii) other excessive uses that exceed normal use in accordance with published instructions. For information on SanDisk products intended for use in connection with the uses and devices noted in points (i) –(vi), above, please visit our product page for high endurance products located here.
That seems to give them carte blanche to deny any warranty claim.
I guess they can't tell how a Pi has been configured so blacklist them all in case you set it up recording HD video 24/7.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4943
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: PI3 microSD and wear leveling

Tue Oct 10, 2017 12:02 pm

6by9 wrote:
Tue Oct 10, 2017 8:48 am
The warranty wording from Sandisk is a little underhand - https://www.sandisk.com/about/legal/war ... ranty-emea
This warranty does not cover use of the Product in connection with the following uses or devices (as determined by SanDisk): (i) normal wear and tear, (ii) video monitoring, security, and surveillance devices, (iii) internet protocol/network cameras, (iv) in-car recording devices/dashboard cameras/black box cameras, (v) display devices that loop video, (vi) continuous recording set top box devices, (vii) continuous data logging devices like servers, or (viii) other excessive uses that exceed normal use in accordance with published instructions. For information on SanDisk products intended for use in connection with the uses and devices noted in points (i) –(vi), above, please visit our product page for high endurance products located here.
That seems to give them carte blanche to deny any warranty claim.
I guess they can't tell how a Pi has been configured so blacklist them all in case you set it up recording HD video 24/7.
And, maybe, they "shoot themselves in the foot" too, since some cards are (have been) marketed/labeled as being "ideal for Android" ** Hmmm....
Trev.
** 'Q' & 'V' from my assorted collection: http://www.cpmspectrepi.uk/raspberry_pi ... cards.html
[Slightly O.T.] As yet, I've not managed to "break" a SDHC/uSDHC card in a Pi, but, on principle, I, as far as possible, keep programs/software and (regularly changed/overwritten) data "separate", usually on a USB stick. The one I was using for my local MoinMoin wiki (from which my webpages are "exported") eventually became corrupted. However I've associated that event with the fact it was running (under Wheezy) on an "early Pi" that had the USB polyfuses. I've moved it a couple of times since (different Pi's & sticks) and it's currently setup on my P2B - so that's one "failure" in ~5 years of use.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

abutler77
Posts: 1
Joined: Wed Apr 27, 2016 6:12 pm

Re: PI3 microSD and wear leveling

Sat Oct 14, 2017 9:49 am

doublehp, what eMMC and microSD adapter are you using?

doublehp
Posts: 77
Joined: Wed May 02, 2012 1:11 am

Re: PI3 microSD and wear leveling

Tue Nov 14, 2017 4:43 pm

Ideal for Android, they mean, ideal for the external SD storage for phones. And even with this use, I had a 64GB card die in one year.

What they don't like is to boot on uSD, and store /var/log in there. ext3 is pretty much designed to kill classic SD cards. It's pretty much urgent Raspbian moves to F2FS.

Up to now, I was buying Sandisk Ultra cards (red-grey, usually). Now moving to High Endurance (installed it last week), for a try. For eMMC: https://www.amazon.fr/gp/product/B01DNV ... V087&psc=1 (installed it last month).

But I am also now trying an other alternative, which will be much cheaper. SD or MMC cards add from 8 to 40€ to the cost of an rPi. So, for only 4€ more than the usual cost of an rPi, I have found this Orange pi. The keyword we are looking for are the PLUS versions; this is what means "MMC soldered onboard":
https://www.amazon.fr/Orange-Support-Lu ... %2Bpc&th=1
It's said to be software compatible with rpi, and should support identical raspbian configuration (I expect IO ports to have different adresses, like for example, the I2C settings). Some recent versions with newer CPU are said to be harder to boot from MMC. The procedure to migrate raspbian to MMC on this H3 should work as following the tutorial to the letter; but a friend has a more recent H5, and he claims that there is no working tuto for now. Note that there should exist "zero plus" versions (not 100% sure).

Should receive my orange pi in two weeks.

doublehp
Posts: 77
Joined: Wed May 02, 2012 1:11 am

Re: PI3 microSD and wear leveling

Tue Nov 14, 2017 5:09 pm

The official answer from Transcend is:
All of our flash products support wear leveling but for heavy usage it is suggest to use MLC chip based cards for better endurance.

https://nl.transcend-info.com/Embedded/Essay-22

https://nl.transcend-info.com/Products/No-727
If you can find them, you can also use Sandisk Industrial, which *should* also implement MLC (I lost the link).

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4943
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: PI3 microSD and wear leveling

Tue Nov 14, 2017 5:24 pm

doublehp wrote: Ideal for Android, they mean, ideal for the external SD storage for phones. And even with this use, I had a 64GB card die in one year.
...
A somewhat "narrow" interpretation, since both 'phones & tablets may have "Android apps." that can run from the external uSDHC card. (That doesn't exclude the possibility that such apps. may handle such uSDHC card in a "special", safer manner). Whilst I let the MoinMoin Wiki "do it's own thing" w.r.t. the (similar) USB flash storage during "basic editing" when using it's export function I always "delete" the previous export first thus, to some extent, ensuring that (hopefully) relatively large blocks of data are written (ie. more like what happens when, say, a video file would be written from a 'phone or camera). However, as yet, I've not used any USB sticks or uSDHC cards >32GB - for me they're not "cost effective".
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

doublehp
Posts: 77
Joined: Wed May 02, 2012 1:11 am

Re: PI3 microSD and wear leveling

Tue Nov 14, 2017 5:31 pm

FTrevorGowen wrote:
Tue Nov 14, 2017 5:24 pm
doublehp wrote: Ideal for Android, they mean, ideal for the external SD storage for phones. And even with this use, I had a 64GB card die in one year.
...
A somewhat "narrow" interpretation, since both 'phones & tablets may have "Android apps." that can run from the external uSDHC card. (That doesn't exclude the possibility that such apps. may handle such uSDHC card in a "special", safer manner). Whilst I let the MoinMoin Wiki "do it's own thing" w.r.t. the (similar) USB flash storage during "basic editing" when using it's export function I always "delete" the previous export first thus, to some extent, ensuring that (hopefully) relatively large blocks of data are written (ie. more like what happens when, say, a video file would be written from a 'phone or camera). However, as yet, I've not used any USB sticks or uSDHC cards >32GB - for me they're not "cost effective".
Trev.
I am aware that Android may move apps to SD; I do it; but it should not kill the FLASH.

32-400GB uSD cards are a bit more expensive than legacy SATA SSD of equivalent storage, but not that much.

Return to “Advanced users”