Create a partition with Fdisk under Linux

Source: Internet
Author: User

First, input fdisk-l/DEV/SDA, observe the hard disk entity use case.
Second, input FDISK/DEV/SDA, can enter the partition hard disk mode.
1. Enter m to display all the commands listed below.
2. Enter p to display the hard disk segmentation situation.
3. Enter a to set the boot area of the hard drive.
4. Enter N to set a new hard disk partition.
4.1. Enter the E-drive as the [extended] partition (extend).
4.2. Enter the P drive as [primary] partition (primary).
5. Enter T to change the drive partition properties.
6. Enter D to delete the hard drive partition properties.
7. Enter Q End does not deposit the hard disk partition attribute.
8. Enter W to end and write to disk partition properties

Instance:

(1) Enter the Fdisk interface to list all commands
#fdisk/DEV/SDA

(2) M: Show all commands used in Fdisk
Command (M for help): M

(3) P: Display hard disk partition information
Command (M for help):p
disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x0000f797

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 204800 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 287 2097152 Swap/solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 287 2611 18668544-up Linux

Description
Device boot (boot): Indicates the boot partition
Start: Indicates which cylinder a partition starts from
End: Represents the end of a section to which cylinder ends
Blocks (capacity): Indicates the partition capacity, in kilobytes
ID and System: Confirm partition Type

(4) Creating and deleting primary partitions, extended partitions, and logical partitions
Command (M for help): N
Command Action
E Extended//extended partition
P primary partition (1-4)//Primary partition
P
Selected Partition 4
There are extended partitions and primary partitions, and logical partitions are established in the extended partition. Note that 1-4 in parentheses, up to four primary partitions (including extended partitions) can be built. Build a primary partition first:

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P #建主分区
Partition number (1-4): 1 #分区号为1
First cylinder (1-2610, default 1): #直接回车默认从第一个柱面开始划分
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-2610, default 2610): +2g #加空间大小, there are a number of options: + rear units can be connected to m,g,k (remember to capitalize) to divide the space you add, It can also be a number of cylinders. Either way, you cannot exceed the remaining space on the disk otherwise it is invalid.

Command (M for help): P #分好后查看分区信息, all that has just been done at a glance.

disk/dev/sdb:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xfaa2aa49

Device Boot Start End Blocks Id System
/DEV/SDB1 1 262 2104483+ Linux

To establish an extended partition as described above:

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
E #建立扩展分区
Partition number (1-4): 4
First cylinder (263-2610, default 263):
Using Default Value 263
Last cylinder, +cylinders or +size{k,m,g} (263-2610, default 2610): +4g

Command (M for help): P

disk/dev/sdb:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xfaa2aa49

Device Boot Start End Blocks Id System
/DEV/SDB1 1 262 2104483+ Linux
/DEV/SDB4 263 785 4200997+ 5 Extended

The extended partition is built so we can create a logical partition on the extended partition.

Command (M for help): N
Command Action
L logical (5 or over)
P primary partition (1-4)
L #建逻辑分区
First cylinder (263-785, default 263):
Using Default Value 263
Last cylinder, +cylinders or +size{k,m,g} (263-785, default 785): +2g

Command (M for help): P

disk/dev/sdb:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xfaa2aa49

Device Boot Start End Blocks Id System
/DEV/SDB1 1 262 2104483+ Linux
/DEV/SDB4 263 785 4200997+ 5 Extended
/DEV/SDB5 263 524 2104483+-up Linux
The above shows that the good one primary partition has been built, a logical partition, but these are not yet valid we need to save the exit.

Command (M for help): W #保存退出
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.

[[Email protected] Desktop]# fdisk-l

disk/dev/sda:85.9 GB, 85899345920 bytes
255 heads, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk IDENTIFIER:0X000471AD

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 204800 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 3851 30720000 Linux
/dev/sda3 3851 4106 2048000, Linux Swap/solaris
/DEV/SDA4 4106 10444 50912256 5 Extended
/dev/sda5 4106 10444 50911232-up Linux

disk/dev/sdb:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xfaa2aa49

Device Boot Start End Blocks Id System
/DEV/SDB1 1 262 2104483+ Linux
/DEV/SDB4 263 785 4200997+ 5 Extended
/DEV/SDB5 263 524 2104483+-up Linux

Create a partition with Fdisk under Linux

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.