LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-14-2015, 01:38 AM   #1
TeaYoung
LQ Newbie
 
Registered: Apr 2013
Posts: 26

Rep: Reputation: Disabled
If you use a lot of fsync () at nand flash(TLC) rapidly decreasing the lifespan?


Hello.

Do you understand English is not smooth, please ask.

SD Card(4GB) from my board fails, things are coming out frequently.

So is the SD Card (TLC) Debuging.

I've used the function of the [MMC debugging] in the Kernel.

Confirmed that the command was successful CMD13, CMD17, CMD18 command failed.



In circumstances where the issue is continuously recorded on an SD card, the current log.

The part that I suspect are part such as fsync ().

Following my hypothesis.

1. Even if the fsync () to write a 1byte is written is actually 4096byte because the characteristics of NAND Flash.

2. Repeat the process for a long time of 1 TLC, MLC as soon as this life is both touching.


Is this me this idea?

Below is the source code to test my hypothesis done. XD

Code:
#include <stdio.h>   
#include <string.h>  
#include <fcntl.h>   
#include <unistd.h> 

int main()
{
    int   fd;
    char *str = "1"; //1byte

    fd = open( "test.txt", O_WRONLY | O_CREAT, 0644);

    while(1){    

        write( fd, str, strlen( str));  //1byte write

        if ( -1 == fsync( fd))   //Write a 1byte (), but actually write the 4096 byte?  Due to the nature of the NAND Flash           
            printf( "fsync() failed");     
    }

    close( fd);
}

Last edited by TeaYoung; 12-14-2015 at 03:53 AM.
 
Old 12-16-2015, 07:33 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
The more you write to a flash disk, the sooner it will wear out.

If you use that program which has no delay, infinite looping, it will eventually wear out a block on the flash disk, and then another, and another, and so forth.

What can happen is with write leveling, the different iterations of creating a new file can result in uniform writes to all free locations until you've largely written to all of the free locations one time, and then a repeat of that process.

So say you can write to any given location 10 times. And say further that there are Z locations. So it will either be:
  1. Location A: Write first time
  2. Location A: Write second time
  3. ... continue up to the 10th time
  4. Now you can't write to Location A anymore, so you start writing to Location B
  5. Eventually you can't write to Location B, so you move to C, D, ... Z
  6. And now the disk is no longer write-able
  1. Location A: Write
  2. Location B: Write, and continue till you get to Location Z
  3. Back to Location A: Write, and continue to Z a second pass
  4. Eventually you'll loop 10 times and have written to all locations the allowable amount of times
  5. End result the disk is no longer write-able
The more complex points here are:
  1. Write cycle times are VERY HIGH in today's disk technologies
  2. Given that they are so high, one write, ten writes, 100 writes, are not a big deal, it is partially a probability problem, when your limit is 2 Million writes, that's the advertised guarantee of some disks, and so some, maybe many locations may work with much higher write counts, and the manufacturer's intention is that very few, to no locations work with lower than 2 million write counts
  3. Disks are very large, therefore whether or not they have block sizes for writes (they do) there's still very, very much data available for free space, provided your disk isn't largely full already.
I'm not sure writing one byte uses 4K, likely 256 bytes. Even so, 4K compared to 4G is a factor of one millionth.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increasing flash memory lifespan displace Linux - Embedded & Single-board computer 6 02-16-2013 04:32 AM
Nand flash boot Roger03 Programming 1 04-03-2010 05:19 AM
R/W from nand flash linux_newbie79 Linux - Newbie 3 08-19-2009 08:35 AM
finite lifespan for flash drive, how long? lugoteehalt Linux - Hardware 7 06-28-2007 12:32 PM
nand flash: need help jier Programming 0 05-03-2006 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration