Linux creates extended partitions and logical partitions

Source: Internet
Author: User

[[email protected] ~]# FDISK/DEV/SDB//Enter the disk to be allocated

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').

Command (M for help): N//create partition
Command Action
E Extended
P primary partition (1-4)
E//Create an extended partition
Partition number (1-4): 4//Partition code
First cylinder (5121-10240, default 5121)://partition start cylinder, enter defaults
Using Default Value 5121
Last cylinder, +cylinders or +size{k,m,g} (5121-10240, default 10240)://partition End Cylinder
Using Default Value 10240

Command (M for help): P//print partition condition

disk/dev/sdb:10.7 GB, 10737418240 bytes
Heads, Sectors/track, 10240 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xb92c060c

Device Boot Start End Blocks Id System
/DEV/SDB1 1 5120 5242864 Linux
/DEV/SDB4 5121 10240 5242880 5 Extended

Command (M for help): N//create partition

Command Action
L logical (5 or over)
P primary partition (1-4)
L//Create logical partition
First cylinder (5121-10240, default 5121)://partition start cylinder, enter defaults

Using Default Value 5121
Last cylinder, +cylinders or +size{k,m,g} (5121-10240, default 10240): 8192

Command (M for help): N//Create a partition again

Command Action
L logical (5 or over)
P primary partition (1-4)
L//Create a logical partition again

First cylinder (8193-10240, default 8193)://partition start cylinder, enter defaults

Using Default Value 8193
Last cylinder, +cylinders or +size{k,m,g} (8193-10240, default 10240)://partition End Cylinder

Using Default Value 10240

Command (M for help): P//print partition table for viewing

disk/dev/sdb:10.7 GB, 10737418240 bytes
Heads, Sectors/track, 10240 cylinders
Units = Cylinders of 2048 * 1048576 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xb92c060c

Device Boot Start End Blocks Id System
/DEV/SDB1 1 5120 5242864 Linux
/DEV/SDB4 5121 10240 5242880 5 Extended
/DEV/SDB5 5121 8192 3145712-up Linux
/DEV/SDB6 8193 10240 2097136-up Linux

Command (M for help): W//w save above settings, Q exit without error
The partition table has been altered!

Calling IOCTL () to re-read partition table.

Warning:re-reading the partition table failed with error 16:device or resource busy.
The kernel still uses the old table. The new table is being used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
Syncing disks.
[[email protected] ~]# MKFS.EXT4/DEV/SDB5//format
MKE2FS 1.41.12 (17-may-2010)
Could not STAT/DEV/SDB5---No such file or directory//The note here, first execute the partprobe command let the system kernel reread the partition table, if the error to reboot

[[email protected] ~]# MKFS.EXT4/DEV/SDB5//Formatting/DEV/SDB5
MKE2FS 1.41.12 (17-may-2010)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
196608 inodes, 786428 blocks
39321 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=805306368
Block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing Inode Tables:done
Creating Journal (16384 blocks): Done
Writing superblocks and filesystem accounting Information:done

This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
[[email protected] ~]# MKFS.EXT4/DEV/SDB6//Formatting/DEV/SDB6
MKE2FS 1.41.12 (17-may-2010)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524284 blocks
26214 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=536870912
Block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing Inode Tables:done
Creating Journal (8192 blocks): Done
Writing superblocks and filesystem accounting Information:done

This filesystem'll be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
[Email protected] var]# mkdir/disk01
[Email protected] var]# mkdir/disk02
[[email protected] var]# mount/dev/sdb5/disk01//Mount partition
[Email protected] var]# mount/dev/sdb6/disk02
[Email protected] var]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/volgroup-lv_root
50G 3.9G 43G 9%/
Tmpfs 940M 72K 940M 1%/DEV/SHM
/DEV/SDA1 485M 38M 423M 9%/boot
/dev/mapper/volgroup-lv_home
45G 532M 43G 2%/Home
/DEV/SDB5 3.0G 69M 2.8G 3%/disk01
/DEV/SDB6 2.0G 35M 1.9G 2%/disk02
[[email protected] var]# vi/etc/fstab//Add to config file, here slightly

Linux creates extended partitions and logical partitions

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.