Example explains how to use Fdisk partition in Linux
I. Introduction to FDISK
Fdisk-partition table manipulator for Linux, translated into Chinese means the Disk partition table operation tool; I do not translate very well, and do not read Chinese documents; It is the partitioning tool.
Fdsik partitions can be divided into several areas, but also for each partition to specify the partition of the file system, such as Linux, FAT32, Linux, Linux swap, FAT16 and in fact Unix-like operating system file systems, etc. of course, when we use FDISK to partition disk operations , is not an end point, we also want to format the partition of the required file system, such a partition to use; This is similar to Fdisk in DOS.
Ii. Plan your hard disk partition rationally
Before we operate the partitions, we need to understand the theory of hard disk partitioning, such as the calculation of hard disk capacity and partition size, and how to plan partitions for a hard disk.
Third, fdisk-l view hard disk and partition information
We know that the total number of primary partitions (including extended partitions) cannot exceed four, or that extended partitions can be surrounded between primary partitions, which makes it easier to partition hard disk partitions, and to reduce unnecessary hassles in the future.
1, through the fdisk-l to see the number of hard disk and partition of the machine
[Root@localhost beinan]# Fdisk-l
disk/dev/hda:80.0 GB, 80026361856 bytes
255 heads, Sectors/track, 9729 cylinders
Units = 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 9729 55617030 5 Extended
/dev/hda5 2806 3825 8193118+ Linux
/dev/hda6 3826 5100 10241406 Linux
/dev/hda7 5101 5198 787153+ Linux Swap/solaris
/dev/hda8 5199 6657 11719386 Linux
/DEV/HDA9 6658 7751 8787523+ Linux
/DEV/HDA10 7752 9729 15888253+ Linux
disk/dev/sda:1035 MB, 1035730944 bytes
256 heads, Sectors/track, cylinders
Units = Cylinders of 16128 * 8257536 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 201568+ C W95 FAT32 (LBA)
/dev/sda2 806400 5 Extended
/dev/sda5 201568+ Linux
/dev/sda6 Wuyi 200781 Linux
With the information above, we know that two hard drives (or mobile drives) are mounted in this machine, one of which is HDA and the other is SDA; if we want to see a single hard drive, we can do it by fdisk-l/dev/hda1 or fdisk-l/dev/sda1. fdisk-l The hard drive ID of the output is the same.
The HDA has three primary partitions (including extended partitions), namely primary partitions hda1 Hda2 and Hda3 (extended partitions), and logical partitions HDA5 to HDA10.
The SDA has two primary partitions (including extended partitions), respectively SDA1 and SDA2 (extended partitions), and logical partitions are SDA5 Sda6.
Total hard disk capacity = Total capacity of primary partition (including extended partition)
Extended partition capacity = logical partition Total capacity
Through the above example, we can learn about Hda=hda1+hda2+hda3, where hda3=hda5+hda6+hda7+hda8+hda9+hda10 ...
2, about the Fdisk-l some numerical value explanation
disk/dev/hda:80.0 GB, 80026361856 bytes
255 heads, Sectors/track, 9729 cylinders
Units = Cylinders of 16065 * 8225280 bytes