raspberry-pi – 使用Raspbian Linux for ARM(Plate Raspberry Pi)的SD卡的生命周期是多少?

raspberry-pi – 使用Raspbian Linux for ARM(Plate Raspberry Pi)的SD卡的生命周期是多少?,第1张

概述工作人员,这个问题适合任何相信Debian linux的人,更准确地说是Raspbian,这是一个在Raspberry Pi上运行的版本: 因为Raspberry Pi的所有用户都应该知道: *** 作系统安装在SD卡上.问题是SD卡是闪存,这种类型的存储器仅支持有限数量的写 *** 作. 我想知道Raspbian是否在闲置时写入SD卡.如果发生这种情况,我该怎么禁用? 我找到了这个: Tips for runn 工作人员,这个问题适合任何相信Debian linux的人,更准确地说是Raspbian,这是一个在RaspBerry Pi上运行的版本:

因为RaspBerry Pi的所有用户都应该知道: *** 作系统安装在SD卡上.问题是SD卡是闪存,这种类型的存储器仅支持有限数量的写 *** 作.

我想知道Raspbian是否在闲置时写入SD卡.如果发生这种情况,我该怎么禁用?

我找到了这个:

Tips for running Linux on a flash device by DavID Härdeman

If you are running your NSLU2 on a USB flash key,there are a number
of things you might want to do in order to reduce the wear and tear on
the underlying flash device (as it only supports a limited number of
writes).

Note: this document currently describes Debian etch (4.0) and needs to
be updated to Debian squeeze (6.0) and Debian wheezy (7.0). Some of
the hints may still apply,but some may not.

The ext3 filesystem per default writes Metadata changes every five
seconds to disk. This can be increased by mounting the root filesystem
with the commit=N parameter which tells the kernel to delay writes to
every N seconds.

The kernel writes a new atime for each file that has been read which
generates one write for each read. This can be Disabled by mounting
the filesystem with the noatime option.
Both of the above can be done by adding e.g. noatime,commit=120,… to /etc/fstab. This can also be done on an
already mounted filesystem by running the command:

mount -o remount,noatime,commit=120 /

The system will run updatedb every day which creates a database of all
files on the system for use with the locate command. This will also
put some stress on the filesystem,so you might want to disable it by
adding

exit 0

early in the /etc/cron.daily/find script.

syslogd will in the default installation sync a lot of log files to
disk directly after logging some new information. You might want to
change /etc/syslog.conf so that every filename starts with a – (minus)
which means that writes are not synced immediately (which increases
the risk that some log messages are lost if your system crashes). For
example,a line such as:

kern.* /var/log/kern.log

would be changed to:

kern.* -/var/log/kern.log

You also might want to disable some classes of messages altogether by
logging them to /dev/null instead,see syslog.conf(5) for details.

In addition,syslogd likes to write — MARK — lines to log files
every 20 minutes to show that syslog is still running. This can be
Disabled by changing SYSLOGD in /etc/default/syslogd so that it reads

SYSLOGD=”-m 0″

After you’ve made any changes,you need to restart syslogd by running

/etc/init.d/syslogd restart

If you have a swap partition or swap file on the flash device,you
might want to move it to a different part of the disk every Now and
then to make sure that different parts of the disk gets hit by the
frequent writes that it can generate. For a swap file this can be done
by creating a new swap file before you remove the old one.

If you have a swap partition or swap file stored on the flash device,
you can make sure that it is used as little as possible by setting
/proc/sys/vm/swappiness to zero.

The kernel also has a setting kNown as laptop_mode,which makes it
delay writes to disk (initially intended to allow laptop disks to spin
down while not in use,hence the name). A number of files under
/proc/sys/vm/ controls how this works:

/proc/sys/vm/laptop_mode: How many seconds after a read should a
writeout of changed files start (this is based on the assumption that
a read will cause an otherwise spun down disk to spin up again).

/proc/sys/vm/dirty_writeback_centisecs: How often the kernel should
check if there is “dirty” (changed) data to write out to disk (in
centiseconds).

/proc/sys/vm/dirty_expire_centisecs: How old “dirty” data should be
before the kernel consIDers it old enough to be written to disk. It is
in general a good IDea to set this to the same value as
dirty_writeback_centisecs above.

/proc/sys/vm/dirty_ratio: The maximum amount of memory (in percent) to
be used to store dirty data before the process that generates the data
will be forced to write it out. Setting this to a high value should
not be a problem as writeouts will also occur if the system is low on
memory.

/proc/sys/vm/dirty_background_ratio: The lower amount of memory (in
percent) where a writeout of dirty data to disk is allowed to stop.
This should be quite a bit lower than the above dirty_ratio to allow
the kernel to write out chunks of dirty data in one go.

All of the above kernel parameters can be tuned by using a custom init
script,such as this example script. Store it to e.g.
/etc/init.d/kernel-params,make it executable with

chmod a+x /etc/init.d/kernel-params

and make sure it is executed by running

update-rc.d kernel-params defaults

Note: Most of these settings reduce the number of writes to disk by
increasing memory usage. This increases the risk for out of memory
situations (which can trigger the dreaded OOM killer in the kernel).
This can even happen when there is free memory available (for example
when the kernel needs to allocate more than one contiguous page and
there are only fragmented free pages available).

As with any tweaks,you are advised to keep a close eye on the amount
of free memory and adapt the tweaks (e.g. by using less aggressive
caching and increasing the swappiness) depending on your workload.

This article has been contributed by DavID Härdeman

Go back to the Debian on NSLU2 page.

http://www.cyrius.com/debian/nslu2/linux-on-flash/

有人有更多小费吗?

解决方法 我一直在使用各种覆盆子pi设置,迄今为止没有SD卡问题(手指交叉).话虽如此,有一些证据表明SD卡寿命相关的问题

快速谷歌搜索确实显示了一些提示:

>更大更好 – 减少特定部分的负载
>写入ram for temp
>仅将启动分区存储在SD卡上,并将 *** 作系统保留在USB驱动器上

(http://www.makeuseof.com/tag/extend-life-raspberry-pis-sd-card/)

无论如何,听到有人在他们的SD卡生命周期中拥有覆盆子群或其他类似物的人会很有趣!
(https://resin.io/blog/what-would-you-do-with-a-120-raspberry-pi-cluster/)

总结

以上是内存溢出为你收集整理的raspberry-pi – 使用Raspbian Linux for ARM(Plate Raspberry Pi)的SD卡的生命周期是多少?全部内容,希望文章能够帮你解决raspberry-pi – 使用Raspbian Linux for ARM(Plate Raspberry Pi)的SD卡的生命周期是多少?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1029214.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存