Linux disk format, mount, disk inspection, and other management functions

Source: Internet
Author: User
Tags disk usage

DF: List The overall disk usage of the file system
Du: Check Disk space usage
FDISK: For disk partitioning

The DF command lists the overall disk usage of the system

DF Command parameter function: Check the disk space consumption of the file system. You can use this command to get information about how much space the hard disk is taking up, and how much space is left.
Grammar:
DF [-ahikhtm] [directory or file name]
Options and Parameters:
-A: Lists all file systems, including system-specific/proc, etc.
-K: Displays the file system in Kbytes capacity;
-M: Display the file system in MBytes capacity;
-H: GBytes, MBytes, Kbytes and other formats are displayed by people who are easier to read;
-H: Replace m=1024k with m=1000k;
-T: Displays the file system type, along with the filesystem name of the partition (for example, ext3);
-I: Do not use the hard disk capacity, but the number of inode to display

Displays the available disk capacity under/etc in an easy-to-read capacity format

[Email protected] ~]# df-h/etcfilesystem            Size  used Availuse% mountedon/DEV/HDC2              9. 5G  3. 7G  5. 4G  

Second, du command check disk space and usage

Du
The Linux du command also looks at the use of space, but unlike the DF command, the Linux du command is a view of the space used by the file and directory disks, or some difference from the DF command, which describes the Linux du command.
Grammar:
Du [-ahskm] file or directory name
Options and Parameters:
-A: Lists all files and directory capacity, because the default is only the number of files under the directory.
-H: Displayed in a more readable capacity format (g/m);
-S: Lists the total, not the capacity of each directory;
-S: does not include totals under subdirectories, and is somewhat different from-S.
-K: List capacity display in Kbytes;
-M: List capacity display with MBytes;

Third, fdisk command

FDISK is a disk partition table manipulation tool for Linux.
Grammar:
Fdisk [-l] Appliance name
Options and Parameters:
-L: Outputs all the partition contents of the device after the output. If there is only fdisk-l, the system will list the partitions of the device that can be searched in the whole system.

1. List partition information

Fdisk-l

Device start start end sector Size Id type
/DEV/SDA1 * 2048 39845887 39843840 19G Linu
/dev/sda2 39847934 41940991 2093058 1022M 5 extension
/dev/sda5 39847936 41940991 2093056 1022M Linu

2. Locate the disk in the root directory on your system and check the relevant information in the drive

DF/

Third, disk check

Disk inspection
The fsck (file system check) is used to check and maintain inconsistent file systems.
If the system is out of power or a disk problem occurs, the fsck command can be used to check the file system.
Grammar:
fsck [-t file system] [-acay] Appliance Name
Options and Parameters:
-T: Given the type of the file system, this parameter is not required if there is already a definition in/etc/fstab or if the kernel itself is supported
-S: Execute the fsck command one by one to check
-A: Check all listed partitions (partition) in/etc/fstab
-C: Show complete Check progress
-D: Print out debug results for e2fsck
-P: Simultaneously with the-a condition, multiple fsck checks are performed together
-R: Omit/No check when there is a-a condition at the same time
-V: Verbose display mode
-A: Automatically fix if check is wrong
-R: If the check is wrong, the user answers whether the repair
The-y: option specifies to detect that each file is automatically entered Yes and can perform a # fsck-y full check fix when unsure of those that are not normal.
Example 1
See how many file system support FSCK commands the system has:
[[email protected] ~]# Fsck[tab][tab]
fsck Fsck.cramfs fsck.ext2 fsck.ext3 fsck.msdos fsck.vfat
Example 2
To force detection of/DEV/HDC6 partitions:
[Email protected] ~]# fsck-c-f-t ext3/dev/hdc6
Fsck 1.39 (29-may-2006)
E2fsck 1.39 (29-may-2006)
Pass 1:checking inodes, blocks, and sizes
Pass 2:checking directory structure
Pass 3:checking Directory Connectivity
Pass 4:checking Reference counts
Pass 5:checking Group summary Information
vbird_logical:11/251968 files (9.1% non-contiguous), 36926/1004046 blocks
If you do not add-f option, because this file system has not been the problem, the check is very fast! If you add the-f mandatory Check, an item is displayed.

Linux disk format, mount, disk inspection, and other management functions

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.