- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
工作人员,这个问题适用于相信 Debian linux,更准确地说是 Raspbian 的任何人,这是一个在 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.
最佳答案
我一直在使用各种 raspberry pi 设置,到目前为止还没有遇到 SD 卡问题(手指交叉)。话虽如此,但有一些证据表明 SD 卡生命周期相关问题
快速谷歌搜索确实显示了更多提示:
关于raspberry-pi - 带有 Raspbian Linux for ARM (Plate Raspberry Pi) 的 sd 卡能用多久?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22341626/
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在使用带有Grove Pi +(1.2.2固件)的Raspberry Pi 3 B模型和用于Robots Image的Raspbian。 我在I2C-1端口中插入了多 channel 气体传感器,
这看起来非常简单,但我似乎无法弄清楚如何将 -Pi 和 Pi 之间的角度映射到 0 到 2Pi 的范围内。我尝试使用 np.select 但由于某种原因它卡住了我的程序。我需要这个范围内的角度,因为它
在使用 SciPy 和 NumPy 的项目中,我应该使用 scipy.pi , numpy.pi , 或 math.pi ? 最佳答案 >>> import math >>> import numpy
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我有一个运行 Raspbian 的 Raspberry Pi 1。我尝试在 Raspberry Pi 3 上运行 SD 卡,但它没有启动。 我已经阅读了有关升级 Raspberry Pi 2 安装以在
#include using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #d
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我目前正在尝试RadiusNetworks发布的Raspberry Pi iBeacon教程,网址为 http://developer.radiusnetworks.com/2013/10/09/ho
我无法在运行Raspbian的Raspberry Pi 3上安装我创建的 Electron 应用程序。我已经使用了electronic-packager来创建软件包,然后创建了一个debian安装程序
我想在Linux上为Raspberry Pi 1设置交叉编译环境。 特别是我想尝试最新版本,即Raspbian测试+ Qt5开发分支。 这个问题: How can I create a modern
我想要从我的 Raspberry Pi Zero 到手机的低延迟流式传输。据我了解,移动浏览器不支持 RTMP 流式传输,HLS 流式传输具有高延迟,而 webRTC 是我最好的选择。 有谁知道从零开
我的公司使用 Raspberry Pi 3 作为产品中的嵌入式 Controller 。用户不会优雅地关闭它,他们只是扳动一个开关。为避免损坏,/boot 和/root 文件系统是只读的。这似乎是防弹
如何使用 Raspberry Pi 作为 b/w USB Tethered 手机和路由器的桥接器,使用“以太网电缆 b/w Raspberry Pi 和路由器”和“USB 电缆 b/w 手机和 Ras
我正在尝试在Raspberry Pi 3上安装Rakudo Star 2018.04。 我做: sudo perl Configure.pl --gen-moar --gen-nqp --prefix
我正在寻找一些可以有效完成的不错的 C 代码: while (deltaPhase >= M_PI) deltaPhase -= M_TWOPI; while (deltaPhase T Mod(T
我正在尝试为 raspberry Pi 构建跨环境以在 Eclipse CDT for windows 上构建二进制文件。 我得到了用于访问 GPIO 的 Wiring Pi,我需要使用“Window
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我正在寻找一些可以有效完成的不错的 C 代码: while (deltaPhase >= M_PI) deltaPhase -= M_TWOPI; while (deltaPhase T Mod(T
这个问题在这里已经有了答案: C: How to wrap a float to the interval [-pi, pi) (15 个答案) 关闭 9 年前。 我想知道是否可以定义一个只能取 -
我是一名优秀的程序员,十分优秀!