Linux fdisk command to create logical partitions process detailed

Extended partition can not be formatted and used directly, so also in the extended internal partition and then create the logical partition.

Let's look at the process of establishing a logical partition, the following commands:
[the root @ localhost ~] # the fdisk / dev / SDB
... output omitted ...
the Command (m for Help): n-
# Create a new partition
the Command Action
L Logical (or over. 5 )
# Since in the previous section, the extended partition has been established, so here becomes L (logic)
P Primary partition (1-4)
L
# establishing a logical partition
First Cylinder (655-2610, default 655):
# do not specify partition number, default assigned from 5, it is directly selected starting cylinder
# Note: a logical partition is in the extended partition subdividing the interior, so the cylinder is extended and the partition overlap
the Using default value 655
Last cylinder, or + + cylinders {K size, m, G} (655-2610, 2610. default): + 2G
# 2GB size distribution
the Command (m for Help): n-
# re-establishing a logical partition
the Command Action
L logical (or over. 5)
P Primary partition ( 1-4)
L
First cylinder (917-2610, default 917):
Using default value 917
Last cylinder, +cylinders or +size{K, M, G} (917-2610, default 2610):+2G
Command (m for help): p
#查看一下已经建立的分区
Disk /dev/sdb: 21.5GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 *512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xb4b0720c
Device Boot Start End Blocks id System
/dev/sdb1 1 654
5253223+ 83 Linux
#主分区
/dev/sdb2 655 2610 15711570
5 Extended
#扩展分区
/dev/sdb5 655 916
2104483+ 83 Linux
# Logical partition. 1
/ dev / sdb6 917 1178
2104483+ the Linux 83
# logical partition 2
the Command (m for Help): W
# Save and exit
of The Partition Table has been Altered!
The Calling the ioctl. . Partition the Read the Table to Re-
Syncing Disks.
[root @ localhost -] #
# return to the prompt interface

All partitions legislation process if not to save and exit is not in effect, so the establishment of wrong does not matter, use the q command to quit without saving. If you use the w command, it will save and exit. Sometimes because the partition table system is busy, so it is necessary to restart the system before the entry into force of the new partition table. Command is as follows:
the Command (m for Help): W
# Save and exit
of The Partition Table has been Altered!
The Calling the ioctl () to Re-Read Partition Table.
The WARNING: Re-Reading The Partition Table failed with error 16:
Device or Resource BUSY .
at The Kernel at The Old Still uses the Table.
at The new new BE Used by Will the Table at The AT the Next reboot.
# require a restart to format
Syncing disks.

see it? You must restart! But it is a waste of time to restart. If you do not want to reboot, you can use the partprobe command. The role of the command is to allow the kernel to re-read the partition table information, so that you can not re-started. Command is as follows:
[the root @ localhost ~] # the partprobe

If the command does not exist, please install parted-2.1-18.el6.i686 this package. partprobe command is not necessary, if not prompted to restart the system, can be directly formatted.

发布了160 篇原创文章 · 获赞 97 · 访问量 16万+

Guess you like

Origin blog.csdn.net/zyy1659949090/article/details/88176734