我的需求是把一个镜像文件写进TF卡。镜像大小3~4G。我在终端下用命令行操作,具体是这样:
sudo dd if=2013-09-25-wheezy-raspbian.img of=/dev/sdx # sdx根据实际情况
现在出现的问题是:写入镜像一开始还正常,写了一会儿之后系统的所有鼠标、键盘、视频播放等所有用户界面的操作全部、完全卡死。系统平均负载飚到10.0以上。
如果拔掉读卡器,则随着写卡失败,系统立刻恢复顺畅运行。
用了以下办法无效:
我记得当初在Windows下写卡的时候,完全可以把写卡程序扔到后台不管,前台该做什么做什么。
我不相信Linux做不到这一点。特上sf求教:如何解决这个问题?
操作系统:openSUSE 13.1 64bit
桌面环境:XFCE
根文件系统:btrfsuname -a
:Linux pc-776.localdomain 3.11.6-4-desktop #1 SMP PREEMPT Wed Oct 30 18:04:56 UTC 2013 (e6d4a27) x86_64 x86_64 x86_64 GNU/Linux
TF卡:Sandisk Ultra Class10 8GB,普通读卡器,实测有20MB/s写速度
硬件:H67主板,i3三代CPU,4G DDR3 1333内存,500G普通机械硬盘
I have never encountered this situation. When it gets really stuck (or before), use
dstat
andiotop -o
to take a look, mainly the CPU and I/O parts. In addition, when using dd, remember to specify the appropriatebs
, such asbs=10M
.@Evian’s tips are extremely useful and perfectly captured the problem. Thank you very much!
The problem lies in iotop, irrelevant processes
snapperd
top the list:This process is always requesting IO, which not only causes dd to crash, but also causes the hard disk light to be always on when there is nothing to do.
After checking, I found out that I like to try new things and use an overly pioneering file system like LVM+btrfs. If openSUSE is installed using btrfs, the snapper software will be automatically enabled.
This is equivalent to the "moonlight box" of the file system. It backs up and cleans the snapshot of the file system every hour... disable the automatic operation of the snapper (I dare not completely uninstall it for the time being) and everything is clean.
It is recommended to try changing the IO scheduler to deadline:
echo deadline > /sys/block/sdX/queue/scheduler
This can be slightly improved by adjusting the IO scheduler.