Linux Disk partition table, file system view, statistical tools, some of the tools are multi-functional, not only to view the disk partition table, but also to do disk partitioning operations, but in this article, we only talk about the disk partition view, as well as the use of the partition view; This article is only for the novice on the road About the operation of the partition tool, I will do a special introduction in the future;
one, DF command;
DF is from the Coreutils software package, the system is installed, it comes with, we can use this command to see the disk usage and the location of the file system is mounted;
Example:
Code:
[[email protected] beinan]# Df-lhfilesystem capacity used available% mount point/dev/hda8 11G 6.0G 4.4G 58%//dev /shm 236M 0 236M 0%/dev/shm/dev/sda1 56G 22G 35G 39%/mnt/sda1 |
As we can see, the system is installed in/dev/hda8, and a 56G disk partition/dev/sda1 mounted in/mnt/sda1;
Please refer to #man DF for other parameters
Second, Fdsik
FDISK is a powerful disk manipulation tool from the Util-linux software package, and we'll just say how he looks at the partition table and the partition structure; parameter-l, which can get the partition of all the hard disks in the machine through the-l parameter;
Code:
[Email protected] beinan]# fdisk-ldisk/dev/hda:80.0 GB, 80026361856 bytes255 heads, $ sectors/track, 9729 Cylindersun its = cylinders of 16065 * 8225280 = bytes Device Boot Start End Blocks Id system/dev/hda1< c7/>* 1 765 6144831 7 hpfs/ntfs/dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)/dev/hda3 2806 7751 39728745 5 extended/dev/hda5 2806 3825 8193118+ linux/dev/hda6 3826 5100 10241406 5101 5198 787153+ , Linux swap/solaris/dev/hda8 5199 6657 11719386 83 linux/dev/hda9 6658 7751 8787523+-up Linux |
In the above blocks, represents the size of the partition, blocks unit is a byte, we can convert to M, such as the first partition/dev/hda1 size if converted to m, it should be 6144831/1024=6000m, that is, about 6G, in fact, no such trouble, A cursory look at the decimal point to move forward three bits, you know how much volume;
The file system represented by system, such as/DEV/HDA1, is in NTFS format;/dev/hda2 represents a file system in FAT32 format;.
In this case, we would like to pay special attention to the/DEV/HDA3 partition, which is the extended partition; he has a logical partition under the bread, in fact, the partition is equivalent to a container, from her own hda5,hda6,hda7,hda8,hda9;
We also noticed a little, why not hda4? Why is HDA4 not included in the extended partition? A disk has a maximum of four primary partitions, the hda1-4 is the primary partition, the HDA4 cannot be included in the extended partition, and the extended partition is also the primary partition, in this case, there is no HDA4 this partition, of course, we can set one of the partitions as the primary partition, but I did not do so when the partition;
To get a closer look, let's see if this disk still has space. Hda1+hda2+hda3= actually already partitioned the volume, so we can calculate this hda1+hda2+hda3=6144831+16386300+39728745 = 62259876 (b), convert to M units, the decimal point moves three bits forward, So the partition that has been partitioned is about 62259.876 (m), in fact the most accurate calculation 62259876/1024=60800.67 (m), and this disk size is 80.0 GB (80026361856byte), In fact, the actual size is 78150.744 (M); Through our series of calculations, we can conclude that the disk currently has a space to use, about 18G unpartitioned space;
Fdisk-l can list the number of all disks in the machine, and can also list all disk partitions, for example:
Code:
[[email protected] beinan]# fdisk-ldisk/dev/hda:80.0 GB, 80026361856 bytes255 heads, sectors/track, 9729 Cylind Ersunits = Cylinders of 16065 * 8225280 bytes Device Boot Start End Blocks Id system/dev/hda1 * 1 765 6144831 7 hpfs/ntfs/dev/hda2 766 2805 16386300 C W95 FAT32 (LBA)/dev/hda3 2806 7751 39728745 5 extended/dev/hda5 2806 3825 8193118+ 8 3 Linux/dev/hda6 3826 5100 10241406 linux/dev/hda7 5101 5198 787153+ 8 2 Linux swap/solaris/dev/hda8 5199 6657 11719386 linux/dev/hda9 6658 7751 8787523+ linuxdisk/dev/sda:60.0 GB, 60011642880 bytes64 heads, sectors/track, 57231 cylindersunits = Cylinde RS of 2048 * 1048576 = bytes Device Boot Start End Blocks Id system/dev/sda1 1 57231 58604528Linux |
By the above we can know that this machine has two hard drives, we can also specify fdisk-l to see the partition of one of the hard disks;
Code:
[Email protected] beinan]# fdisk-l/dev/sdadisk/dev/sda:60.0 GB, 60011642880 bytes64 heads, sectors/track, 57231 CY Lindersunits = Cylinders of 2048 * 1048576 bytes Device Boot Start End Blocks Id system/ DEV/SDA1 1 57231 58604528 Linux |
As you can tell by the above, there is only one partition in the/DEV/SDA disk, and the usage is almost hundred percent;
We can also check out the/dev/hda
Code:
[Email protected] beinan]# fdisk-l/dev/hda |
Try it yourself?
Third, Cfdisk from the Util-linux software package;
Cfdisk is also a good partitioning tool, in some distributions, this tool has been removed from the Util-linux package, Cfdisk easy-to-use is his feature, and the DOS is similar to Fdisk, in this title, We only explain how to check the disk partition status and the file system used in the machine;
To view disk partition usage Cfdisk-ps disk device name;
Like what
Code:
[Email protected] beinan]cfdisk-ps [[email protected] Beinan]cfdisk-ps /dev/hda [[email protected] Beinan] Cfdisk-ps Partition Table For/dev/hda First Last # Type Sector Sector Offset Length Filesystem Type (ID) Flag------------------------------------------------------------------------1 Primary 0< c11/>23438834 23438835 Linux ( Primary) Boot 2 23438835 156296384 0 132857550 Extended () none 5 Logical 23438835 155268224 $ 131829390 Linux ($) None 6 Logical 155268225 156296384 1028160 Linux Swap ($) None |
We only use the parameters-ps, the partition of the disk is listed, currently in the Slackware Debian Mandrake and other mainstream distribution of cfdisk, and Fedora 4.0 to remove the gadget; it's a pity; this is what I do in Slackware;
If you do this, it is more intuitive;
Code:
[[email protected] Beinan]cfdisk disk device name |
Example:
Code:
[Email protected] Beinan]cfdisk /dev/hda |
What you see is the following pattern:
Code:
cfd ISK 2.12a Disk Drive:/dev/hda size:80026361856 bytes, 80 .0 GB heads:255 Sectors per track:63 cylinders:9729 Name Flags part Type F S Type [Label] Size (MB)---------------------------------------------------------------------------- ---------------hda1 Boot Primary Linux ReiserFS 12000.69 hda5 Logical linux ReiserFS 67496.65 hda6 Logical Linux Swap 526.42 [bootable] [Delete] [help] [maximize] [Print] [Quit] [
Type] [Units] [Write] Toggle bootable flag of the current partition |
You enter the Cfdisk interface; move the pointer to [quit] with the keyboard to exit;
Four, parted function good partition tool; There is a belt in Fedora 4.0 that can be installed on your own; In this topic, we only say how to view the partition of the disk;
The call method is simple, parted default is to open the device is/dev/hda, can also be specified by themselves, such as Parted/dev/hda or/DEV/SDA, etc., quit the method is quit
Code:
[[email protected] beinan]# parted disk geometry using/dev/hda (parted) P/dev/hda: 0.000-76319.085 MBytes disk label type: Msdosminor start point termination point type file system flag 1 0.031 6000.842 primary partition NTFS start 2 6000.842 22003.088 primary partition FAT32 LBA3 22003.088 60800.690 Extended partition 5 22003.119 30004.211 Logical partition REISERFS6 30004.242 40005.615 logical partition REISERFS7 40005.646 40774.350 logical Partition LINUX-SWAP8 40774.381 52219.094 logical partition ext39 52219.125 60800.690 logical Partition ReiserFS |
We can use P to list the partition of the current disk in PARTD, and if you want to view other disks, you can use Select function, such as SELECT/DEV/SDA;
Five, qtparted, and parted related software and qtparted, can also see the structure of the disk and the file system used, is graphical;
[Email protected] ~]# qtparted
Graphical view, at a glance;
Six, Sfdisk is also a partition tool, the function is also a lot; we're here only to say that the function of the partition of his column disk;
Code:
[Email protected] beinan]# sfdisk-l |
Take a look at it yourself;
Sfdisk has several useful functions, and interested brothers may wish to look at it;
Seven, Partx also briefly said that some systems bring this tool, the function is simple, and Fdisk, parted, Cfdisk, not worth mentioning;
Usage: PARTX device name
Code:
[[email protected] beinan]# partx/dev/hda# 1: 63-12289724 (12289662 sectors, 6292 MB) # 2: 12289725-4506232 4 (32772600 sectors, 16779 MB) # 3: 45062325-124519814 (79457490 sectors, 40682 MB) # 4: 0- -1 ( 0 sectors, 0 MB) # 5: 45062388-61448624 (16386237 sectors, 8389 MB) # 6: 61448688-81931499 (20482812 Sectors, 10487 MB) # 7: 81931563-83505869 ( 1574307 sectors, 806 MB) # 8: 83505933-106944704 ( 23438772 sectors, 12000 MB) # 9:106944768-124519814 (17575047 sectors, 8998 MB) |
Eight, to view all the current machine disk and partition conditions:
Code:
[[email protected] ~]$ cat/proc/partitionsmajor minor #blocks name 3 0 78150744 hda 3 1 6144831 hda1 3 2 1638 6300 Hda2 3 5 8193118 hda5 3 6 10241406 hda6 3 7 787153 hda7 3 8 11719386 hda8 3 9 8787523 hda9 8 0 58605120 SDA 8 1 58604528 sda1 |
|
Linux View a description of the commands and tools related to disk partitioning, file system, and disk usage