Implement disk partitions and disk quotas in rhel5

Source: Internet
Author: User

Reprinted: http://netslyz.blog.51cto.com/1006247/380095

 

 

Today's experiment adds hard disks to Linux Hosts and creates disk partitions and disk quotas (two SCSI hard disks are added to the hosts ). 1. First, run the "fdisk-L" command to confirm the hard disk devices (/dev/SDB and/dev/SDC) recognized by the system ). 2. use the newly added first hard disk (/dev/sdb) to complete today's experiment. Next, start partitioning the hard disk and run "fdisk/dev/SDB ", go to the interactive partition management interface, enter "N" to create a partition, enter "p" to create the first primary partition, and enter "1" to set the first primary semicolon to 1, that is, sdb1. the disk space for this partition is 20000 MB, which is about 20 GB. Enter "p" to view the information of the first partition/dev/sdb1 just created: 3. Create the second partition/dev/sdb2 in the same way: 4. Divide the remaining disk space into extended partitions, enter "N", and then enter "E" to create the extended partition. The Partition Number is 4, that is, sdb4: 5. Create two logical partitions/dev/sdb5 and/dev/sdb6 on the newly created extended partition/dev/sdb4: 6. After sdb5 is used as the newly added swap partition, enter "T" and change the ID of the partition type to 82. "82" is the partition type of swap: 7. Enter "W" to save and exit: 8. after changing the partition settings of the hard disk (especially the hard disk in use), we recommend that you restart the system, you can also run the "partprobe/dev/SDB" command to re-control the change of the partition in the "/dev/SDB" Hard Disk: 9. use "mkfs-T/dev/sdb1" or "mkfs. ext3/dev/sdb1 "format the partition/dev/sdb1 into the ext3 file system, and then format the partitions/dev/sdb2 and/dev/sdb6 in the same way: 10. Use "mkswap/dev/sdb5" to format/dev/sdb5 as the swap file system: 11. Run the "free | grep-I swap" command to view the current swap space: 12. run the "Swapon/dev/sdb5" command to enable the newly added swap partition and view the current swap space. The size is changed from 1048568 to 3008546, you can also run the "swapoff/dev/sdb5" command to disable the new swap partition: 13. Create a directory disk under the/directory, and create subdirectories sdb1, sdb2, and sdb6 under the disk directory (steps are omitted) and view: 14. use the "Mount/dev/sdb1/Disk/sdb1", "Mount/dev/sdb2/Disk/sdb2", and "Mount/dev/sdb6/Disk/sdb6" commands to mount the file system., run "DF-HT" to check whether the operation is successful: (Successful !) 15. In addition, we can also set Automatic File Mounting to avoid manual mounting at each boot. Modify the configuration of the/etc/fstab file and run the "VI/etc/fstab" command as follows: (Hard Disk partitioning and mounting ends here) 16. Next we will start to implement the disk quota. Let's take the/dev/sdb1 partition as an example. Because the partition has been attached, but the disk configuration is not supported for the time being, we will unmount it first and then mount it later: 17. Run the "Mount-O usrquota, gwquota/dev/sdb1/Disk/sdb1" command to re-mount the partition so that it can increase user and group quotas, for a file system that supports the disk quota function, you can view the following information through "Mount: 18. Run the "quotacheck-augcv" command to check the disk quota information for all partitions in the current system, create a quota file in the available file system, and view the newly created quota file: 19. Set disk configuration for the user Jarry that has been created in the current system: 20. Set the disk space soft limit to 80 KB, the hard limit to kb, the number of files that can be created to 10, and the hard limit to 15: 21. Make Use the "quotaon-ugv/DISD/sdb1" command to enable the disk quota function: 22. next, verify that the configured Disk Quota function is effective. In the/Disk/sdb1 directory, create a new sub-directory public with the permission to read, write, and execute all users, and switch to the user Jarry, copy file news from directory/usr/share/doc/ced-4.1.5, size: 15 kb, when copying 5th times has exceeded disk space soft limit set 80 KB, the hard limit has been exceeded when the number of copies is 6th, and writing is not allowed. (Verification Successful !) 23. enter/Disk/sdb1/public to continue writing new Empty files. When the number of files written is 11, a warning has been issued that the number of files written exceeds the soft limit. A hard limit warning is issued when 16th files are written, writing new files is not allowed. (Verification Successful !) In addition, the function of setting disk quotas for a group is the same as that for users.

 

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.