Linux command
e2fsck 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Check
sudo e2fsck /dev/sdXN
Example
sudo e2fsck -p /dev/sdXN
Example
sudo e2fsck -c /dev/sdXN
Force
sudo e2fsck -f /dev/sdXN
Example
sudo e2fsck -fccky /dev/sdXN
Read-only
sudo e2fsck -n /dev/sdXN
Verbose
sudo e2fsck -v /dev/sdXN
Example
sudo e2fsck -y /dev/sdXN
说明
e2fsck checks and optionally repairs Linux ext2, ext3, or ext4 filesystems. The filesystem should be unmounted before running this command, or mounted read-only at minimum.
参数
- -a
- Automatically repair without prompting (same as -p)
- -b SUPERBLOCK
- Use alternative superblock
- -B BLOCKSIZE
- Specify block size when searching for superblock
- -c
- Check for bad blocks using read-only test
- -C FD
- Write completion information to file descriptor
- -d
- Print debugging output
- -D
- Optimize directories
- -f
- Force check even if filesystem seems clean
- -F
- Flush buffer cache before checking
- -k
- Keep existing bad block list
- -n
- Open read-only, answer "no" to all questions
- -p
- Preen mode: automatically repair safe problems
- -t
- Print timing statistics
- -v
- Verbose mode
- -y
- Answer "yes" to all questions
FAQ
What is the e2fsck command used for?
e2fsck checks and optionally repairs Linux ext2, ext3, or ext4 filesystems. The filesystem should be unmounted before running this command, or mounted read-only at minimum.
How do I run a basic e2fsck example?
Run `sudo e2fsck /dev/sdXN` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a do in e2fsck?
Automatically repair without prompting (same as -p)