Disk MBR partitioning in Linux--practice

Source: Internet
Author: User

Disk MBR partitioning in Linux--Practice of FDISK command syntax

FDISK (options) (parameters)

Options
-b <分区大小>  指定每个分区的大小-l    列出分区表信息-v                            显示版本信息
Parameters

Device files: e.g./DEV/SDA

Instance

Select the disks you want to manipulate:

[root@vathe ~]#fdisk /dev/sdb

Enter m to list the commands that can be executed:

Command (M forHelp):McommandAction A toggle a bootable flag B edit BSD DisklabelC Toggle the DOSCompatibility flagDDelete aPartition # Deleting partitionsLList knownPartition Types # shows the known partition typeM Print this menu # Displays the Help menuNAdd anew partition # Add partition o create A Span class= "Hljs-keyword" >new empty DOS partition table p print the partition table # view partition table Q quit without saving changes # do not save back Hu s  Create a new empty Sun disklabel t Span class= "Hljs-keyword" >change a partition ' s system ID # System ID of the table partition U change display/entry units v Verify the partition Table W write table to disk and exit # Save partition and exit X extra funct Ionality (experts only)             

To view the partition table:

Command (M forHelp):PDISK/DEV/SDB:10.7 GB,10737418240bytes255 heads,Sectors/track,1305 cylindersunits = CylindersOf16065 *512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytes i/o size (minimum/optimal): 512 bytes/ 512 bytesdisk identifier:  0x48283ee0 Device Boot start end Blocks id system         

New Partition Table:

CommandAction#选择新增分区类型 E Extended#扩展分区 p Primary partition (1-4)#主分区p//type ppartition number (1-4): 1 //type 1First cylinder (1-1305, default 1): # select partition start cylinder Using default value 1 //Select default 1Last cylinder, +cylinders or +size{k,m,g} (1-1305, default 1305): + 1g  #设置分区大小 1g,+ means add after start,- To add a partition before the start point                

View confirmation that the partition was created successfully:

Command (M forHelp):PDISK/DEV/SDB:10.7 GB,10737418240Bytes # Total disk size10.7GB255 heads,Sectors/track,1305 Cylinders #255 heads, each with a track63 sectors,1305 cylindrical faces units = cylindersOf16065 *512 =8225280BytessectorSize (logical/physical): 512 bytes/512 bytes i/o size (minimum/optimal): 512 bytes/ 512 bytesdisk identifier:  0x48283ee0 Device Boot start end Blocks id system/dev/sdb1 1 132 1060258+ 83 Linux 
build an extended partition

Command (M for help): N
Command Action E Extended P primary partition (1-4) e partition number (1-4): 4 # partition number first cylinder (133-1305, default 13 3): 900
Last cylinder, +cylinders or +size{k,m,g} (900-1305, default 1305): +500m # Extended Partition 500M

在扩展分区中创建逻辑分区

Command (M for help): N

Command Action

L logical (5 or over)

P primary partition (1-4) L

First cylinder (900-964, default 900):

Using default value of cylinder, +cylinders or +size{k,m,g} (900-964, default 964): +100m # Logical Partition 100M

View a list of partitions

Command (M forHelp):PDISK/DEV/SDB:10.7 GB,10737418240bytes255 heads,Sectors/track,1305 cylindersunits = CylindersOf16065 *512 =8225280BytessectorSize (logical/Physical):512Bytes/512bytes/ oSize (minimum/optimal): 512 bytes/512 bytesdisk identifier: 0x48283ee0 Device Boot Span class= "Hljs-keyword" >start end Blocks id system/dev/sdb1 1 132 1060258+ 83 linux/dev/sdb4 900 964 522112+ 5  EXTENDED/DEV/SDB5 900 913 112423+ Span class= "Hljs-number" >83 Linux            

Save exit

help): w             # 保存退出The partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.

View

[[Email protected] ~]#lsblk NAME maj:min RM SIZE RO TYPE MOUNTPOINTsr011:013.7G0 ROM SDA8:00200G0 disk├─sda18:10200M0 Part/boot├─sda28:2020G0 Part/data├─sda38:3010G0 PART/HOME├─SDA48:401K0 Part├─sda58:502G0 Part [Swap]└─sda68:6 0  167.8G 0 part/sdb 8:16 0 10g 0 disk # Display partition success ├─SDB1 8:17 0 1g 0 part├─sdb4 8:20 Span class= "Hljs-number" >0 1k 0 part└─sdb5 8:21 0 109.8M 0 part             

Partition success, of course, to use disk, there are still two operations to use disk--to mount the disk in a specific directory (or file), and to format a partition.

Disk MBR partitioning in Linux--practice

Related Article

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.