element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum 树莓派系统优化教程:优化SD卡
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 665 subscribers
  • Views 1291 views
  • Users 0 members are here
Related

树莓派系统优化教程:优化SD卡

Former Member
Former Member over 11 years ago

SD卡和普通的磁盘驱动器有很多不同的地方,SD卡可以执行写和擦除的周期的次数是有限的,然而传统的磁盘驱动器没有写和擦除周期的概念。

什么是写和擦除周期?

    对于一个普通的磁盘驱动器,每当你往磁盘里写东西,磁盘的某个扇区就会改变它的磁盘状态。这是磁盘物理上的改变,它不会给磁盘圆片本身带来损耗。当我们读取磁盘片上同一扇区的数据时,磁盘片的性质也不会发生改变。而SD卡显然是没有磁盘片,但是SD卡有小的内存芯片,其中包含内存单元,数据储存在内存单元上,就像物理硬盘的扇区一样。

   和物理硬盘不一样,当你读写内存单元时,它的状态就发生了改变。

这是因为闪存单元使用不量的存储电荷来表示数据的比特位,这就是写和擦除的来源:

每当你读或写闪存单元一次,这个单元 的周期就消耗一次。读写闪存的时候,状态随之改变,每一个闪存单元只有限的周期,这些周期消耗完之后,状态再也无法改变(无法写入).

     一般的SD卡会有10万次写和擦除周期,相对于数码相机来算是很多了,不过相对于日志文件系统就显得不足了,日志文件系统会非常频繁地往SD卡内写入少量的数据。除此外,每当系统更新文凭或目录时,也会往磁盘写数据,所以,10万次的周期是远远不够用的,因此,我们要关闭自动更新文件存取时间的功能,关闭自动更新文件存取时间的功能可以通过以下两种方式实现:

 

1.      第一个是noatime选项,它会禁止更新文件存取时间,这对闪存单元来说是好事,但是对用户来说并不是好事,比如说你想知道你的文件的时间戳,又比如有些应用程序依赖于文件的存时间戳。

2.      为了在两个极端中取一个平衡点,可以使用relatime挂载选项,relatime选项只有当最新修改时间比当前存取时间新的时候才会更新文件时间。这个选项减少了大量的闪存单元写操作,用户可以编辑/etc/fstab文件启用这个选项将你的根文件系统(/)以及启动文件系统(/boot)的挂载选项修改成如下所示的样子:

      /dev/mmcblkop1    /     auto      defaults,relatime  1 1

     /dev/mmcblkop1    /boot auto       defaults,relatime  1 2

首先重新挂载每个文件系统:

#mount –o remount / && mount –oremount /boot

然后使用mount命令检查relatime是否启用:

#mount

它会显示所有挂载的文件系统经以及它他们的挂载选项。
具体访问:树莓派系统优化教程:优化SD卡 - 树莓派综合讨论 - 树莓派发烧友 - Powered by Discuz!
  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube