创建文件系统实战篇
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.EXT系列文件系统专用管理工具-mkfs
1>.查看mkfs命令
[root@yinzhengjie.com ~]# mkfs #想要查看更详细的信息可参考"man mkfs"帮助信息 Usage: mkfs [options] [-t <type>] [fs-options] <device> [<size>] Options: -t, --type=<type> filesystem type; when unspecified, ext2 is used fs-options parameters for the real filesystem builder <device> path to the device to be used <size> number of blocks to be used on the device -V, --verbose explain what is being done; specifying -V more than once will cause a dry-run -V, --version display version information and exit; -V as --version must be the only option -h, --help display this help text and exit For more information see mkfs(8). [root@yinzhengjie.com ~]#
2>.使用mkfs命令创建指定类型的文件系统
[root@yinzhengjie.com ~]# lsblk /dev/sdb NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 600G 0 disk ├─sdb1 8:17 0 100G 0 part ├─sdb2 8:18 0 200G 0 part ├─sdb3 8:19 0 1K 0 part ├─sdb5 8:21 0 100G 0 part └─sdb6 8:22 0 80G 0 part [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# mkfs -t ext3 /dev/sdb2 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 13107200 inodes, 52428800 blocks 2621440 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 1600 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb2 /dev/sdb2: UUID="75c5448c-1c6f-4f5e-a044-209d5b8b8f4a" SEC_TYPE="ext2" TYPE="ext3" [root@yinzhengjie.com ~]#
二.EXT系列文件系统专用管理工具-mke2fs
1>.mke2fs概述
mke2fs是ext系列文件系统专用管理工具,其常用参数如下: -t {ext2|ext3|ext4}:
指定文件系统类型,默认创建的是ext2文件系统类型,而ext2的文件系统基本上被淘汰了,因为它不支持日志功能。 -b {1024|2048|4096}:
指定块大小 -L ‘LABEL’:
设置卷标 -j:
相当于"-t ext3",注意,这几个命令是等效的"mkfs.ext3 = mkfs -t ext3 = mke2fs -j = mke2fs -t ext3",生产环境推荐大家使用“mkfs.文件系统类型”的方式创建文件系统,比如"mkfs.xfs" -i:
为数据空间中每多少个字节创建一个inode;不应该小于block大小 -N:
指定分区中创建多少个inode -I:
一个inode记录占用的磁盘空间大小,128---4096 -m:
为管理人员预留磁盘空间占总空间的百分比,默认5%,在特定场景下需要可以调小,比如"0.1%" -O FEATURE[,...]:
启用指定特性 -O ^FEATURE:
关闭指定特性
[root@yinzhengjie.com ~]# mke2fs Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size] [-i bytes-per-inode] [-I inode-size] [-J journal-options] [-G flex-group-size] [-N number-of-inodes] [-m reserved-blocks-percentage] [-o creator-os] [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]] [-t fs-type] [-T usage-type ] [-U UUID] [-jnqvDFKSV] device [blocks-count] [root@yinzhengjie.com ~]#
2>.mke2fs默认创建的是ext2文件系统类型
[root@yinzhengjie.com ~]# lsblk /dev/sdb NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 600G 0 disk ├─sdb1 8:17 0 100G 0 part ├─sdb2 8:18 0 200G 0 part ├─sdb3 8:19 0 1K 0 part ├─sdb5 8:21 0 100G 0 part └─sdb6 8:22 0 80G 0 part [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# mke2fs /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 6553600 inodes, 26214400 blocks 1310720 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 800 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Allocating group tables: done Writing inode tables: done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb1 /dev/sdb1: UUID="d5819b04-a9c3-4a10-a09c-ed1284c36658" TYPE="ext2" [root@yinzhengjie.com ~]#
3>.创建文件系统时自定义块(block)大小
[root@yinzhengjie.com ~]# lsblk /dev/sdb NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 600G 0 disk ├─sdb1 8:17 0 100G 0 part ├─sdb2 8:18 0 200G 0 part ├─sdb3 8:19 0 1K 0 part ├─sdb5 8:21 0 100G 0 part └─sdb6 8:22 0 80G 0 part [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# mkfs.ext4 -b 1024 /dev/sdb5 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 6553600 inodes, 104857600 blocks 5242880 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=138412032 12800 block groups 8192 blocks per group, 8192 fragments per group 512 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 1024001, 1990657, 2809857, 5120001, 5971969, 17915905, 19668993, 25600001, 53747713 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb5 /dev/sdb5: UUID="d65349e8-3c72-4cc3-a7f4-406cfa2c7d29" TYPE="ext4" [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb5 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d65349e8-3c72-4cc3-a7f4-406cfa2c7d29 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 5242880 Free blocks: 103140734 Free inodes: 6553589 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:01:07 2020 Last mount time: n/a Last write time: Wed May 27 06:01:08 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 06:01:07 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 7205ff80-a245-4335-b2f3-15c1eebf75e8 Journal backup: inode blocks [root@yinzhengjie.com ~]#
4>.指定预留空间的百分比
[root@yinzhengjie.com ~]# mkfs.ext4 -b 1024 -m 0.1 /dev/sdb5 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 6553600 inodes, 104857600 blocks 104857 blocks (0.10%) reserved for the super user First data block=1 Maximum filesystem blocks=138412032 12800 block groups 8192 blocks per group, 8192 fragments per group 512 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 1024001, 1990657, 2809857, 5120001, 5971969, 17915905, 19668993, 25600001, 53747713 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb5 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 0e1581cf-51a9-4f5a-b1ad-635ac3364578 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 104857 Free blocks: 103140734 Free inodes: 6553589 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:17:57 2020 Last mount time: n/a Last write time: Wed May 27 06:17:58 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 06:17:57 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: c9f747cb-080f-47b7-9af2-4b82205c6094 Journal backup: inode blocks [root@yinzhengjie.com ~]#
5>.指定卷标
[root@yinzhengjie.com ~]# lsblk /dev/sdb NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 600G 0 disk ├─sdb1 8:17 0 100G 0 part ├─sdb2 8:18 0 200G 0 part ├─sdb3 8:19 0 1K 0 part ├─sdb5 8:21 0 100G 0 part └─sdb6 8:22 0 80G 0 part [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# mkfs.ext4 -b 1024 -m 0.1 -L "/mnt/sdb6" /dev/sdb6 mke2fs 1.42.9 (28-Dec-2013) Filesystem label=/mnt/sdb6 OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 5242880 inodes, 83886080 blocks 83886 blocks (0.10%) reserved for the super user First data block=1 Maximum filesystem blocks=117440512 10240 block groups 8192 blocks per group, 8192 fragments per group 512 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 1024001, 1990657, 2809857, 5120001, 5971969, 17915905, 19668993, 25600001, 53747713 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb6 /dev/sdb6: LABEL="/mnt/sdb6" UUID="27589e56-158f-4898-91f9-3d052b5978d7" TYPE="ext4" [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb6 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: /mnt/sdb6 Last mounted on: <not available> Filesystem UUID: 27589e56-158f-4898-91f9-3d052b5978d7 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 5242880 Block count: 83886080 Reserved block count: 83886 Free blocks: 82505054 Free inodes: 5242869 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 12:52:41 2020 Last mount time: n/a Last write time: Wed May 27 12:52:42 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 12:52:41 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: d8d16075-4b5b-416a-bd87-919bbf8505a4 Journal backup: inode blocks [root@yinzhengjie.com ~]#
温馨提示:
我们可以使用设备名(比如/dev/sdb6),卷标名(比如“/mnt/sdb6”),UUID来表示一个分区,但我们推荐使用后者,因为UUID可以唯一标识一个设备,而设备名和卷标名并不能唯一标识。比如删除第一个分区时,后面的所有分区编号均会发生变化。
6>.为数据空间中每多少字节创建一个inode(不应该小于块大小)
[root@yinzhengjie.com ~]# mkfs.ext4 -i 1024 -b 4096 /dev/sdb6 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 83886080 inodes, 20971520 blocks 1048576 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=557842432 2560 block groups 8192 blocks per group, 8192 fragments per group 32768 inodes per group Superblock backups stored on blocks: 8192, 24576, 40960, 57344, 73728, 204800, 221184, 401408, 663552, 1024000, 1990656, 2809856, 5120000, 5971968, 17915904, 19668992 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb6 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: b07c5586-5b05-4334-91d2-599098f3e222 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 83886080 Block count: 20971520 Reserved block count: 1048576 Free blocks: 15672641 Free inodes: 83886069 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1024 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 32768 Inode blocks per group: 2048 Flex block group size: 16 Filesystem created: Wed May 27 13:02:27 2020 Last mount time: n/a Last write time: Wed May 27 13:02:29 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 13:02:27 2020 Check interval: 0 (<none>) Lifetime writes: 135 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 62d5b9a5-db23-4cec-9c14-dbd1b7499870 Journal backup: inode blocks [root@yinzhengjie.com ~]#
温馨提示:
上面我有意将inode大小设置的比block大小要小,其实这样做是毫无意义的,我们通过tune2fs命令也可以看出最终的结果是indoe数量要比block数量要大。
我们知道一个块大小是存储的基本单元,而一个inode就得占用一个块来存储,而在block数量小于inode数量的情况下,我们会发现在存储数据时,inode还没有使用完,block会先被使用完啦。
7>.指定分区中创建多少个inode
[root@yinzhengjie.com ~]# mkfs.ext4 -N 65536 -b 4096 /dev/sdb6 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 71680 inodes, 20971520 blocks 1048576 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2168455168 640 block groups 32768 blocks per group, 32768 fragments per group 112 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb6 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: ffaaa3c4-cb73-4d7c-af57-6b2cc24a1929 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 71680 Block count: 20971520 Reserved block count: 1048576 Free blocks: 20918496 Free inodes: 71669 First block: 0 Block size: 4096 Fragment size: 4096 Group descriptor size: 64 Reserved GDT blocks: 1024 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 112 Inode blocks per group: 7 Flex block group size: 16 Filesystem created: Wed May 27 13:13:31 2020 Last mount time: n/a Last write time: Wed May 27 13:13:32 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 13:13:31 2020 Check interval: 0 (<none>) Lifetime writes: 132 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: f424d3ee-64c5-4bdc-96dd-2525621d38e3 Journal backup: inode blocks [root@yinzhengjie.com ~]#
三.重新设定EXT系列文件系统可调整参数的值-tune2f2
1>.tune2fs概述
tune2fs是用于重新设定ext系列文件系统可调整参数的值,其常用参数如下: -l:
查看指定文件系统超级块信息;super block -L:
'LABEL‘修改卷标 -m:
修预留给管理员的空间百分比 -j:
将ext2升级为ext3 -O:
文件系统属性启用或禁用,–O ^has_journal -o:
调整文件系统的默认挂载选项,–o ^acl -U UUID:
修改UUID号
[root@yinzhengjie.com ~]# tune2fs tune2fs 1.42.9 (28-Dec-2013) Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-g group] [-i interval[d|m|w]] [-j] [-J journal_options] [-l] [-m reserved_blocks_percent] [-o [^]mount_options[,...]] [-p mmp_update_interval] [-r reserved_blocks_count] [-u user] [-C mount_count] [-L volume_label] [-M last_mounted_dir] [-O [^]feature[,...]] [-E extended-option[,...]] [-T last_check_time] [-U UUID] [ -I new_inode_size ] device [root@yinzhengjie.com ~]#
2>.查看指定文件系统超级块信息
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d5819b04-a9c3-4a10-a09c-ed1284c36658 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file #很明显。EXT2文件系统类型是不支持日志功能的,因为它没有"has_journal"功能。 Filesystem flags: signed_directory_hash Default mount options: user_xattr acl #默认的挂载选项,在CentOS 7默认支持ACL功能,但是在CentOS 6默认为"none"(这意味着如果CentOS 6.x在挂载时没有指定ACL选项就无法使用ACL功能) Filesystem state: clean #文件系统状态为"clean"表示文件系统是没有问题的,若文件系统出现问题时,该值为"no clean",需要使用相应的工具进行修复。 Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 #Inode的总数量 Block count: 26214400 #块的数量 Reserved block count: 1310720 #保留的块数量,默认是"5%",生产环境可以自行调整。 Free blocks: 25787819 #空闲的blocks数量 Free inodes: 6553589 #Inode的空闲数量 First block: 0 Block size: 4096 #块的大小 Fragment size: 4096 Reserved GDT blocks: 1017 Blocks per group: 32768 #每个组有多少个块 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Filesystem created: Wed May 27 05:37:08 2020 Last mount time: n/a Last write time: Wed May 27 05:37:50 2020 Mount count: 0 #挂载次数 Maximum mount count: -1 #最大挂载次数 Last checked: Wed May 27 05:37:08 2020 Check interval: 0 (<none>) #检查间隔 Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 #一个Inode记录占用磁盘空间大小默认是256个字节。我们可以自定义该inode占用空间大小,取值范围[128,4096],通常情况下保持默认即可。 Required extra isize: 28 Desired extra isize: 28 Default directory hash: half_md4 Directory Hash Seed: 4256aab3-4776-4711-8aee-1bcb4f54cc39 [root@yinzhengjie.com ~]#
3>.文件系统启用功能(为ext2文件系统指定日志功能会变成ext3文件系统)
[root@yinzhengjie.com ~]# blkid /dev/sdb1 /dev/sdb1: UUID="d5819b04-a9c3-4a10-a09c-ed1284c36658" TYPE="ext2" [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d5819b04-a9c3-4a10-a09c-ed1284c36658 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 26214400 Reserved block count: 1310720 Free blocks: 25787819 Free inodes: 6553589 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1017 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Filesystem created: Wed May 27 05:37:08 2020 Last mount time: n/a Last write time: Wed May 27 05:37:50 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 05:37:08 2020 Check interval: 0 (<none>) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Default directory hash: half_md4 Directory Hash Seed: 4256aab3-4776-4711-8aee-1bcb4f54cc39 [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -O has_journal /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Creating journal inode: done [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d5819b04-a9c3-4a10-a09c-ed1284c36658 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_file Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 26214400 Reserved block count: 1310720 Free blocks: 25755018 Free inodes: 6553589 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1017 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Filesystem created: Wed May 27 05:37:08 2020 Last mount time: n/a Last write time: Wed May 27 13:17:30 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 05:37:08 2020 Check interval: 0 (<none>) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 4256aab3-4776-4711-8aee-1bcb4f54cc39 Journal backup: inode blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb1 /dev/sdb1: UUID="d5819b04-a9c3-4a10-a09c-ed1284c36658" SEC_TYPE="ext2" TYPE="ext3" [root@yinzhengjie.com ~]#
4>.文件系统禁用has_journal功能(为ext3文件系统去掉日志功能会编程ext2文件系统)
[root@yinzhengjie.com ~]# blkid /dev/sdb1 /dev/sdb1: UUID="d5819b04-a9c3-4a10-a09c-ed1284c36658" SEC_TYPE="ext2" TYPE="ext3" [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d5819b04-a9c3-4a10-a09c-ed1284c36658 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype sparse_super large_file Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 26214400 Reserved block count: 1310720 Free blocks: 25755018 Free inodes: 6553589 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1017 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Filesystem created: Wed May 27 05:37:08 2020 Last mount time: n/a Last write time: Wed May 27 13:17:30 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 05:37:08 2020 Check interval: 0 (<none>) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 4256aab3-4776-4711-8aee-1bcb4f54cc39 Journal backup: inode blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -O ^has_journal /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb1 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: d5819b04-a9c3-4a10-a09c-ed1284c36658 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 26214400 Reserved block count: 1310720 Free blocks: 25787819 Free inodes: 6553589 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 1017 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Filesystem created: Wed May 27 05:37:08 2020 Last mount time: n/a Last write time: Wed May 27 13:24:20 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 05:37:08 2020 Check interval: 0 (<none>) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Default directory hash: half_md4 Directory Hash Seed: 4256aab3-4776-4711-8aee-1bcb4f54cc39 Journal backup: inode blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb1 /dev/sdb1: UUID="d5819b04-a9c3-4a10-a09c-ed1284c36658" TYPE="ext2" [root@yinzhengjie.com ~]#
四.EXT系统文件系列块分组管理-dumpe2fs
1>.默认显示分组信息
[root@yinzhengjie.com ~]# dumpe2fs /dev/sdb5 dumpe2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 0e1581cf-51a9-4f5a-b1ad-635ac3364578 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 104857 Free blocks: 103140734 Free inodes: 6553589 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:17:57 2020 Last mount time: n/a Last write time: Wed May 27 06:17:58 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 06:17:57 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: c9f747cb-080f-47b7-9af2-4b82205c6094 Journal backup: inode blocks Journal features: (none) Journal size: 32M Journal length: 32768 Journal sequence: 0x00000001 Journal start: 0 Group 0: (Blocks 1-8192) Checksum 0x2b44, unused inodes 501 Primary superblock at 1, Group descriptors at 2-801 Reserved GDT blocks at 802-1057 Block bitmap at 1058 (+1057), Inode bitmap at 1074 (+1073) Inode table at 1090-1217 (+1089) 5041 free blocks, 501 free inodes, 2 directories, 501 unused inodes Free blocks: 3152-8192 Free inodes: 12-512 Group 1: (Blocks 8193-16384) [INODE_UNINIT] Checksum 0x2b24, unused inodes 512 Backup superblock at 8193, Group descriptors at 8194-8993 Reserved GDT blocks at 8994-9249 Block bitmap at 1059 (bg #0 + 1058), Inode bitmap at 1075 (bg #0 + 1074) Inode table at 1218-1345 (bg #0 + 1217) 7135 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 9250-16384 Free inodes: 513-1024 Group 2: (Blocks 16385-24576) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0x708b, unused inodes 512 Block bitmap at 1060 (bg #0 + 1059), Inode bitmap at 1076 (bg #0 + 1075) Inode table at 1346-1473 (bg #0 + 1345) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 16385-24576 Free inodes: 1025-1536 Group 3: (Blocks 24577-32768) [INODE_UNINIT] Checksum 0xc014, unused inodes 512 Backup superblock at 24577, Group descriptors at 24578-25377 Reserved GDT blocks at 25378-25633 Block bitmap at 1061 (bg #0 + 1060), Inode bitmap at 1077 (bg #0 + 1076) Inode table at 1474-1601 (bg #0 + 1473) 7135 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 25634-32768 Free inodes: 1537-2048 Group 4: (Blocks 32769-40960) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0xc5c7, unused inodes 512 Block bitmap at 1062 (bg #0 + 1061), Inode bitmap at 1078 (bg #0 + 1077) Inode table at 1602-1729 (bg #0 + 1601) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 32769-40960 Free inodes: 2049-2560 Group 5: (Blocks 40961-49152) [INODE_UNINIT] Checksum 0x7558, unused inodes 512 Backup superblock at 40961, Group descriptors at 40962-41761 Reserved GDT blocks at 41762-42017 Block bitmap at 1063 (bg #0 + 1062), Inode bitmap at 1079 (bg #0 + 1078) Inode table at 1730-1857 (bg #0 + 1729) 7135 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 42018-49152 Free inodes: 2561-3072 Group 6: (Blocks 49153-57344) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0xe6e8, unused inodes 512 Block bitmap at 1064 (bg #0 + 1063), Inode bitmap at 1080 (bg #0 + 1079) Inode table at 1858-1985 (bg #0 + 1857) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 49153-57344 Free inodes: 3073-3584 Group 7: (Blocks 57345-65536) [INODE_UNINIT] Checksum 0x5677, unused inodes 512 Backup superblock at 57345, Group descriptors at 57346-58145 Reserved GDT blocks at 58146-58401 Block bitmap at 1065 (bg #0 + 1064), Inode bitmap at 1081 (bg #0 + 1080) Inode table at 1986-2113 (bg #0 + 1985) 7135 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 58402-65536 Free inodes: 3585-4096 Group 8: (Blocks 65537-73728) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0x0b8f, unused inodes 512 Block bitmap at 1066 (bg #0 + 1065), Inode bitmap at 1082 (bg #0 + 1081) Inode table at 2114-2241 (bg #0 + 2113) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 65537-73728 Free inodes: 4097-4608 Group 9: (Blocks 73729-81920) [INODE_UNINIT] Checksum 0xbb10, unused inodes 512 Backup superblock at 73729, Group descriptors at 73730-74529 Reserved GDT blocks at 74530-74785 Block bitmap at 1067 (bg #0 + 1066), Inode bitmap at 1083 (bg #0 + 1082) Inode table at 2242-2369 (bg #0 + 2241) 7135 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 74786-81920 Free inodes: 4609-5120 Group 10: (Blocks 81921-90112) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0xe0bf, unused inodes 512 Block bitmap at 1068 (bg #0 + 1067), Inode bitmap at 1084 (bg #0 + 1083) ...... Group 12796: (Blocks 104824833-104833024) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0x82eb, unused inodes 512 Block bitmap at 104726541 (bg #12784 + 12), Inode bitmap at 104726557 (bg #12784 + 28) Inode table at 104728097-104728224 (bg #12784 + 1568) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 104824833-104833024 Free inodes: 6551553-6552064 Group 12797: (Blocks 104833025-104841216) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0xf773, unused inodes 512 Block bitmap at 104726542 (bg #12784 + 13), Inode bitmap at 104726558 (bg #12784 + 29) Inode table at 104728225-104728352 (bg #12784 + 1696) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 104833025-104841216 Free inodes: 6552065-6552576 Group 12798: (Blocks 104841217-104849408) [INODE_UNINIT, BLOCK_UNINIT] Checksum 0xadd5, unused inodes 512 Block bitmap at 104726543 (bg #12784 + 14), Inode bitmap at 104726559 (bg #12784 + 30) Inode table at 104728353-104728480 (bg #12784 + 1824) 8192 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 104841217-104849408 Free inodes: 6552577-6553088 Group 12799: (Blocks 104849409-104857599) [INODE_UNINIT] Checksum 0xea16, unused inodes 512 Block bitmap at 104726544 (bg #12784 + 15), Inode bitmap at 104726560 (bg #12784 + 31) Inode table at 104728481-104728608 (bg #12784 + 1952) 8191 free blocks, 512 free inodes, 0 directories, 512 unused inodes Free blocks: 104849409-104857599 Free inodes: 6553089-6553600 [root@yinzhengjie.com ~]#
2>.查看超级块信息,不显示分组信息(等效于"tune2fs -l"选项)
[root@yinzhengjie.com ~]# dumpe2fs -h /dev/sdb5 dumpe2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 0e1581cf-51a9-4f5a-b1ad-635ac3364578 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 104857 Free blocks: 103140734 Free inodes: 6553589 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:17:57 2020 Last mount time: n/a Last write time: Wed May 27 06:17:58 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 06:17:57 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: c9f747cb-080f-47b7-9af2-4b82205c6094 Journal backup: inode blocks Journal features: (none) Journal size: 32M Journal length: 32768 Journal sequence: 0x00000001 Journal start: 0 [root@yinzhengjie.com ~]#
五.创建CentOS 7默认的XFS文件系统
[root@yinzhengjie.com ~]# mkfs.xfs -f /dev/sdb1 #如果"/dev/sdb1"这个分区已经有文件系统了,此时我们想要创建XFS文件系统需要加"-f"参数强制创建XFS文件系统。 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6553600 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=26214400, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=12800, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@yinzhengjie.com ~]#
六.管理ext系列文件系统的LABEL工具-e2lable
[root@yinzhengjie.com ~]# blkid /dev/sdb2 /dev/sdb2: UUID="15028503-abd5-4bc7-9e35-2e745662d42d" TYPE="ext4" [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# e2label /dev/sdb2 /mnt/sdb2 #为EXT系列的文件系统加卷标 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# blkid /dev/sdb2 /dev/sdb2: LABEL="/mnt/sdb2" UUID="15028503-abd5-4bc7-9e35-2e745662d42d" TYPE="ext4" [root@yinzhengjie.com ~]#
七.块设备属性信息查看-blkid
1>.blkid帮助信息
[root@yinzhengjie.com ~]# blkid -help blkid from util-linux 2.23.2 (libblkid 2.23.0, 25-Apr-2013) Usage: blkid -L <label> | -U <uuid> blkid [-c <file>] [-ghlLv] [-o <format>] [-s <tag>] [-t <token>] [<dev> ...] blkid -p [-s <tag>] [-O <offset>] [-S <size>] [-o <format>] <dev> ... blkid -i [-s <tag>] [-o <format>] <dev> ... Options: -c <file> read from <file> instead of reading from the default cache file (-c /dev/null means no cache) -d don't encode non-printing characters -h print this usage message and exit -g garbage collect the blkid cache -o <format> output format; can be one of: value, device, export or full; (default: full) -k list all known filesystems/RAIDs and exit -s <tag> show specified tag(s) (default show all tags) -t <token> find device with a specific token (NAME=value pair) -l look up only first device with token specified by -t -L <label> convert LABEL to device name -U <uuid> convert UUID to device name -V print version and exit <dev> specify device(s) to probe (default: all devices) Low-level probing options: -p low-level superblocks probing (bypass cache) -i gather information about I/O limits -S <size> overwrite device size -O <offset> probe at the given offset -u <list> filter by "usage" (e.g. -u filesystem,raid) -n <list> filter by filesystem type (e.g. -n vfat,ext3) [root@yinzhengjie.com ~]#
2>.blkid默认查看所有的设备属性信息
[root@yinzhengjie.com ~]# blkid /dev/sdb1: UUID="da883b9f-c5e6-4dee-8376-dfbae3eac795" TYPE="xfs" /dev/sdb2: LABEL="/mnt/sdb2" UUID="15028503-abd5-4bc7-9e35-2e745662d42d" TYPE="ext4" /dev/sdb5: UUID="0e1581cf-51a9-4f5a-b1ad-635ac3364578" TYPE="ext4" /dev/sda2: UUID="1865a93f-6113-4097-89dc-8c4ea5fdf68c" TYPE="xfs" PARTUUID="e85154fa-bbc8-43c1-90f0-676000195a97" /dev/sda3: UUID="lNmzXe-Whhd-NTtI-C55A-7m4x-CudG-1Q556q" TYPE="LVM2_member" PARTUUID="fa2e251a-d220-415f-acc7-da94b7a2d1b4" /dev/sdb6: UUID="ffaaa3c4-cb73-4d7c-af57-6b2cc24a1929" TYPE="ext4" /dev/mapper/centos-root: UUID="c0160ecb-06e4-497e-813c-53690b4a6109" TYPE="xfs" /dev/mapper/centos-yinzhengjie: UUID="6a2643fb-8d55-44cd-b41e-b5f2709ef855" TYPE="xfs" /dev/sda1: PARTUUID="8f500d9c-87b9-421d-8ce0-8c385b73bf08" /dev/sda4: PARTUUID="814caa31-3a7e-499d-8b7d-cc3017473ba8" /dev/sdc1: PARTLABEL="Linux filesystem" PARTUUID="c79743bd-f7de-43da-8c4f-5f4380b215a4" [root@yinzhengjie.com ~]#
3>.根据指定的LABEL来查找对应的设备
[root@yinzhengjie.com ~]# blkid /dev/sdb1: UUID="da883b9f-c5e6-4dee-8376-dfbae3eac795" TYPE="xfs" /dev/sdb2: LABEL="/mnt/sdb2" UUID="15028503-abd5-4bc7-9e35-2e745662d42d" TYPE="ext4" /dev/sdb5: UUID="0e1581cf-51a9-4f5a-b1ad-635ac3364578" TYPE="ext4" /dev/sda2: UUID="1865a93f-6113-4097-89dc-8c4ea5fdf68c" TYPE="xfs" PARTUUID="e85154fa-bbc8-43c1-90f0-676000195a97" /dev/sda3: UUID="lNmzXe-Whhd-NTtI-C55A-7m4x-CudG-1Q556q" TYPE="LVM2_member" PARTUUID="fa2e251a-d220-415f-acc7-da94b7a2d1b4" /dev/sdb6: UUID="ffaaa3c4-cb73-4d7c-af57-6b2cc24a1929" TYPE="ext4" /dev/mapper/centos-root: UUID="c0160ecb-06e4-497e-813c-53690b4a6109" TYPE="xfs" /dev/mapper/centos-yinzhengjie: UUID="6a2643fb-8d55-44cd-b41e-b5f2709ef855" TYPE="xfs" /dev/sda1: PARTUUID="8f500d9c-87b9-421d-8ce0-8c385b73bf08" /dev/sda4: PARTUUID="814caa31-3a7e-499d-8b7d-cc3017473ba8" /dev/sdc1: PARTLABEL="Linux filesystem" PARTUUID="c79743bd-f7de-43da-8c4f-5f4380b215a4" [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# blkid -L /mnt/sdb2 /dev/sdb2 [root@yinzhengjie.com ~]#
4>.根据指定的UUID来查找对应的设备案例(找到"/boot"对应的设备名称)
[root@yinzhengjie.com ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Jan 20 04:18:36 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=1865a93f-6113-4097-89dc-8c4ea5fdf68c /boot xfs defaults 0 0 /dev/mapper/centos-yinzhengjie /yinzhengjie xfs defaults,noatime,nodiratime 0 0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# sed -rn 's#^UUID=(.*) /boot .*#1#p' /etc/fstab 1865a93f-6113-4097-89dc-8c4ea5fdf68c [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# blkid -U `sed -rn 's#^UUID=(.*) /boot .*#1#p' /etc/fstab` /dev/sda2 [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Jan 20 04:18:36 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=1865a93f-6113-4097-89dc-8c4ea5fdf68c /boot xfs defaults 0 0 /dev/mapper/centos-yinzhengjie /yinzhengjie xfs defaults,noatime,nodiratime 0 0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# grep "/boot" /etc/fstab | awk '{print $1}' | awk -F "=" '{print $2}' 1865a93f-6113-4097-89dc-8c4ea5fdf68c [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# blkid -U `grep "/boot" /etc/fstab | awk '{print $1}' | awk -F "=" '{print $2}'` /dev/sda2 [root@yinzhengjie.com ~]#
七.查找分区工具-findfs
1>.findfs帮助信息
[root@yinzhengjie.com ~]# findfs -h Usage: findfs [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value> Options: -h, --help display this help and exit -V, --version output version information and exit For more details see findfs(8). [root@yinzhengjie.com ~]#
2>.根据指定的LABEL来查找对应的设备
[root@yinzhengjie.com ~]# blkid /dev/sdb1: UUID="da883b9f-c5e6-4dee-8376-dfbae3eac795" TYPE="xfs" /dev/sdb2: LABEL="/mnt/sdb2" UUID="15028503-abd5-4bc7-9e35-2e745662d42d" TYPE="ext4" /dev/sdb5: UUID="0e1581cf-51a9-4f5a-b1ad-635ac3364578" TYPE="ext4" /dev/sda2: UUID="1865a93f-6113-4097-89dc-8c4ea5fdf68c" TYPE="xfs" PARTUUID="e85154fa-bbc8-43c1-90f0-676000195a97" /dev/sda3: UUID="lNmzXe-Whhd-NTtI-C55A-7m4x-CudG-1Q556q" TYPE="LVM2_member" PARTUUID="fa2e251a-d220-415f-acc7-da94b7a2d1b4" /dev/sdb6: UUID="ffaaa3c4-cb73-4d7c-af57-6b2cc24a1929" TYPE="ext4" /dev/mapper/centos-root: UUID="c0160ecb-06e4-497e-813c-53690b4a6109" TYPE="xfs" /dev/mapper/centos-yinzhengjie: UUID="6a2643fb-8d55-44cd-b41e-b5f2709ef855" TYPE="xfs" /dev/sda1: PARTUUID="8f500d9c-87b9-421d-8ce0-8c385b73bf08" /dev/sda4: PARTUUID="814caa31-3a7e-499d-8b7d-cc3017473ba8" /dev/sdc1: PARTLABEL="Linux filesystem" PARTUUID="c79743bd-f7de-43da-8c4f-5f4380b215a4" [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# findfs LABEL=/mnt/sdb2 /dev/sdb2 [root@yinzhengjie.com ~]#
3>.根据指定的UUID来查找对应的设备案例(找到"/boot"对应的设备名称)
[root@yinzhengjie.com ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Jan 20 04:18:36 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=1865a93f-6113-4097-89dc-8c4ea5fdf68c /boot xfs defaults 0 0 /dev/mapper/centos-yinzhengjie /yinzhengjie xfs defaults,noatime,nodiratime 0 0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# findfs UUID=`sed -rn 's#^UUID=(.*) /boot .*#1#p' /etc/fstab` /dev/sda2 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Jan 20 04:18:36 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=1865a93f-6113-4097-89dc-8c4ea5fdf68c /boot xfs defaults 0 0 /dev/mapper/centos-yinzhengjie /yinzhengjie xfs defaults,noatime,nodiratime 0 0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# findfs UUID=`sed -rn 's#^UUID=(.*) /boot .*#1#p' /etc/fstab` /dev/sda2 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# findfs UUID=`grep "/boot" /etc/fstab | awk '{print $1}' | awk -F "=" '{print $2}'` /dev/sda2 [root@yinzhengjie.com ~]#
八.文件系统检测和修复
文件系统故障常发生于死机或者非正常关机之后,挂载为文件系统标记为“no clean”
温馨提示:
一定不要在挂载状态下修复
1>.挂载文件系统
[root@yinzhengjie.com ~]# lsblk /dev/sdb NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 600G 0 disk ├─sdb1 8:17 0 100G 0 part ├─sdb2 8:18 0 200G 0 part ├─sdb3 8:19 0 1K 0 part ├─sdb5 8:21 0 100G 0 part └─sdb6 8:22 0 80G 0 part [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# blkid /dev/sdb5 /dev/sdb5: UUID="0e1581cf-51a9-4f5a-b1ad-635ac3364578" TYPE="ext4" [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 500G 3.5G 497G 1% / devtmpfs 2.0G 0 2.0G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 12M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 1014M 133M 882M 14% /boot /dev/mapper/centos-yinzhengjie 1.6T 416M 1.6T 1% /yinzhengjie tmpfs 394M 0 394M 0% /run/user/0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# mount /dev/sdb5 /mnt [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 500G 3.5G 497G 1% / devtmpfs 2.0G 0 2.0G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 12M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 1014M 133M 882M 14% /boot /dev/mapper/centos-yinzhengjie 1.6T 416M 1.6T 1% /yinzhengjie tmpfs 394M 0 394M 0% /run/user/0 /dev/sdb5 99G 4.8M 99G 1% /mnt [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb5 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 0e1581cf-51a9-4f5a-b1ad-635ac3364578 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 104857 Free blocks: 103140734 Free inodes: 6553589 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:17:57 2020 Last mount time: Wed May 27 14:21:59 2020 Last write time: Wed May 27 14:21:59 2020 Mount count: 1 Maximum mount count: -1 Last checked: Wed May 27 06:17:57 2020 Check interval: 0 (<none>) Lifetime writes: 34 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: c9f747cb-080f-47b7-9af2-4b82205c6094 Journal backup: inode blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# cp -r /etc/ /mnt/ [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# ll /mnt/ total 17 drwxr-xr-x 77 root root 5120 May 27 14:32 etc drwx------ 2 root root 12288 May 27 06:17 lost+found [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# ls /mnt/etc/ adjtime csh.cshrc gnupg krb5.conf my.cnf printcap rwtab sysctl.conf aliases csh.login GREP_COLORS krb5.conf.d my.cnf.d profile rwtab.d sysctl.conf-2020-01-20 aliases.db dbus-1 groff ld.so.cache NetworkManager profile.d sasl2 sysctl.d alternatives default group ld.so.conf networks protocols securetty systemd anacrontab depmod.d group- ld.so.conf.d nsswitch.conf python security system-release asound.conf dhcp grub2.cfg libaudit.conf nsswitch.conf.bak rc0.d selinux system-release-cpe audisp DIR_COLORS grub.d libnl nsswitch.conf.rpmnew rc1.d services terminfo audit DIR_COLORS.256color gshadow libuser.conf ntp rc2.d sestatus.conf tmpfiles.d bash_completion.d DIR_COLORS.lightbgcolor gshadow- locale.conf openldap rc3.d shadow tuned bashrc docker gss localtime opt rc4.d shadow- udev binfmt.d dracut.conf host.conf login.defs os-release rc5.d shells vconsole.conf centos-release dracut.conf.d hostname logrotate.conf pam.d rc6.d skel vimrc centos-release-upstream e2fsck.conf hosts logrotate.d passwd rc.d ssh virc chkconfig.d environment hosts.allow lvm passwd- rc.local ssl wgetrc containerd ethertypes hosts.deny machine-id pkcs11 redhat-release statetab wpa_supplicant cron.d exports init.d magic pki redis.conf statetab.d X11 cron.daily favicon.png inittab makedumpfile.conf.sample plymouth redis-sentinel.conf subgid xdg cron.deny filesystems inputrc man_db.conf pm resolv.conf subuid xinetd.d cron.hourly firewalld iproute2 mke2fs.conf polkit-1 resolv.conf.save sudo.conf yum cron.monthly fstab issue modprobe.d popt.d rpc sudoers yum.conf crontab gcrypt issue.net modules-load.d postfix rpm sudoers.d yum.repos.d cron.weekly GeoIP.conf kdump.conf motd ppp rsyslog.conf sudo-ldap.conf crypttab GeoIP.conf.default kernel mtab prelink.conf.d rsyslog.d sysconfig [root@yinzhengjie.com ~]#
2>.模拟破坏文件系统
[root@yinzhengjie.com ~]# dd if=/dev/zero of=/dev/sdb5 bs=1M count=3 #破坏文件系统时并不需要把整个硬盘全部清0,我们可以只把前面一部分数据清空即可, 比如我只将该分区的前3M数据清空。 3+0 records in 3+0 records out 3145728 bytes (3.1 MB) copied, 0.292628 s, 10.7 MB/s [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# tune2fs -l /dev/sdb5 #很明显,我们发现tune2fs工具已经无法查看超级快(super block)信息啦~ tune2fs 1.42.9 (28-Dec-2013) tune2fs: Bad magic number in super-block while trying to open /dev/sdb5 Couldn't find valid filesystem superblock. [root@yinzhengjie.com ~]#
3>.修复文件系统(数据依旧丢失)
[root@yinzhengjie.com ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 500G 3.5G 497G 1% / devtmpfs 2.0G 0 2.0G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 12M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 1014M 133M 882M 14% /boot /dev/mapper/centos-yinzhengjie 1.6T 416M 1.6T 1% /yinzhengjie tmpfs 394M 0 394M 0% /run/user/0 /dev/sdb5 16Z 16Z 99G 100% /mnt [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# umount /mnt/ [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 500G 3.5G 497G 1% / devtmpfs 2.0G 0 2.0G 0% /dev tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs 2.0G 12M 2.0G 1% /run tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda2 1014M 133M 882M 14% /boot /dev/mapper/centos-yinzhengjie 1.6T 416M 1.6T 1% /yinzhengjie tmpfs 394M 0 394M 0% /run/user/0 [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# fsck -y /dev/sdb5 fsck from util-linux 2.23.2 e2fsck 1.42.9 (28-Dec-2013) /dev/sdb5 was not cleanly unmounted, check forced. Resize inode not valid. Recreate? yes Pass 1: Checking inodes, blocks, and sizes Root inode is not a directory. Clear? yes Pass 2: Checking directory structure Entry '..' in <2>/<2424833> (2424833) has deleted/unused inode 2. Clear? yes Pass 3: Checking directory connectivity Root inode not allocated. Allocate? yes Unconnected directory inode 2424833 (...) Connect to /lost+found? yes /lost+found not found. Create? yes Pass 4: Checking reference counts Inode 2424833 ref count is 78, should be 77. Fix? yes Pass 5: Checking group summary information Block bitmap differences: +(1--3138) +(8193--9249) +(9281--9284) +(9297--9312) +(9329--9344) +(10241--17997) +(18433--22273) +(22529--25633) +(26625--30465) +(32769--34561 ) +(40961--42017) +(57345--58401) +(73729--74785) -(52305921--52338688)Fix? yes Free blocks count wrong for group #0 (5039, counted=5052). Fix? yes Free blocks count wrong for group #1 (7135, counted=955). Fix? yes Free blocks count wrong for group #2 (8192, counted=690). Fix? yes Free blocks count wrong for group #3 (7135, counted=3294). Fix? yes Free blocks count wrong for group #4 (8192, counted=6399). Fix? yes Free blocks count wrong for group #4736 (6112, counted=6076). Fix? yes Free blocks count wrong for group #4737 (8192, counted=7136). Fix? yes Free blocks count wrong for group #4752 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4753 (8192, counted=7996). Fix? yes Free blocks count wrong for group #4768 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4769 (8192, counted=7213). Fix? yes Free blocks count wrong for group #4784 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4785 (8192, counted=7955). Fix? yes Free blocks count wrong for group #4800 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4801 (8192, counted=7513). Fix? yes Free blocks count wrong for group #4816 (6112, counted=6071). Fix? yes Free blocks count wrong for group #4817 (8192, counted=5555). Fix? yes Free blocks count wrong for group #4832 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4833 (8192, counted=7621). Fix? yes Free blocks count wrong for group #4848 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4849 (8192, counted=7672). Fix? yes Free blocks count wrong for group #4864 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4865 (8192, counted=7704). Fix? yes Free blocks count wrong for group #4880 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4881 (8192, counted=7683). Fix? yes Free blocks count wrong for group #4896 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4897 (8192, counted=7703). Fix? yes Free blocks count wrong for group #4912 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4913 (8192, counted=7684). Fix? yes Free blocks count wrong for group #4928 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4929 (8192, counted=7735). Fix? yes Free blocks count wrong for group #4944 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4945 (8192, counted=7678). Fix? yes Free blocks count wrong for group #4960 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4961 (8192, counted=7651). Fix? yes Free blocks count wrong for group #4976 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4977 (8192, counted=7630). Fix? yes Free blocks count wrong for group #4992 (6112, counted=6080). Fix? yes Free blocks count wrong for group #4993 (8192, counted=7590). Fix? yes Free blocks count wrong for group #5008 (6112, counted=6080). Fix? yes Free blocks count wrong for group #5009 (8192, counted=7610). Fix? yes Free blocks count wrong for group #5024 (6112, counted=6089). Fix? yes Free blocks count wrong for group #5025 (8192, counted=8001). Fix? yes Free blocks count wrong for group #6385 (0, counted=8192). Fix? yes Free blocks count wrong for group #6386 (0, counted=8192). Fix? yes Free blocks count wrong for group #6387 (0, counted=8192). Fix? yes Free blocks count wrong for group #6388 (0, counted=8192). Fix? yes Free blocks count wrong (103107964, counted=103108499). Fix? yes Inode bitmap differences: +1 +(3--10) Fix? yes Free inodes count wrong for group #0 (500, counted=501). Fix? yes Directories count wrong for group #0 (3, counted=2). Fix? yes Free inodes count wrong for group #4736 (512, counted=252). Fix? yes Directories count wrong for group #4736 (0, counted=32). Fix? yes Free inodes count wrong for group #4752 (512, counted=420). Fix? yes Directories count wrong for group #4752 (0, counted=32). Fix? yes Free inodes count wrong for group #4768 (512, counted=431). Fix? yes Directories count wrong for group #4768 (0, counted=32). Fix? yes Free inodes count wrong for group #4784 (512, counted=393). Fix? yes Directories count wrong for group #4784 (0, counted=32). Fix? yes Free inodes count wrong for group #4800 (512, counted=412). Fix? yes Directories count wrong for group #4800 (0, counted=32). Fix? yes Free inodes count wrong for group #4816 (512, counted=375). Fix? yes Directories count wrong for group #4816 (0, counted=32). Fix? yes Free inodes count wrong for group #4832 (512, counted=384). Fix? yes Directories count wrong for group #4832 (0, counted=32). Fix? yes Free inodes count wrong for group #4848 (512, counted=384). Fix? yes Directories count wrong for group #4848 (0, counted=32). Fix? yes Free inodes count wrong for group #4864 (512, counted=384). Fix? yes Directories count wrong for group #4864 (0, counted=32). Fix? yes Free inodes count wrong for group #4880 (512, counted=384). Fix? yes Directories count wrong for group #4880 (0, counted=32). Fix? yes Free inodes count wrong for group #4896 (512, counted=384). Fix? yes Directories count wrong for group #4896 (0, counted=32). Fix? yes Free inodes count wrong for group #4912 (512, counted=384). Fix? yes Directories count wrong for group #4912 (0, counted=32). Fix? yes Free inodes count wrong for group #4928 (512, counted=385). Fix? yes Directories count wrong for group #4928 (0, counted=32). Fix? yes Free inodes count wrong for group #4944 (512, counted=384). Fix? yes Directories count wrong for group #4944 (0, counted=32). Fix? yes Free inodes count wrong for group #4960 (512, counted=384). Fix? yes Directories count wrong for group #4960 (0, counted=32). Fix? yes Free inodes count wrong for group #4976 (512, counted=384). Fix? yes Directories count wrong for group #4976 (0, counted=32). Fix? yes Free inodes count wrong for group #4992 (512, counted=384). Fix? yes Directories count wrong for group #4992 (0, counted=32). Fix? yes Free inodes count wrong for group #5008 (512, counted=387). Fix? yes Directories count wrong for group #5008 (0, counted=32). Fix? yes Free inodes count wrong for group #5024 (512, counted=457). Fix? yes Directories count wrong for group #5024 (0, counted=23). Fix? yes Free inodes count wrong (6553588, counted=6551213). Fix? yes /dev/sdb5: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sdb5: 2387/6553600 files (0.3% non-contiguous), 1749101/104857600 blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# tune2fs -l /dev/sdb5 tune2fs 1.42.9 (28-Dec-2013) Filesystem volume name: <none> Last mounted on: <not available> Filesystem UUID: 0e1581cf-51a9-4f5a-b1ad-635ac3364578 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 6553600 Block count: 104857600 Reserved block count: 104857 Free blocks: 103108499 Free inodes: 6551213 First block: 1 Block size: 1024 Fragment size: 1024 Group descriptor size: 64 Reserved GDT blocks: 256 Blocks per group: 8192 Fragments per group: 8192 Inodes per group: 512 Inode blocks per group: 128 Flex block group size: 16 Filesystem created: Wed May 27 06:17:57 2020 Last mount time: n/a Last write time: Wed May 27 14:41:08 2020 Mount count: 0 Maximum mount count: -1 Last checked: Wed May 27 14:39:37 2020 Check interval: 0 (<none>) Lifetime writes: 94 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: c9f747cb-080f-47b7-9af2-4b82205c6094 Journal backup: inode blocks [root@yinzhengjie.com ~]#
[root@yinzhengjie.com ~]# mount /dev/sdb5 /mnt #文件系统修复成功就可以再次挂载啦~ [root@yinzhengjie.com ~]# [root@yinzhengjie.com ~]# ll /mnt/ #Duang~我们发现文件系统的确是好使了,但是之前保存的数据已经全部丢失啦!因此,生产环境中一定要做好备份哟~ total 1 drwx------ 3 root root 1024 May 27 14:39 lost+found [root@yinzhengjie.com ~]#
八.挂载文件系统
博主推荐阅读: https://www.cnblogs.com/yinzhengjie/p/12828901.html