DF
DF Command:
View the file system space usage information.
Use this command to see how much space the hard disk has been using, how much space is left, and to view all mounted devices (file systems) and mount points on the current disk.
The results are as follows: ① file system ② Total disk capacity ③ used capacity ④ remaining capacity ⑤ used percent ⑥ mount point
Note: The temporary file system with TMPFS is reset after the reboot.
If DF does not have any options, the default is to list all of the system's (non-special in-memory file systems and Swaps) in 1 Kbytes capacity!
Options:
-I: Show details for Inode-H: Display information in the appropriate units-K: Display information in units-M: Display information in meters-T: View File system types
Example:
DF: View system disk device, default is KB
Df-h: View system disk devices, display them in the appropriate units
Du
Du command:
Used to view the overall space usage of a directory
The du command also looks at the space used, but unlike the DF command, the Linux du command is a view of the space used by the file and directory disks, and the du command actually searches the file system for all the file data.
Options:
-H: Display information in appropriate units-s: Displays only the sum of all file sizes in the specified directory-K: Displays information in kilobytes-M: Displays information in megabytes
Example:
Du-sh: Displays the sum of all the file sizes in the specified directory in the appropriate units
Free command:
See how memory space is used
Options:
-M: in MB-G: in gigabytes
Example:
Free-m: View the usage of memory space in megabytes
Free-g: View the usage of memory space in gigabytes
parted command:
Parted is a high-level partition Operation command, which operates in real time and is used with care. In CentOS 7 You can update the hard drive with the Partprobe command, CentOS 6 is not available.
Usage:
parted [options] ... [Device [command [parameters] ...] ...] Parted/dev/device Mklabel GPT | MSDOS: Change disk type to GPT or MBR parted/dev/device print: Display disk partition information Parted/dev/device Mkpart Primary 1 1000: Create partition 1 is the partition number; 1000 is the partition size (default is m) parted/dev/device RM 1: Delete the first partition parted-l: List all device information
FDISK:MRB Partitioning Tool
Fdisk is the Linux MRB partition table Manipulation tool, Gdisk is the GPT Partition Table Operation tool, the usage and Fdisk basically consistent.
FDISK/DEV/SDX: Managing SdX disks, modifying partitions on specified hard disks
FDISK subcommand:
M: Help o: Create MSDOS partition label N: Create new partition D: Delete partition P: View current Partition Table A: Add/Cancel Boot tag T: Convert partition type ID l/l: Show partition type ID table
Example:
FDISK-L: Lists partition information for all block devices
Fdisk-l/DEV/SDX: View partition information for a specified block device
Cat/proc/partitions to see if the kernel has identified a new partition:
Note: If there is only fdisk-l, the system will list the partitions of the device that can be searched in the whole system.
Four, disk format
MKFS command:
Creating a file system
MKE2FS is a dedicated management tool for the EXT series file system
To view supported file systems: Cat/proc/filesystems
Configuration file:/etc/mke2fs.conf for setting default features and individual file system specific features
Create ext File System
Options:
-T: Specifies the file system type {ext2 | ext3 | ext4}-J: equivalent to-t ext3 mkfs.ext3 = mkfs-t ext3 = mke2fs-j = mke2fs-t ext3- L Label: Specify the Volume label,-b{1024|2028|4096}: Specify the block Size-I #: Create an inode for each number of bytes in the data space; This size should not be less than the size of the block-N #: How many Inod are created directly in the specified partition E-i N: Specify Inode size-M #: Reserve Space for administrators as a percentage of total space, default is 5%-O feature[,...]: Enable the specified attribute (only the following attribute is turned on)-O ^feature Disable the specified attribute
TUNE2FS command:
Modify the file system information to reset the value of the EXT series file system adjustable parameters
-L: View the specified file system super block information; Super block-l ' label ': Modify the volume label (EXT) mkfs-l ' label ' or mke2fs-l ' label ' to set the volume label when created E2la bel/dev/sd# View Volume label e2label/dev/sd# ' LABEL ' Rename volume label-M #: Fixed percentage of space reserved for administrators-j: Upgrade ext2 to Ext3-o: File System Properties Start Use or disable, –O ^has_journal-o: Adjust the default mount option of the file system, –O ^acl (default on ACL 6 is not turned on by default)-U uuid: Modify the UUID number
Example: Tune2fs-o acl/dev/sdb2 to turn on/dev/sdb2 ACL function
dumpe2fs/dev/sda# viewing file System Information: Superblock Information and block group information
-H: View Super block, do not show block group but only show Superblock and tune2fs-l consistent
Tip: The super block is the file system built-in, specifying the file system type
Block Group 0 has super block, after Odd group has backup, can be used to repair
File System Detection:
Fsck:
Used to check and maintain inconsistent file systems
Options:
-T: File type device-F: Force detect-A: Automatic fix error if check errors-r: Interactive fix error
Example:
Fsck-y: Check to fix each file
Note: If you do not add-f option, because this file system has not been the problem, the check is very fast! If you add the-f mandatory Check, an item is displayed.
E2fsck:ext Series file system-specific detection and repair tools
-Y: Auto answer for YES-F: Force detection
Disk Mounts and Uninstalls:
Mount
Mount Command:
Display the currently mounted device by viewing the/etc/fstab file
Usage:
Mount [Options]-o [option]-t file type device mount directory device: (1) device file: For example/DEV/SR0,/DEV/SDB1 (2) Volume Label:-L ' volume label Name ' (3) UUID :-U ' UUID ' (4) pseudo file system name: PROC,SYSFS mount Directory: (1) must exist beforehand, try to use empty directory
Options:
   -T&NBSP: Specifies the file system type to mount the device -r :readonly, read-only Mount -w : Read-write Mount -n : Do not update/etc/mtab after mount, cause mount and DF command not to query to mount information, but can view/proc/mounts -a &NBSP: Read/etc/fstab mount the file system that is not currently mounted, the mounted file system will not be re-mounted, nor will it update the Mount option -l : Specify the device to mount by the volume label name   -U&NBSP: Specifies the device -b,--bind  to be mounted with the UUID;: Binds the directory to another directory (equivalent to a soft link) -o  [OPTIONS]&NBSP: (option to mount file system), multiple options separated by commas async (default ) Asynchronous Mode sync sync mode, sync now atime (default) file is accessed when the update atime noatime file is accessed and not updated Atime diratime (default) When the directory is accessed, the update atime nodiratime directory is accessed without updating atime auto (default) MOUNT -A auto Mount after writing/etc/fstab noauto after writing/etc/fstab, Not automatically mounted by Mount -a exec (default) files with RX permission in this directory can be executed noexec all files under this directory will not be executed for all users, including Root, dev (default) device files can be used in this directory nodev Device files in this directory cannot be used suid (default) indicates that Suid,sgid permissions in this directory are in effect nosuid indicates that suid,sgid permissions in this directory do not take effect remount,xxx without uninstalling, you can update the Mount options directly rw (default) ro nouser (default) write/etc/fstab items cannot be loaded/unloaded by normal users user Write/etc/ Fstab project allows normal users to mount/uninstall acl (Centos7 default) files in this directory can set ACL permissions noacl (CENTOS6 and previous default) files in this directory can not set ACL permissions loop when mounting a loop device, such as an ISO, specify the defaults rw, suid, dev, exec, auto, nouser, async,atime,diratime,acl (CENTOS7)
Example:
Cat/proc/mounts: View all mounted devices tracked by the kernel
Note: After the file is mounted successfully,/etc/mtab is not updated after mounting, resulting in mount and DF commands not being able to query the mount information, but can be viewed with df-a.
/etc/fstab each row defines a file system to mount.
Tool DD:
dd if=file of=file bs=n count=n if=file : reading data from a file of=file : Output to a file bs=size : block Size, specifying the block size (ibs=obs) ibs=size : Reads a size byte obs=size at a time : Write one size byte cbs=size  at a time;: One conversion size byte skip=blocks : Ignores blocks of IBS-sized blocks from the beginning seek=blocks : Ignores blocks of blocks obs size from the beginning count : Copy the number of bs conv=onversion... : Convert file transform parameters with specified parameters: ascii : Convert EBCDIC code to ascii            EBCDIC&NBSP: convert ASCII to ebcdic           LCASE&NBSP: Convert uppercase characters to lowercase   UCASE&NBSP: Convert lowercase to uppercase nocreat &NBSP: Do not create output file noerror : Do not stop on error             NOTRUNC&NBSP: Not truncated output file            SYNC&NBSP: Fills the input block to the IBS bytes, the insufficient part is filled with the empty (NUL) character
Linux-----Disk Management