Linux disk management II

  
        

stat /etc/passwd View file information,

Field Access time File data is updated each time it is read,

Field Chage time (increase time) File inode information Update

field Modify time after each change The file data is updated each time it is changed.

ls -l /etc/passwd

-rwx------. root root 1704 January 10 08:44 /etc/passwd

One:< Br>

. The dot indicates that the file has a seliunx flag, and only certain processes with the same flag can use the file

ls -Z /etc/passwd to view hidden flags.

linux uses the device file to operate the hardware. The device file /dev/sda1 has

brwx------ 1 root disk 8,1 January 11 08:01 /dev/sda1

8 represents the main device number, identifies the device type

1 represents the minor device number, indicating the partition number

The Linux system identifies each hardware resource by the primary and secondary device numbers. The device file can be created by the command mknod.

Format mknod /mydisk b 8 3

Two: The command blkid looks at the UUID and tag name of all partitions.

Command lsblk to view the information of each partition.

The command tune2fs -L label /dev/sda1 modifies the label name of the partition.

Three: Disk Quotas

Use the quota command to implement disk quotas,

Step 1: Add quota support in the mount options bar of /etc/fstab, usrquota, Grpquota

Step 2: quotacheck -avug /dev/sdb2 -a means all -v is the display details -u is user -g is group. After the execution, two data files are automatically generated in the quota partition, one for the individual user quota and one for the group quota.

Step 3: quotaon -ugv /mail Enable quotas for users and groups. Quotaoff -ugv /mail turns off quotas.

Edit quota color settings for user and group accounts

edquota -u username Edit user quotas

edquota -g groupname Edit group quotas.

Quota table field details

Filesystem blocks soft hard inode soft hard

/dev/sdb1 0 10 80 0 23 29

Limit disk quota, you can Limit from two aspects, the size of the block, and the number of files.

The soft field indicates a soft limit, that is, a warning is issued if the number is exceeded.

The hard field indicates a hard limit and cannot exceed this limit.

The block field only uses the number of blocks currently in use. Inode indicates the number of nodes currently in use.

We only need to limit quotas. Modify the values ​​of soft and hard, the unit of the block k,

Use the command direct quota

setquota -u username (blocks)soft (blocks)hard (blocks)soft (blocks)hard /dev /sdb2

Copy quota: edquota -p template user new user. Implement automatic quotas.

Copyright © Windows knowledge All Rights Reserved