View disk usage status

Source: Internet
Author: User

1. df command;

DF comes from the coreutils software package and comes with it during system installation. We can use this command to view the disk usage and the location where the file system is mounted;

Example:

[Root @ localhost beinan] # DF-lH
Filesystem capacity in use available % mount point
/Dev/hda8 x g 6.0g 4.4g 58%/
/Dev/SHM *** M 0 *** M 0%/dev/SHM
/Dev/sda1 ** G 22g 35g 39%/mnt/sda1

We can see that the system is installed in/dev/hda8; there is also a 56 GB disk partition/dev/sda1 mounted in/mnt/sda1;

For other parameters, see man DF.

Ii. fdsik

Fdisk is a powerful disk operation tool from util-linux. Here we only talk about how to view the disk partition table and partition structure. The parameter-L is passed through the-l parameter, obtain the partition information of all the hard disks on the machine;
[Root @ localhost beinan] # fdisk-l
Disk/dev/hda: 80.0 GB, 80026361 *** bytes
255 heads, 63 sectors/track, 9 *** Cylinders
Units = cylinders of 16 *** 512 = 8225 *** bytes
Device boot start end blocks ID system
/Dev/hda1*1 765 614483 ** HPFs/NTFS
/Dev/hda2 766 2805 16386 *** C w95 FAT32 (LBA)
/Dev/hda3 2806 7751 3972 ***** extended
/Dev/hda5 2806 3825 819 *** + 83 Linux
/Dev/hda6 3826 5100 1024 ****** Linux
/Dev/hda7 5101 5198 78 ***** + 82 Linux swap/Solaris
/Dev/hda8 5199 6657 1171 ****** Linux
/Dev/hda9 6658 7751 878 *** + 83 Linux

In the above blocks, it indicates the partition size, and the unit of blocks is byte. We can convert it to M. For example, if the size of the first partition/dev/hda1 is converted to m, it should be 614 */1024 = * m, that is, about 6 GB. In fact, this is not so troublesome. Let's roughly look at moving the decimal point three places forward, you will know the approximate volume;
System indicates the file system. For example,/dev/hda1 is in NTFS format;/dev/hda2 indicates a file system in FAT32 format ;.

In this example, we should pay special attention to the/dev/hda3 partition, which is an extended partition. It contains a logical partition, which is actually equivalent to a container; from her own hda5, hda6, hda7, hda8, hda9;

We also noticed that there is no hda4. Why? Why is hda4 not included in the extended partition? A disk can have up to four primary partitions; A hda1-4 is regarded as the primary partition; hda4 cannot be included in the extended partition, and the extended partition is also considered the primary partition; in this example, there is no hda4 partition, of course, we can set one of the partitions as the primary partition, but I didn't do this at the time;

Let's take a closer look at the statistics and see if there is space on this disk? Hda1 + hda2 + hda3 = Volume of actually partitioned data, therefore, we can calculate hda1 + hda2 + hda3 = 614 ***** + 1638 ***** + 39728 ***** = 62259 **** (B ), it is converted into m units, and the decimal point is shifted to three places. Therefore, the size of the partition that has been divided is about 62259.876 (m ), in fact, the most precise calculation is 6225 */1024 = 6 ****. 67 (M), and the disk size is 80.0 GB (8002636 *** byte), in fact, the actual size is 78150.744 (M). Through a series of calculations, we can see that this hard disk still has space to use; there is about 18 GB unpartitioned space;

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.