mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-09 01:30:10 +08:00
commit
91e04f7ded
@ -1,345 +1,345 @@
|
|||||||
Translating by qhwdw 4 Tools to Manage EXT2, EXT3 and EXT4 Health in Linux
|
Linux 中管理 EXT2、 EXT3 和 EXT4 健康状况的 4 个工具
|
||||||
============================================================
|
============================================================
|
||||||
|
|
||||||
|
|
||||||
A filesystem is a data structure that helps to control how data is stored and retrieved on a computer system. A filesystem can also be considered as a physical (or extended) partition on a disk. If not well maintained and regularly monitored, it can become damaged or corrupted in the long run, in so many different ways.
|
一个文件系统是一个在电脑上帮你去管理数据怎么去存储和检索的数据结构。一个文件系统也可以认为是在磁盘上的物理(或扩展)分区。如果它没有很好地被维护或定期监视,它可能在长期运行中出现各种各样的错误或损坏。
|
||||||
|
|
||||||
There are several factors that can cause a filesystem to become unhealthy: system crashes, hardware or software malfunctions, buggy drivers and programs, tunning it incorrectly, overloading it with excessive data plus other minor glitches.
|
这里有几个可能导致文件系统出问题的因素:系统崩溃、硬件或软件故障、 有问题的驱动和程序、不正确的优化、大量的数据过载加上一些小故障。
|
||||||
|
|
||||||
Any of these issues can cause the Linux not to mount (or unmount) a filesystem gracefully, thus bringing about system failure.
|
这其中的任何一个问题都可以导致 Linux 不能完美地去加载(或卸载)一个文件系统,从而导致系统故障。
|
||||||
|
|
||||||
Read Also: [7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)][7]
|
扩展阅读:[Linux 中判断文件系统类型(Ext2, Ext3 或 Ext4)的 7 种方法][7]
|
||||||
|
|
||||||
In addition, running your system with an impaired filesystem may give rise to other runtime errors in operating system components or in user applications, which could escalate to severe data loss. To avoid suffering filesystem corruption or damage, you need to keep an eye on its health.
|
另外,一个受损的文件系统运行在你的系统上,可能导致操作系统中的组件或用户应用程序的运行时错误,它可能会进一步扩大到服务器数据的丢失。为避免文件系统错误或损坏,你需要去持续关注它的健康状况。
|
||||||
|
|
||||||
In this article, we will cover tools to monitor and maintain a ext2, ext3 and ext4 filesystems health. All the tools described here require root user privileges, therefore use the [sudo command][8]to run them.
|
在这篇文章中,我们将介绍去监视或维护一个 ext2、ext3 和 ext4 文件系统健康状况的工具。在这里描述的所有工具都需要一个 root 用户权限,因此,需要使用 [sudo 命令][8]去运行它们。
|
||||||
|
|
||||||
### How to View EXT2/EXT3/EXT4 Filesystem Information
|
### 怎么去查看 EXT2/EXT3/EXT4 文件系统信息
|
||||||
|
|
||||||
dumpe2fs is a command line tool used to dump ext2/ext3/ext4 filesystem information, mean it displays super block and blocks group information for the filesystem on device.
|
dumpe2fs 是一个命令行工具,用于去转储 ext2/ext3/ext4 文件系统信息,音味着它可以显示设备上文件系统的超级块和块组信息。
|
||||||
|
|
||||||
Before running dumpe2fs, make sure to run [df -hT][9] command to know the filesystem device names.
|
在运行 dumpe2fs 之前,先去运行 [df -hT][9] 命令,确保知道文件系统的设备名。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo dumpe2fs /dev/sda10
|
$ sudo dumpe2fs /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Sample Output
|
##### 示例输出
|
||||||
|
|
||||||
```
|
```
|
||||||
dumpe2fs 1.42.13 (17-May-2015)
|
dumpe2fs 1.42.13 (17-May-2015)
|
||||||
Filesystem volume name:
|
Filesystem volume name:
|
||||||
Last mounted on: /
|
Last mounted on: /
|
||||||
Filesystem UUID: bb29dda3-bdaa-4b39-86cf-4a6dc9634a1b
|
Filesystem UUID: bb29dda3-bdaa-4b39-86cf-4a6dc9634a1b
|
||||||
Filesystem magic number: 0xEF53
|
Filesystem magic number: 0xEF53
|
||||||
Filesystem revision #: 1 (dynamic)
|
Filesystem revision #: 1 (dynamic)
|
||||||
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
|
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
|
||||||
Filesystem flags: signed_directory_hash
|
Filesystem flags: signed_directory_hash
|
||||||
Default mount options: user_xattr acl
|
Default mount options: user_xattr acl
|
||||||
Filesystem state: clean
|
Filesystem state: clean
|
||||||
Errors behavior: Continue
|
Errors behavior: Continue
|
||||||
Filesystem OS type: Linux
|
Filesystem OS type: Linux
|
||||||
Inode count: 21544960
|
Inode count: 21544960
|
||||||
Block count: 86154752
|
Block count: 86154752
|
||||||
Reserved block count: 4307737
|
Reserved block count: 4307737
|
||||||
Free blocks: 22387732
|
Free blocks: 22387732
|
||||||
Free inodes: 21026406
|
Free inodes: 21026406
|
||||||
First block: 0
|
First block: 0
|
||||||
Block size: 4096
|
Block size: 4096
|
||||||
Fragment size: 4096
|
Fragment size: 4096
|
||||||
Reserved GDT blocks: 1003
|
Reserved GDT blocks: 1003
|
||||||
Blocks per group: 32768
|
Blocks per group: 32768
|
||||||
Fragments per group: 32768
|
Fragments per group: 32768
|
||||||
Inodes per group: 8192
|
Inodes per group: 8192
|
||||||
Inode blocks per group: 512
|
Inode blocks per group: 512
|
||||||
Flex block group size: 16
|
Flex block group size: 16
|
||||||
Filesystem created: Sun Jul 31 16:19:36 2016
|
Filesystem created: Sun Jul 31 16:19:36 2016
|
||||||
Last mount time: Mon Nov 6 10:25:28 2017
|
Last mount time: Mon Nov 6 10:25:28 2017
|
||||||
Last write time: Mon Nov 6 10:25:19 2017
|
Last write time: Mon Nov 6 10:25:19 2017
|
||||||
Mount count: 432
|
Mount count: 432
|
||||||
Maximum mount count: -1
|
Maximum mount count: -1
|
||||||
Last checked: Sun Jul 31 16:19:36 2016
|
Last checked: Sun Jul 31 16:19:36 2016
|
||||||
Check interval: 0 ()
|
Check interval: 0 ()
|
||||||
Lifetime writes: 2834 GB
|
Lifetime writes: 2834 GB
|
||||||
Reserved blocks uid: 0 (user root)
|
Reserved blocks uid: 0 (user root)
|
||||||
Reserved blocks gid: 0 (group root)
|
Reserved blocks gid: 0 (group root)
|
||||||
First inode: 11
|
First inode: 11
|
||||||
Inode size: 256
|
Inode size: 256
|
||||||
Required extra isize: 28
|
Required extra isize: 28
|
||||||
Desired extra isize: 28
|
Desired extra isize: 28
|
||||||
Journal inode: 8
|
Journal inode: 8
|
||||||
First orphan inode: 6947324
|
First orphan inode: 6947324
|
||||||
Default directory hash: half_md4
|
Default directory hash: half_md4
|
||||||
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
||||||
Journal backup: inode blocks
|
Journal backup: inode blocks
|
||||||
Journal features: journal_incompat_revoke
|
Journal features: journal_incompat_revoke
|
||||||
Journal size: 128M
|
Journal size: 128M
|
||||||
Journal length: 32768
|
Journal length: 32768
|
||||||
Journal sequence: 0x00580f0c
|
Journal sequence: 0x00580f0c
|
||||||
Journal start: 12055
|
Journal start: 12055
|
||||||
```
|
```
|
||||||
|
|
||||||
You can pass the `-b` flag to display any blocks reserved as bad in the filesystem (no output implies to badblocks):
|
你可以通过 `-b` 标记去显示文件系统中的任何保留块,比如坏块(无输出说明没有坏块):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ dumpe2fs -b
|
$ dumpe2fs -b
|
||||||
```
|
```
|
||||||
|
|
||||||
### Checking EXT2/EXT3/EXT4 Filesystems For Errors
|
### 检查 EXT2/EXT3/EXT4 文件系统的错误
|
||||||
|
|
||||||
e2fsck is used to examine ext2/ext3/ext4 filesystems for errors and fsck checks and can optionally [repair a Linux filesystem][10]; it is basically a front-end for a range of filesystem checkers (fsck.fstype for example fsck.ext3, fsck.sfx etc) offered under Linux.
|
e2fsck 是用于去检查 ext2/ext3/ext4 文件系统的错误,并且 fsck 检查并可选去 [修复一个 Linux 文件系统][10];它实际上是底层 Linux 提供的一系列文件系统检查器 (示例中的fsck.fstype、fsck.ext3、fsck.sfx 等等) 的前端程序。
|
||||||
|
|
||||||
Remember that Linux runs e2fack/fsck automatically at system boot on partitions that are labeled for checking in /etc/fstab configuration file. This is normally done after a filesystem has not been unmounted cleanly.
|
记住,在系统引导时,Linux去检查 /etc/fstab 配置文件中的分区,并自动运行 e2fsck/fsck。在一个文件系统没有被干净地卸载之后,一般也会运行它。
|
||||||
|
|
||||||
Attention: Do not run e2fsck or fsck on mounted filesystems, always unmount a partition first before you can run these tools on it, as shown below.
|
注意:不要在已加载的文件系统上运行 e2fsck 或 fsck,在你运行这些工具之前,首先要去卸载一个分区,如下所示。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo unmount /dev/sda10
|
$ sudo unmount /dev/sda10
|
||||||
$ sudo fsck /dev/sda10
|
$ sudo fsck /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, enable verbose output with the `-V` switch and use the `-t` to specify a filesystem type like this:
|
或者,使用 `-V` 开关去启用详细输出,并且使用 `-t` 去指定文件系统类型,像这样:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo fsck -Vt ext4 /dev/sda10
|
$ sudo fsck -Vt ext4 /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tunning EXT2/EXT3/EXT4 Filesystems
|
### 调优 EXT2/EXT3/EXT4 文件系统
|
||||||
|
|
||||||
We mentioned from the start that one of the causes of filesystem damage is incorrect tunning. You can use the tune2fs utility to change the tunable parameters of ext2/ext3/ext4 filesystems as explained below.
|
我们前面提到过,导致文件系统损坏的其中一个因素就是不正确的调优。你可以使用 tune2fs 实用程序去改变 ext2/ext3/ext4 文件系统的可调优参数,像下面讲的那样。
|
||||||
|
|
||||||
To see the contents of the filesystem superblock, including the current values of the parameters, use the `-l` option as shown.
|
去查看文件系统的超级块,包括参数的当前值,使用 `-l` 选项,如下所示。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -l /dev/sda10
|
$ sudo tune2fs -l /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Sample Output
|
##### 示例输出
|
||||||
|
|
||||||
```
|
```
|
||||||
tune2fs 1.42.13 (17-May-2015)
|
tune2fs 1.42.13 (17-May-2015)
|
||||||
Filesystem volume name:
|
Filesystem volume name:
|
||||||
Last mounted on: /
|
Last mounted on: /
|
||||||
Filesystem UUID: bb29dda3-bdaa-4b39-86cf-4a6dc9634a1b
|
Filesystem UUID: bb29dda3-bdaa-4b39-86cf-4a6dc9634a1b
|
||||||
Filesystem magic number: 0xEF53
|
Filesystem magic number: 0xEF53
|
||||||
Filesystem revision #: 1 (dynamic)
|
Filesystem revision #: 1 (dynamic)
|
||||||
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
|
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
|
||||||
Filesystem flags: signed_directory_hash
|
Filesystem flags: signed_directory_hash
|
||||||
Default mount options: user_xattr acl
|
Default mount options: user_xattr acl
|
||||||
Filesystem state: clean
|
Filesystem state: clean
|
||||||
Errors behavior: Continue
|
Errors behavior: Continue
|
||||||
Filesystem OS type: Linux
|
Filesystem OS type: Linux
|
||||||
Inode count: 21544960
|
Inode count: 21544960
|
||||||
Block count: 86154752
|
Block count: 86154752
|
||||||
Reserved block count: 4307737
|
Reserved block count: 4307737
|
||||||
Free blocks: 22387732
|
Free blocks: 22387732
|
||||||
Free inodes: 21026406
|
Free inodes: 21026406
|
||||||
First block: 0
|
First block: 0
|
||||||
Block size: 4096
|
Block size: 4096
|
||||||
Fragment size: 4096
|
Fragment size: 4096
|
||||||
Reserved GDT blocks: 1003
|
Reserved GDT blocks: 1003
|
||||||
Blocks per group: 32768
|
Blocks per group: 32768
|
||||||
Fragments per group: 32768
|
Fragments per group: 32768
|
||||||
Inodes per group: 8192
|
Inodes per group: 8192
|
||||||
Inode blocks per group: 512
|
Inode blocks per group: 512
|
||||||
Flex block group size: 16
|
Flex block group size: 16
|
||||||
Filesystem created: Sun Jul 31 16:19:36 2016
|
Filesystem created: Sun Jul 31 16:19:36 2016
|
||||||
Last mount time: Mon Nov 6 10:25:28 2017
|
Last mount time: Mon Nov 6 10:25:28 2017
|
||||||
Last write time: Mon Nov 6 10:25:19 2017
|
Last write time: Mon Nov 6 10:25:19 2017
|
||||||
Mount count: 432
|
Mount count: 432
|
||||||
Maximum mount count: -1
|
Maximum mount count: -1
|
||||||
Last checked: Sun Jul 31 16:19:36 2016
|
Last checked: Sun Jul 31 16:19:36 2016
|
||||||
Check interval: 0 ()
|
Check interval: 0 ()
|
||||||
Lifetime writes: 2834 GB
|
Lifetime writes: 2834 GB
|
||||||
Reserved blocks uid: 0 (user root)
|
Reserved blocks uid: 0 (user root)
|
||||||
Reserved blocks gid: 0 (group root)
|
Reserved blocks gid: 0 (group root)
|
||||||
First inode: 11
|
First inode: 11
|
||||||
Inode size: 256
|
Inode size: 256
|
||||||
Required extra isize: 28
|
Required extra isize: 28
|
||||||
Desired extra isize: 28
|
Desired extra isize: 28
|
||||||
Journal inode: 8
|
Journal inode: 8
|
||||||
First orphan inode: 6947324
|
First orphan inode: 6947324
|
||||||
Default directory hash: half_md4
|
Default directory hash: half_md4
|
||||||
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
||||||
Journal backup: inode blocks
|
Journal backup: inode blocks
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, using the `-c` flag, you can set the number of mounts after which the filesystem will be checked by e2fsck. This command instructs the system to run e2fsck against `/dev/sda10`after every 4 mounts.
|
接下来,使用 `-c` 标识,你可以设置文件系统通过 e2fsck 检查后加载的分区数量。这个命令指示系统每加载 4 个分区之后,去对 `/dev/sda10` 运行 e2fsck。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -c 4 /dev/sda10
|
$ sudo tune2fs -c 4 /dev/sda10
|
||||||
tune2fs 1.42.13 (17-May-2015)
|
tune2fs 1.42.13 (17-May-2015)
|
||||||
Setting maximal mount count to 4
|
Setting maximal mount count to 4
|
||||||
```
|
```
|
||||||
|
|
||||||
You can as well define the time between two filesystem checks with the `-i` option. The following command sets an interval of 2 days between filesystem checks.
|
你也可以在两个文件系统检查之间,使用 `-i` 选项去定义一个时间。下列的命令在文件系统检查之间设置了一个 2 天的时间间隔。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -i 2d /dev/sda10
|
$ sudo tune2fs -i 2d /dev/sda10
|
||||||
tune2fs 1.42.13 (17-May-2015)
|
tune2fs 1.42.13 (17-May-2015)
|
||||||
Setting interval between checks to 172800 seconds
|
Setting interval between checks to 172800 seconds
|
||||||
```
|
```
|
||||||
|
|
||||||
Now if you run this command below, the filesystem check interval for `/dev/sda10` is now set.
|
现在,如果你运行下面的命令,对 `/dev/sda10` 已经设置了文件系统检查的时间间隔。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -l /dev/sda10
|
$ sudo tune2fs -l /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Sample Output
|
##### 示例输出
|
||||||
|
|
||||||
```
|
```
|
||||||
Filesystem created: Sun Jul 31 16:19:36 2016
|
Filesystem created: Sun Jul 31 16:19:36 2016
|
||||||
Last mount time: Mon Nov 6 10:25:28 2017
|
Last mount time: Mon Nov 6 10:25:28 2017
|
||||||
Last write time: Mon Nov 6 13:49:50 2017
|
Last write time: Mon Nov 6 13:49:50 2017
|
||||||
Mount count: 432
|
Mount count: 432
|
||||||
Maximum mount count: 4
|
Maximum mount count: 4
|
||||||
Last checked: Sun Jul 31 16:19:36 2016
|
Last checked: Sun Jul 31 16:19:36 2016
|
||||||
Check interval: 172800 (2 days)
|
Check interval: 172800 (2 days)
|
||||||
Next check after: Tue Aug 2 16:19:36 2016
|
Next check after: Tue Aug 2 16:19:36 2016
|
||||||
Lifetime writes: 2834 GB
|
Lifetime writes: 2834 GB
|
||||||
Reserved blocks uid: 0 (user root)
|
Reserved blocks uid: 0 (user root)
|
||||||
Reserved blocks gid: 0 (group root)
|
Reserved blocks gid: 0 (group root)
|
||||||
First inode: 11
|
First inode: 11
|
||||||
Inode size: 256
|
Inode size: 256
|
||||||
Required extra isize: 28
|
Required extra isize: 28
|
||||||
Desired extra isize: 28
|
Desired extra isize: 28
|
||||||
Journal inode: 8
|
Journal inode: 8
|
||||||
First orphan inode: 6947324
|
First orphan inode: 6947324
|
||||||
Default directory hash: half_md4
|
Default directory hash: half_md4
|
||||||
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
Directory Hash Seed: 9da5dafb-bded-494d-ba7f-5c0ff3d9b805
|
||||||
Journal backup: inode blocks
|
Journal backup: inode blocks
|
||||||
```
|
```
|
||||||
|
|
||||||
To change the default journaling parameters, use the `-J` option. This option also has sub-options: size=journal-size (sets the journal’s size), device=external-journal (specifies the device on which it’s stored) and location=journal-location (defines the location of the journal).
|
去改变缺省的日志参数,使用 `-J` 选项。这个选项也有一个子选项: size=journal-size (设置日志的大小)、device=external-journal (指定日志存储的设备)和 location=journal-location (定义日志的位置)。
|
||||||
|
|
||||||
Note that only one of the size or device options can be set for a filesystem:
|
注意,这里仅可以为文件系统设置一个日志大小或设备选项:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -J size=4MB /dev/sda10
|
$ sudo tune2fs -J size=4MB /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
Last but not least, the volume label of a filesystem can be set using the `-L` option as below.
|
最后,同样重要的是,可以去使用 `-L` 选项设置文件系统的卷标签,如下所示。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo tune2fs -L "ROOT" /dev/sda10
|
$ sudo tune2fs -L "ROOT" /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
### Debug EXT2/EXT3/EXT4 Filesystems
|
### 调试 EXT2/EXT3/EXT4 文件系统
|
||||||
|
|
||||||
debugfs is an simple, interactive command line based ext2/ext3/ext4 filesystems debugger. It allows you to modify filesystem parameters interactively. To view sub-commands or requests, type `"?"`.
|
debugfs 是一个简单的、交互式的、基于 ext2/ext3/ext4 文件系统的命令行调试器。它允许你去交互式地修改文件系统参数。输入 `"?"`,去查看子命令或要求。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo debugfs /dev/sda10
|
$ sudo debugfs /dev/sda10
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, the filesystem should be opened in read-write mode, use the `-w` flag to open it in read-write mode. To open it in catastrophic mode, use the `-c` option.
|
缺省情况下,文件系统将以读写模式打开,使用 `-w` 标识去以读写模式打开它。使用 `-c` 选项以灾难(catastrophic)模式打开它。
|
||||||
|
|
||||||
##### Sample Output
|
##### 示例输出
|
||||||
|
|
||||||
```
|
```
|
||||||
debugfs 1.42.13 (17-May-2015)
|
debugfs 1.42.13 (17-May-2015)
|
||||||
debugfs: ?
|
debugfs: ?
|
||||||
Available debugfs requests:
|
Available debugfs requests:
|
||||||
show_debugfs_params, params
|
show_debugfs_params, params
|
||||||
Show debugfs parameters
|
Show debugfs parameters
|
||||||
open_filesys, open Open a filesystem
|
open_filesys, open Open a filesystem
|
||||||
close_filesys, close Close the filesystem
|
close_filesys, close Close the filesystem
|
||||||
freefrag, e2freefrag Report free space fragmentation
|
freefrag, e2freefrag Report free space fragmentation
|
||||||
feature, features Set/print superblock features
|
feature, features Set/print superblock features
|
||||||
dirty_filesys, dirty Mark the filesystem as dirty
|
dirty_filesys, dirty Mark the filesystem as dirty
|
||||||
init_filesys Initialize a filesystem (DESTROYS DATA)
|
init_filesys Initialize a filesystem (DESTROYS DATA)
|
||||||
show_super_stats, stats Show superblock statistics
|
show_super_stats, stats Show superblock statistics
|
||||||
ncheck Do inode->name translation
|
ncheck Do inode->name translation
|
||||||
icheck Do block->inode translation
|
icheck Do block->inode translation
|
||||||
change_root_directory, chroot
|
change_root_directory, chroot
|
||||||
....
|
....
|
||||||
```
|
```
|
||||||
|
|
||||||
To show free space fragmentation, use the freefrag request, like so.
|
去展示未使用空间的碎片,必须使用 `freefrag`,像这样。
|
||||||
|
|
||||||
```
|
```
|
||||||
debugfs: freefrag
|
debugfs: freefrag
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Sample Output
|
##### 示例输出
|
||||||
|
|
||||||
```
|
```
|
||||||
Device: /dev/sda10
|
Device: /dev/sda10
|
||||||
Blocksize: 4096 bytes
|
Blocksize: 4096 bytes
|
||||||
Total blocks: 86154752
|
Total blocks: 86154752
|
||||||
Free blocks: 22387732 (26.0%)
|
Free blocks: 22387732 (26.0%)
|
||||||
Min. free extent: 4 KB
|
Min. free extent: 4 KB
|
||||||
Max. free extent: 2064256 KB
|
Max. free extent: 2064256 KB
|
||||||
Avg. free extent: 2664 KB
|
Avg. free extent: 2664 KB
|
||||||
Num. free extent: 33625
|
Num. free extent: 33625
|
||||||
HISTOGRAM OF FREE EXTENT SIZES:
|
HISTOGRAM OF FREE EXTENT SIZES:
|
||||||
Extent Size Range : Free extents Free Blocks Percent
|
Extent Size Range : Free extents Free Blocks Percent
|
||||||
4K... 8K- : 4883 4883 0.02%
|
4K... 8K- : 4883 4883 0.02%
|
||||||
8K... 16K- : 4029 9357 0.04%
|
8K... 16K- : 4029 9357 0.04%
|
||||||
16K... 32K- : 3172 15824 0.07%
|
16K... 32K- : 3172 15824 0.07%
|
||||||
32K... 64K- : 2523 27916 0.12%
|
32K... 64K- : 2523 27916 0.12%
|
||||||
64K... 128K- : 2041 45142 0.20%
|
64K... 128K- : 2041 45142 0.20%
|
||||||
128K... 256K- : 2088 95442 0.43%
|
128K... 256K- : 2088 95442 0.43%
|
||||||
256K... 512K- : 2462 218526 0.98%
|
256K... 512K- : 2462 218526 0.98%
|
||||||
512K... 1024K- : 3175 571055 2.55%
|
512K... 1024K- : 3175 571055 2.55%
|
||||||
1M... 2M- : 4551 1609188 7.19%
|
1M... 2M- : 4551 1609188 7.19%
|
||||||
2M... 4M- : 2870 1942177 8.68%
|
2M... 4M- : 2870 1942177 8.68%
|
||||||
4M... 8M- : 1065 1448374 6.47%
|
4M... 8M- : 1065 1448374 6.47%
|
||||||
8M... 16M- : 364 891633 3.98%
|
8M... 16M- : 364 891633 3.98%
|
||||||
16M... 32M- : 194 984448 4.40%
|
16M... 32M- : 194 984448 4.40%
|
||||||
32M... 64M- : 86 873181 3.90%
|
32M... 64M- : 86 873181 3.90%
|
||||||
64M... 128M- : 77 1733629 7.74%
|
64M... 128M- : 77 1733629 7.74%
|
||||||
128M... 256M- : 11 490445 2.19%
|
128M... 256M- : 11 490445 2.19%
|
||||||
256M... 512M- : 10 889448 3.97%
|
256M... 512M- : 10 889448 3.97%
|
||||||
512M... 1024M- : 2 343904 1.54%
|
512M... 1024M- : 2 343904 1.54%
|
||||||
1G... 2G- : 22 10217801 45.64%
|
1G... 2G- : 22 10217801 45.64%
|
||||||
debugfs:
|
debugfs:
|
||||||
```
|
```
|
||||||
|
|
||||||
You can explore so many other requests such as creating or removing files or directories, changing the current working directory and much more, by simply reading the brief description provided. To quit debugfs, use the `q` request.
|
通过去简单浏览提供的详细描述,你可以探索更多的其它需求,比如,创建或删除文件或目录,改变当前工作目录等等。去退出 debugfs,使用 `q`。
|
||||||
|
|
||||||
That’s all for now! We have a collection of related articles under different categories below, which you will find useful.
|
现在就这些!我们收集了不同分类下的相关文章,你可以在里面找到对你有用的内容。
|
||||||
|
|
||||||
#### Filesystem Usage Information:
|
#### 文件系统使用信息:
|
||||||
|
|
||||||
1. [12 Useful “df” Commands to Check Disk Space in Linux][1]
|
1. [12 Useful “df” Commands to Check Disk Space in Linux][1]
|
||||||
|
|
||||||
2. [Pydf an Alternative “df” Command to Check Disk Usage in Different Colours][2]
|
2. [Pydf an Alternative “df” Command to Check Disk Usage in Different Colours][2]
|
||||||
|
|
||||||
3. [10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories][3]
|
3. [10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories][3]
|
||||||
|
|
||||||
#### Check Disk or Partition Health:
|
#### 检查磁盘或分区健康状况:
|
||||||
|
|
||||||
1. [3 Useful GUI and Terminal Based Linux Disk Scanning Tools][4]
|
1. [3 Useful GUI and Terminal Based Linux Disk Scanning Tools][4]
|
||||||
|
|
||||||
2. [How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux][5]
|
2. [How to Check Bad Sectors or Bad Blocks on Hard Disk in Linux][5]
|
||||||
|
|
||||||
3. [How to Repair and Defragment Linux System Partitions and Directories][6]
|
3. [How to Repair and Defragment Linux System Partitions and Directories][6]
|
||||||
|
|
||||||
Maintaining a healthy filesystem always improves the overall performance of your Linux system. If you have any questions or additional thoughts to share use the comment form below.
|
维护一个健康的文件系统可以提升你的 Linux 系统的整体性能。如果你有任何问题或更多的想法,可以使用下面的评论去分享。
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
via: https://www.tecmint.com/manage-ext2-ext3-and-ext4-health-in-linux/
|
via: https://www.tecmint.com/manage-ext2-ext3-and-ext4-health-in-linux/
|
||||||
|
|
||||||
作者:[Aaron Kili][a]
|
作者:[Aaron Kili][a]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[qhwdw](https://github.com/qhwdw)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
[a]:https://www.tecmint.com/author/aaronkili/
|
[a]:https://www.tecmint.com/author/aaronkili/
|
||||||
[1]:https://www.tecmint.com/how-to-check-disk-space-in-linux/
|
[1]:https://www.tecmint.com/how-to-check-disk-space-in-linux/
|
||||||
[2]:https://www.tecmint.com/pyd-command-to-check-disk-usage/
|
[2]:https://www.tecmint.com/pyd-command-to-check-disk-usage/
|
||||||
[3]:https://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/
|
[3]:https://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/
|
||||||
[4]:https://www.tecmint.com/linux-disk-scanning-tools/
|
[4]:https://www.tecmint.com/linux-disk-scanning-tools/
|
||||||
[5]:https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
|
[5]:https://www.tecmint.com/check-linux-hard-disk-bad-sectors-bad-blocks/
|
||||||
[6]:https://www.tecmint.com/defragment-linux-system-partitions-and-directories/
|
[6]:https://www.tecmint.com/defragment-linux-system-partitions-and-directories/
|
||||||
[7]:https://www.tecmint.com/find-linux-filesystem-type/
|
[7]:https://www.tecmint.com/find-linux-filesystem-type/
|
||||||
[8]:https://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
|
[8]:https://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
|
||||||
[9]:https://www.tecmint.com/how-to-check-disk-space-in-linux/
|
[9]:https://www.tecmint.com/how-to-check-disk-space-in-linux/
|
||||||
[10]:https://www.tecmint.com/defragment-linux-system-partitions-and-directories/
|
[10]:https://www.tecmint.com/defragment-linux-system-partitions-and-directories/
|
||||||
[11]:https://www.tecmint.com/author/aaronkili/
|
[11]:https://www.tecmint.com/author/aaronkili/
|
||||||
[12]:https://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/
|
[12]:https://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/
|
||||||
[13]:https://www.tecmint.com/free-linux-shell-scripting-books/
|
[13]:https://www.tecmint.com/free-linux-shell-scripting-books/
|
Loading…
Reference in New Issue
Block a user