主题 : 如何实现软关机? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 50963
精华: 0
发帖: 26
金钱: 130 两
威望: 26 点
综合积分: 52 分
注册时间: 2011-06-28
最后登录: 2018-02-08
楼主  发表于: 2012-07-25 11:00

 如何实现软关机?

我的2440的开发板带了一块硬盘,使用FAT32的文件系统存储文件。

在使用过程中出现了硬盘文件系统被破坏不能挂载的情况,硬盘是好了,重新格式化后就可以用了。

想来想去没有什么结果。

现在想在程序中实现一个软关机。因为以前都是外部断电来关机的。断电关机可能对硬盘造成一些影响。

就好像我们的电脑一样。

我在我的一块arm板上使用shutdown -h now来关机。

出来的信息如下:


root@sbc8018:~# shutdown -h now

Broadcast message from root (ttyS2) (Tue Apr 14 20:56:42 2009):

The system is going down for system halt NOW!
INIT: Switching to runlevel: 0
INIT: Sending processes the TERM signal
INIT: Sending procesStopping telnet daemon.
Stopping syslogd/klogd: stopped syslogd (pid 1254)
stopped klogd (pid 1256)
done
Deconfiguring network interfaces... cat: can't open '/var/run/udhcpc.eth0.pid':
No such file or directory
done.
Sending all processes the TERM signal...
Sending all processes the KILL signal...
Unmounting remote filesystems...
Deactivating swap...
Unmounting local filesystems...
mount: can't find /mnt/ram in /proc/mounts
umount: none busy - remounted read-only
mount: cannot read /proc/mounts: No such file or directory
sd 0:0:0:0: [sda] Synchronizing SCSI cache
sd 0:0:0:0: [sda] Stopping disk
System halted.

我还实验了halt  poweoff inin 0等关机命令 ,输出的信息都一样(pid 号不一样)。

此时电源指示灯还亮着。

我想问的是,这样已经实现了软关机吗?

我看了软关机的介绍。软关机是指关闭了系统么?

这样做能对硬盘起到保护作用么?
级别: 新手上路
UID: 50963
精华: 0
发帖: 26
金钱: 130 两
威望: 26 点
综合积分: 52 分
注册时间: 2011-06-28
最后登录: 2018-02-08
1楼  发表于: 2012-07-25 11:06
我看有的人说,如果没有带电源管理芯片,就不能实现软关机?

这是什么意思?是说不能通过软关机来断开电源么?

软关机是指关闭操作系统么?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2012-07-25 12:37
我想问的是,这样已经实现了软关机吗?

我看了软关机的介绍。软关机是指关闭了系统么?

这样做能对硬盘起到保护作用么?

你这样做是不是实现了软关机我不确定,这取决于你如何定义这个"软关机"。不过只要你确保在关机过程中umount了FAT文件系统所在的硬盘分区,就不会对文件系统造成损害了。

我看有的人说,如果没有带电源管理芯片,就不能实现软关机?

我想这个的意思是没有电源管理芯片,软件通常没有办法切断对整个系统的供电。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 50963
精华: 0
发帖: 26
金钱: 130 两
威望: 26 点
综合积分: 52 分
注册时间: 2011-06-28
最后登录: 2018-02-08
3楼  发表于: 2012-07-25 14:06

 回 2楼(kasim) 的帖子

谢谢大侠指点。我们的理解差不多。实验结果也吻合。的确没有办法切断整个系统的供电。

我们的电脑就可以。

接下来我再测试一段时间,如果这样做后真不会出现硬盘文件系统被破坏的情况,那就好了。

谢谢。