作弊条:如何远程启用/上面的SoftUpdates

| 2 Comments

说明:这个实际上是一个workaround,不过我暂时没时间修这个bug。这是一个作弊条,主要目的在于解决这一特定问题而非阐述其背后的原理和最佳实践。

方法:通常启用/上面的SoftUpdates(默认情况下FreeBSD并不启用/上面的SoftUpdates,因为/通常容量很小,开启SoftUpdates意义不大)。正常启用/上面SoftUpdates的方法是启用到单用户模式,然后用tunefs -n enable /来启用SoftUpdates,然后立刻重启。

远程启用SoftUpdates,因为通常无法让机房或机器旁边的人操作,因此进入单用户模式是不实际的;另一方面,如果以读写方式重新挂载 /,则会导致SoftUpdates设置被覆盖,因此不能通过写文件来标记。

具体的做法是使用下列 /etc/rc.early 脚本。注意:这个并不是最简/最优的方案,只是一个能用的方案。

#!/bin/sh
mount -o rdonly /usr
( /sbin/dumpfs / | /usr/bin/head -n 20 | /usr/bin/grep soft-updates > /dev/null 2>&1 ) || (tunefs -n enable / && reboot)
umount /usr

操作成功之后删除 /etc/rc.early 即可。

2 Comments

不错的文章,我收藏了。
多谢多谢。。。

疑惑!到底有没有必要在/上开启softupdates,如果有必要的话麻烦解释一下其意义何在?

Leave a comment

About this Entry

This page contains a single entry by Xin LI published on December 23, 2008 3:18 PM.

山寨开心网:这家公司真恶心 was the previous entry in this blog.

FreeBSD 7.1 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01