One day Linux Command (13) dF du fdisk disk management

Source: Internet
Author: User

DF

Syntax: DF [-ahikmt]
Note: displays the status of the file system or displays the status of all file systems (default value)

Parameters:

-A, -- all contains all file systems with 0 blocks
-H, -- human-readable uses a human-readable format (the preset value does not include this option ...)
-I, -- inodes: List inode information, not list used Blocks
-K, -- kilobytes is like -- block-size = 1024
-M, -- megabytes is like -- block-size = 1048576
-T, -- print-type indicates the format of the file system.

Example:

$ DF-HT

Du

Syntax: Du [-abckms] [directory name]

Description: displays the directory or file size.
Parameter: [directory name] can be omitted. If this parameter is omitted, the file capacity of the current directory is counted.
-A: lists all files and directories. The default value is the value of the List Directory.
-B: the values listed are output in bytes.
-C: Calculate total
-K: The listed values are output in KB.
-M: The listed values are output in MB.
-S: only list the final sum of values.
Example:
Example 1: List the volume of directories and files under/root, in MB
$ Du-m
Example 2: calculate the total directory and file capacity under/home and output the total capacity here.
$ Du-S/home

Fdisk  
Purpose: Split a hard disk
Usage: 1. Enter fdisk-L/dev/SDA on the console to observe the physical usage of the hard disk.
2. Enter fdisk/dev/SDA on the console to enter the split hard disk mode.
M: All commands are listed.
P shows the hard disk partition.
A. Set the hard disk boot zone.
N sets the new hard disk partition.
Enter the "e" hard drive as the [extended] partition (extend ).
Enter P hard drive as the [primary] partition (primary ).
T changes the partition property of the hard disk.
D. Delete the partition property of the hard disk.
Q ends and is not saved to the hard disk partition.
W ends and is written to the hard disk partition.

Example:

As mentioned above, the main task of fdisk is to modify the partition table without actually cutting the hard disk and then format it with mke2fs. It defines a partition from the N1 column to the N2 column. Therefore, if the hard disk partition is incorrect, you can recover the partition table before formatting.

Example 1: delete a partition: to delete an existing partition, you must:
1. $ fdisk/dev/HDB: Enter the fdisk interface first;

2. P: Check the partition information first. assume you want to delete/dev/hdb1;

3. D: select a partition. Select 1 here;
4. W: Save the modification to the disk data table and exit fdisk. What should I do if I regret it? Press the Q key to cancel the deletion operation.

Example 2: Add a partition: how to add a partition? The premise is that you still have space on your hard disk.
1. $ fdisk/dev/HDB: Enter the fdisk interface first;
2. N: Add a partition. If you already have an extended partition, the system will ask whether you want to add a primary partition or a logical partition. If you have not yet extended the partition, the system will ask you whether to add a primary partition or an extended partition. In addition, if you have used up 4 P + e, you can select only logical partitions. If you select the primary partition, press P; otherwise press E or L;
3. P: select the primary partition, so press p;
4. 1-4: only four primary partitions are allowed (it is much better than Windows to allow only one). Therefore, please press the number corresponding to the partition that has not been used;
5. W: Save and exit.

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.