ディスクパーティションに問題があり、このパーティションでメンテナンスを行う必要がありますが、ユーザーのホームディレクトリがそこにあり、いくつかがログインしています。ユーザーを切断し、メンテナンスタスクを安全に実行できるコマンドはどれですか。
正解:A
Explanation
The command that would disconnect the users and allow you to safely execute maintenance tasks on a disk partition is telinit 112. The telinit command is used to change the runlevel of the system, which is a mode of operation that defines what processes and services are running3. The runlevel 1, also known as single-user mode, is a mode that allows only the root user to log in, and disables all network services and graphical interfaces4. This mode is useful for performing system maintenance and recovery tasks, such as repairing a disk partition5.
The other options in the question are not correct because:
* B. shutdown -r now: This command would reboot the system immediately, without disconnecting the users gracefully or allowing you to do any maintenance tasks.
* C. killall -9 inetd: This command would kill the inetd process, which is a daemon that manages network services. This would not disconnect the users who are already logged in, and it would not stop other processes that might interfere with the maintenance tasks.
* D. /bin/netstop --maint: There is no such command in Linux.
* E. /etc/rc.d/init.d/network stop: This command would stop the network service, which would disconnect the users who are logged in remotely, but not the ones who are logged in locally. It would also not stop other processes that might interfere with the maintenance tasks.
References:
1: How to Change Runlevels (targets) in SystemD - Tecmint 2: How to Boot into Single User Mode in CentOS/RHEL 7 - Tecmint 3: Runlevel - Wikipedia 4: Single-user mode - Wikipedia 5: How to Repair a Corrupted Linux File System - Linux.com : [shutdown(8) - Linux manual page] : [inetd(8) - Linux manual page] : [How to Start/Stop or Enable/Disable firewalld on CentOS 7 - Tecmint]