Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个 C++ 库来附加/挂载 Linux 和 AIX 中的逻辑卷上的文件系统。
我可以fsck在挂载文件系统之前在 C++ 代码中运行/执行命令吗?
fsck
fsck如果我在 Linux 和 AIX 上用 C++ 代码执行命令会出现什么问题?
在这种情况下,您可能必须在非交互模式下运行 fsck,假设用户通过运行 fsck -y 对所有问题回答“是”。
如果发生令人讨厌的事情,这可能会导致各种不良行为。
如果您需要在 C++ 代码中挂载文件系统,我会考虑让操作系统和/或 mount 命令决定何时需要运行 fsck(基于自上次 fsck 以来先前挂载的数量)并让它以交互方式运行模式,为用户提供回答潜在问题的可能性。