File system
File System classification
depending on whether it supports the "journal" feature: journaled File system: ext3, Ext4, XFS, ...
non-journaled file system: ext2, Vfat
Part of the file system:
Modules in the kernel: Ext4, XFS, VFAT
User space management tools: MKFS.EXT4, Mkfs.xfs,mkfs.vfat
Virtual file system for Linux: VFS
Pre-check supported file systems: Cat/proc/filesystems
Creating a file system
Mkfs
command is used to create a Linux file system on a device (usually a hard disk). The MKFS itself does not perform the work of establishing the filesystem, but rather calls the relevant program to execute it.
#文件系统创建命令 #
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/03/E5/wKiom1miw_uyvWbuAAAdFaITlsI339.png "title=" 1.png "alt=" Wkiom1miw_uyvwbuaaadfaitlsi339.png "/>
MKFS (option) (parameter)
Options:
FS: Specifies the parameters when the file system is established;
-T < file system type;: Specifies what file system to build;
-V: Displays the version information and the detailed use method;
-V: Displays a brief use method;
C: Before making the file system, check whether the partition has bad track
(1) # MKFS. Fs_type /dev/device
Ext4
Xfs
Btrfs
Vfat
(2) # mkfs-t Fs_type/dev/device
# mkfs-t fs_type-l ' LABEL '/dev/device
Set the volume label
Example:
First, create an XFS file system (if the XFS formatter discovers that a file system already appears on the partition, it will notify you.) Also note that the XFS format has been re-assigned the UUID)
Mkfs-t Xfs-i Size=512/dev/sda5
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/03/E5/wKiom1mixV7hrhrsAADOfSzJAmE094.png "title=" 2.png "alt=" Wkiom1mixv7hrhrsaadofszjame094.png "/>
Second, create a EXT4 partition
Mkfs-t ext4-l IAN-USB32/DEV/SDC1
(Use the-l option mkfs to label the partition and then use the Blkid command to display the GUID)
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/03/E5/wKiom1mixbnyBslnAACfbGCpbks711.png "title=" 3.png "alt=" Wkiom1mixbnybslnaacfbgcpbks711.png "/>
Create ext File System
MKFS.EXT3 = mkfs-t ext3 = mke2fs-j = Mke2fs-t ext3
Mke2fs
Mke2fs:ext Series file system dedicated management tools, the "etc2/etc3" file system that was used to create the disk partition.
Command parameters:
1.-t {EXT2|EXT3|EXT4} specifies the file type
"Mke2fs-t EXT4/DEV/SDB5"
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/03/E5/wKiom1mixhSSNoQeAAB7W_SU1SQ591.png "title=" 4.png "alt=" Wkiom1mixhssnoqeaab7w_su1sq591.png "/>
2,-b {1024|2048|4096} specify block size
"Mke2fs-t ext4-b 8192/DEV/SDB6"
"Specifying a block size of 8192 indicates that the block value setting is too large, we directly type ' y ' to force formatting, and you can also try to specify a larger number. 】
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/A2/95/wKioL1mixibCdI00AACrzEIH5x8540.png "title=" 5.png "alt=" Wkiol1mixibcdi00aacrzeih5x8540.png "/>
3,-l ' LABEL ' Set volume label
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A2/95/wKioL1mixmyAlzAfAACfRp1PhPQ489.png "title=" 6.png "alt=" Wkiol1mixmyalzafaacfrp1phpq489.png "/>
4,-j: equivalent to-t ext3
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/03/E5/wKiom1mixozDGl57AAClsw6q3K8703.png "title=" 7.png "alt=" Wkiom1mixozdgl57aaclsw6q3k8703.png "/>
-I #: Create an inode for each number of bytes in the data space, which should not be smaller than the size of the block
-N #: Specify how many inode to create in a partition
-I an INODE record consumes disk space,---4096
-M #: Default 5%, Percentage of total space reserved for administrative staff
-O feature[,...] : Enable the specified attribute
-O ^feature: Turns off the specified attribute,
Device files: Specifies the partition device file name of the file system to be created;
Number of blocks: Specifies the number of disk blocks for the file system to be created.
File System Tags
Another method of pointing to a device is device Independent
Blkid Block Device properties Information View
Blkid [OPTION] ... [DEVICE]
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/03/E5/wKiom1mixrWymVzCAAAREP1lpM0449.png "title=" 8.png "alt=" Wkiom1mixrwymvzcaaarep1lpm0449.png "/>
-U UUID: Find the corresponding device based on the specified UUID
-L Label: finds the corresponding device according to the specified label
E2label: Manage Label for ext series File system
# E2label DEVICE [LABEL]
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/A2/95/wKioL1mixreBrhr4AAAL-IKbLrE310.png "title=" 9.png "alt=" Wkiol1mixrebrhr4aaal-ikblre310.png "/>
Findfs
Findfs: Finding partitions
Findfs [Options] label=<label> querying the file system based on the volume label
Findfs [Options] uuid=<uuid> querying the file system based on the UUID
Tune2fs
TUNE2FS: Reset the values of the EXT series file system adjustable parameters
- L: View the specified file system super block information; Super block for a standalone file system. Save file system type, size, status, etc.)
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/03/E5/wKiom1mixuCxme-eAABCQTQoaX4446.png "title=" 10. PNG "alt=" Wkiom1mixucxme-eaabcqtqoax4446.png "/>
-L ' LABEL ': Modify volume label
-M #: Fixed percentage of space reserved for administrators
-j: Upgrade ext2 to Ext3
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/A2/95/wKioL1mixuihC5mXAAA-zjhmMzY947.png "title=" 11. PNG "alt=" Wkiol1mixuihc5mxaaa-zjhmmzy947.png "/>
-O: File System Properties enabled or disabled, –O ^has_journal
-O: Adjust default mount options for the file system, –o ^acl
-U uuid: Modifying the UUID number
Example:-U's parameter if clear indicates that the UUID of the file system is cleared
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/A2/95/wKioL1mixviDRaqXAAA0CSLj_d0931.png "title=" 12. PNG "alt=" Wkiol1mixvidraqxaaa0cslj_d0931.png "/>
Change the device to a specified UUID
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/A2/95/wKioL1mixxPCkJR1AAA2_JL2leU966.png "title=" 13. PNG "alt=" Wkiol1mixxpckjr1aaa2_jl2leu966.png "/>
The-u parameter if the random indicates that a new UUID is directly generated:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A2/95/wKioL1mixyqBqSiSAAA42Y2FVcs689.png "title=" 14. PNG "alt=" Wkiol1mixyqbqsisaaa42y2fvcs689.png "/>
The-u parameter, if the time representation, produces a new UUID directly at the current moment:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/A2/95/wKioL1mixzahxPhyAAAq61lRl-g625.png "title=" 15. PNG "alt=" Wkiol1mixzahxphyaaaq61lrl-g625.png "/>
Set the number of times a file system can mount before forcing a check
Tune2fs-c 30/dev/hda1
To turn off forced check mount count limit
Tune2fs-c-l/dev/hda1
10 days after inspection
Tune2fs-i 10/dev/hda1
1 days after inspection
Tune2fs-i 1d/dev/hda1
3 weeks after inspection
Tune2fs-i 3w/dev/hda1
Six months later check
Tune2fs-i 6m/dev/hda1
Disabling time checking
Tune2fs-i 0/dev/hda1
Adjust the/DEV/HDA1 partition to a reserved space of 40,000 disk blocks
Tune2fs-r 40000/dev/hda1
Adjust the/DEV/HDA1 partition's reserved space to 10%
Tune2fs-m 10/dev/hda1
Set the/DEV/HDA1 mount option to enable POSIX Access Control lists and user-specified extended properties
Tune2fs-o acl,user_xattr/dev/hda1
Power-on cancel self-test
Tune2fs-l/DEV/SDB1 | Grep-e ' Maximum mount Count:|check interval '
Tune2fs-i 0-c 0/DEV/SDB1
DUMPE2FS: View File System Information: Superblock Information and block group information
-H: Do not show block group but only show Superblock and tune2fs-l consistent
Dumpe2fs-h = Tune2fs-l
File system detection and Repair
Conditions:
1) often occurs after the crash or abnormal shutdown
2) Mount for file system labeled "No clean"
Note: Be sure not to fix it in a mounted state
Fsck:file System Check
Fsck. Fs_type
Fsck-t Fs_type
-P: Auto Fix error
-r: Interactive fix error
Fs_type must be the same as the file type on the partition
E2fsck:ext series file-specific detection and repair tool
-Y: Auto Answer Yes
-F: Forced repair
Linux file system