commands about disk space
Command |
Function |
Mount |
Mount File System |
Umount |
Uninstalling a file system mounted on a mount |
Df |
Check the disk space of each hard disk partition and the mounted file system |
Du |
Show file directory and size |
Fsck |
Mainly to check and repair the Linux file system |
2.1 Mount Command
The mount command is mounted on a file system that can mount a hard disk, a CD-ROM, a floppy disk, or mount an NFS network file system. The standard usage of this command is as follows:
Mount–t Device Type Storage directory
Mount IP Address:/provided directory storage directory
option |
description |
(none) |
without any parameters, the direct input command can display the mounted file system and directory |
-a |
hang all file systems under/etc/fstab |
-t |
develop the name of the file system that is being hung up, all system supported file systems, this information can be seen in/proc/filesystems this file, |
- n |
hangs the file system, but does not write the file system data to/etc/mtlab this file |
Set the file system to read/write |
-r |
The file system that is hung up is set to read-only |
Under directory/mnt, hang up the iso9660 file system. Enter the command:
Mount–t Iso9660/dev/hdb/cdrom
2.2 umount Command
The function of the Umount command is to unload a file system that has been hung, and the file system on all mounts should be uninstalled before shutting down the system. This command is relative to the Mount command. Usage:
Umount a directory or device that is already hung
To uninstall the/cdrom directory that is already hung, enter the command:
Umount/cdrom
To unload a section that has been hung, enter the command:
Umount/dev/hdb1
2.3 DF Command
The DF command is used to check the disk space of the hard disk partition and the mounted file system, that is, to check the amount of hard disk usage. The standard usage is as follows:
DF [-option]
Options |
Function |
-A |
Make a list of all the file systems and the hard disk usage of each partition, including 0 blocks, such as the/proc file system |
-I. |
List the usage of i-nodes |
-K |
The size of each partition and the size of the file partition to be mounted are denoted by K |
-T |
List all partition disk space usage for a file system |
-X |
Lists all partition disk space usage that are not a file system, as opposed to the-t option |
-T |
Lists the name of the file system to which each partition belongs |
For example, to list disk usage for all file systems and partitions, enter the command:
Df–a
2.4 du command
The function of the du command is to display the file directory or size. Standard usage:
Du [-Options]
Options |
Meaning |
-A |
Displays the disk space occupied by each file in all directories and their secondary directories |
-B |
Displays the size of the directory and file, in units B |
-C |
And finally add a total |
-H |
Improve readability of information in kilobytes, MB, GB |
-S |
Only the sum of each file size is listed |
-X |
Only compute files that belong to the same file system |
2.5 fsck Command
The function of the fsck command is to check and repair the Linux file system, which is best used when no one or no partition hangs up, in fact, each boot system will do a check to see if there is a bad track or data loss phenomenon. Usage:
fsck (-option) partition name
options |
function |
-a |
automatically fix file system without asking any questions, more dangerous |
-a |
According to the contents of the/etc/fstab configuration file, check all the file systems listed in the file. Without the additional parameter "-P", the file system of the/directory will be checked first, without checking all file system |
-r |
interactively, ask questions when repairing, let the user confirm and decide how to handle |
-s |
Check the job in turn instead of executing it at the same time. Use this parameter for sequential execution when you specify more than one file system in turn and interactively, or fsck may ask several questions at the same time, which can be overwhelming. |
-v |
shows the process of command execution |
-t |
|
-n |
not really executing Directive that lists only the actions that will occur when the actual execution is performed |
Linux basic commands (2) for disk space commands