In UNIX systems, file storage is stored with the aid of storage media such as disks, diskettes, CDs, and so on. So in Unix systems. Mastering how to use storage media effectively is a very important technology.
After learning this chapter, you will be able to do the following things:
How to view the usage of http://www.aliyun.com/zixun/aggregation/17325.html "> storage space in the system.
How to generate file systems on devices such as floppy disks, tapes, and so on.
Storage space usage
After creating a file system and making it available. As users create new files on them, modify files, or delete files, the number of free inode, free blocks of data, etc. will decrease or increase accordingly. If the free space of the file system is reduced to a certain extent, the system response speed will decrease or even be unable to work. At this time, we need to investigate the use of each file system, and then take corresponding countermeasures.
1. Statistics of File System Idle
In the file system, the number of index nodes and blocks is two critical parameters. When a file system index node or block of data is fully occupied, no files can be created on this file system. This is a more terrible thing. To enable users to easily understand how many of the available index nodes and data blocks are left in each filesystem, the system provides us with the DF command.
The DF command is abbreviated for disk free. DF can be used individually or with parameters. You can refer to the online Help for specific use.
2. Disk space occupancy
You can use the du command when the file system is full or if we want to know the use of a directory or file for the filesystem storage space.
The du command is abbreviated for disk usage. You can specify one or more directories when you use this command, such as:
$ du/home/yxz
2/home/yxz/unix.dir
10/home/yxz
$
Using the above command, you can find out how much disk space is occupied by a user in the system (assuming the user can only create files in his home directory).
If you do not specify a file or directory name, du displays the amount of disk space occupied by the current directory. The displayed information contains the directory of all descendants in the specified directory, and the use of disk space. To learn about each subdirectory and file, you can add the-a option.
You can use the-s option if you only want to know the total amount of disk space consumed by the specified directory.
There are other options to refer to the online Help manual.
User occupancy of file system space statistics
Each file in the system has a corresponding owner. In some cases we need to know how much storage space each user occupies on a file system. You can use the quot command for this purpose.
quot is the abbreviation of quotient. It accepts a file system name (block device file name) as a parameter, and then counts the number of disk blocks used by individual users who have files created in the filesystem. As:
# QUOT/DEV/DSK/0S4
/DEV/DSK/0S4:
82883 Sybase
Vmsys
158 YXZ
Oasys
Root
2 xyz
3 YXZ
1 Install
Note that this command is only available to Superuser.