Linux Essentials (disk partitioning)

Source: Internet
Author: User

Linux disk partitioning to file system creation

First understand the basic structure of the disk

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/85/wKioL1XlqY2DJe19AAINzWMgMng055.jpg "style=" float: none; "title=" 155633_kdic_96486.png "alt=" Wkiol1xlqy2dje19aainzwmgmng055.jpg "/>

The partition command to use:

Fdisk: Up to 15 partitions can be managed for a hard drive

Syntax: fdisk [Option][device]

P:print, show existing partitions n:new, create D:delete, delete w:write, write to disk and exit

Q:quit, discard Update and exit M: Get help L: List partition ID T: Adjust partition ID

To start a disk partition:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/85/wKioL1XlqY2D4bNZAAM5tG3UIeI637.jpg "style=" float: none; "title=" 1.png "alt=" Wkiol1xlqy2d4bnzaam5tg3uiei637.jpg "/>

Here you can see two hard disks sda1 and Sda2, the first hard drive sda1 is installed system. The sda2 hard disk is not partitioned.

Enter FDISK/DEV/SDA and then enter to partition the hard drive. Such as

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/89/wKiom1Xlp22zPSNZAAGHnQ8G8nE943.jpg "style=" float: none; "title=" 2.png "alt=" Wkiom1xlp22zpsnzaaghnq8g8ne943.jpg "/>

Enter N to new partition, then enter P return to create a new primary partition.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/85/wKioL1XlqY7Sq98FAACh4oJDY1M356.jpg "style=" float: none; "title=" 3.png "alt=" Wkiol1xlqy7sq98faach4ojdy1m356.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/89/wKiom1Xlp23SRLW-AACZJj8iPVA242.jpg "style=" float: none; "title=" 4.png "alt=" Wkiom1xlp23srlw-aaczjj8ipva242.jpg "/>

This is required to select the partition number in 1-4, enter 3 return car

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/85/wKioL1XlqY7BaoIyAADYL0T9HZg725.jpg "style=" float: none; "title=" 5.png "alt=" Wkiol1xlqy7baoiyaadyl0t9hzg725.jpg "/>

Firstcylinder (7859-15665, default 7859): Here is the cylinder to set the start of the partition, directly enter the default can be selected, enter after the

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/89/wKiom1Xlp23Auz-jAAEzFSOUZMY857.jpg "style=" float: none; "title=" 6.png "alt=" Wkiom1xlp23auz-jaaezfsouzmy857.jpg "/>

Lastcylinder, +cylinders or +size{k,m,g} (7859-15665, default 15665):

Here is the set partition end cylinder, +3g means starting from the starting cylinder backward 3G end, is also set the partition size to 3G, enter +3g after the return, as shown in

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/85/wKioL1XlqY6SKywuAAFOny6T62w040.jpg "style=" float: none; "title=" 7.png "alt=" Wkiol1xlqy6skywuaafony6t62w040.jpg "/>

Here you can enter p to see if the partition was successful, enter P carriage, such as: Display partition success

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/89/wKiom1Xlp26ygzIWAAFinsXc-78639.jpg "style=" float: none; "title=" 8.png "alt=" Wkiom1xlp26ygziwaafinsxc-78639.jpg "/>

Next, check to see if the kernel has identified the new partition: # Cat/proc/partations

(Execute commands from top to bottom until the kernel reads to the new partition)

Notifies the kernel to re-read the hard disk partition table:

Partx-a/dev/device

-N m:n

kpartx-a/dev/device Note (CentOS 5: Using Partprobe [/dev/device])

-f:force

Chapter Two: Creation of file systems (virtual file system for Linux)

Learn about the relationships between file systems and Linux virtual file systems wear pieces

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/89/wKiom1Xlp2zxpzbiAAD6w0OmNCA880.jpg "style=" float: none; "title=" 20150819_6bf934e568ec295e9c2etzmx2ldv0hlf.jpg "alt=" Wkiom1xlp2zxpzbiaad6w0omnca880.jpg "/>


Commands you need to know to create a file system:

MKFS command: # MKFS. Fs_type/dev/device [OPTION]:-l ' LABEL ': Setting the volume label

# Mkfs-tfs_type/dev/device

MKE2FS : Ext Series File system dedicated management tool

Blkid : Block Device properties Information view Blkid [OPTION] ... [DEVICE]

DUMPE2FS :-H: View Super block information

File System Detection:

Fsck:file System CheCk

Fsck. Fs_type

fsck-t fs_type-a: Auto Fix error-r: Interactive fix error

Note:fs_type Be sure to have the same file type as the partition;

e2fsck : Ext Series file-specific detection and repair tool

- y : Automatic answer is yes;

- F : Forced repair;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/85/wKioL1XlqY_BGslHAAT29STVjdg936.jpg "style=" float: none; "title=" 9.png "alt=" Wkiol1xlqy_bgslhaat29stvjdg936.jpg "/>


Disk partition is successful, the following will be formatted

Format the disk with the command MKE2FS, formatted as a EXT4 file type.


This article from "Hotel California" blog, reproduced please contact the author!

Linux Essentials (disk partitioning)

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.