Add disk quotas for common users and user groups in linux

Source: Internet
Author: User
Preparation in advance: 1. add a hard disk (IDE or SCSI) to the VM. 2. partition the disk using fdisk. # fdisk-l purpose: check the name of the newly added hard disk/dev/sdb # fdisk/dev/sdbCommond: mCommond: nE: P: p -------- the hard disk capacity is relatively large, 1 ------- the first primary partition...

 

Preparation in advance:

1. add hard disks (IDE and SCSI) to virtual machines)

2. fdisk partitioning

# Fdisk-l

Objective: To view the name of the newly added hard disk/dev/sdb

# Fdisk/dev/sdb

Commond: m

Commond: n

E:

P: p -------- hard disk capacity is relatively large,

1 ------- the first primary partition

1 ---- start position

+ 500 M

Commond: w

# Fdisk-l

/Dev/sdb1

 

3. format mkfs

Select a file system: Rules for standardizing data storage

NTFS FAT16 FAT32 ....

EXT2 EXT3 EXT4 SWAP ....

 

Install multiple operating systems on one PC without using virtual machines)

Install linux on partition (E) and run in a windows environment. The E drive is invisible.

F ------- E it is recommended to install the last partition whenever possible.

# Mkfs-t ext3/dev/sdb1

Or

# Mkfs. ext3/dev/sdb1

After the above three steps

Now the hard disk can be used.

Optical disks, USB flash disks, hard disks, and other external devices

Supplement: Backup

Store important directories to external devices at intervals

Important:/etc/boot

Category: cp tar cpio dump dd (for example, MBR of hard disk)

Full Backup: save the entire directory again each time

Incremental Backup: saves the directory part (changed) each time

Hard disk tape

Note: external devices cannot be used directly.

Mount ---- map external devices into a directory of the system

Manually create this directory # mkdir zhy

4. Mount

1) permanent mounting

# Vi/etc/fstab

The system starts automatically once.

Often used on external devices

2) temporary mounting

# Mount-t ext3 external device name mount point

# Mount/dev/sdb1/mnt/u_po

-O option defaults usrquota maid .......

# Man mount

The parameter corresponds to the/etc/fstab field.

# Cd/mnt/u_po

You must exit the current environment before detaching an external device.

# Cd ..

The first method indicates detaching an external device.

# Umount/dev/sdb1

Or detach a mount point.

# Umount/mnt/u_po

# Mount-text3-o defaults, usrquota, kgquota/dev/sdb1/var/zhy

Or

# Vi/etc/fstab

/Dev/sdb1/var/zhy ext3 defaults, usrquota, kgquota 1 1

: Wq

Restart the system

Or

# Mount-o remount/var/zhy

5. set the quota

Generate a quota file

Aquota. user ----- restrict users

Aquota. group --- restrict groups

Group1 ---- zhs lisi

5 3 3

# Cd/var/zhy

# Man quotacheck

# Quotacheck-cvuga

Purpose: to check the quota usage of the current device and generate a configuration file

Enable the quota function

# Man quotaon

# Quotaon-avgu

Zhy] # ls

Aquota. usr

Aquota. group

Lost + found

# Useradd zhy

# Passwd zhy

Zhy4: x: 504: zhy1, zhy2, zhy3

# Edquota-u zhy

Filesystem blocks soft hard inodes soft hard

/Dev/sdb1 0 100 200 0 4 8

Filesystem: specifies the name of an external device.

Blocks: The first method (B M k) limits the space size.

Soft: Soft limit ---- 3 M will be reminded when the limit is exceeded

Hard: Hard limit-cannot exceed

Innode: number of node files)

Soft: eight Soft limits

Hard: limits

# Quotaoff-avug

# Quotaon-avug

# Su zhy1

$ Cd/var/zhy

$ Touch file1 file2 file34 fiel4

$ Touch file5

Warning: soft limits

$ Touch file6file7 fiel8

$ Touch file09

Error: Restrictions

 

From zl943588435

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.