Linux fdisk command parameters and usage details---Linux disk partition management command fdisk

Source: Internet
Author: User

FDISK command Linux disk partition management
  
Purpose: To observe the physical use of hard disk and split the hard disk.

How to use:

First, enter Fdisk-l/DEV/SDA on the console to observe the physical use of the hard disk.

Second, enter the FDISK/DEV/SDA on the console, 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. (used when making swap partitions)

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

Extension data: linuxidc.com Summary of the process of adding partitions

Fdisk/dev/sda

P list the current partition table

n Add a new partition

Enter the block address to select the start, direct return to the default on the

+2G Enter the size of the partition to be added +200m,+1g this will recognize

Enter OK

W Write and exit

Partprobe update the current partition table to the kernel this step is important, otherwise your partition restarts to see.

Mkfs.ext3/dev/sda6 formatting a new partition

Mount/dev/sda6/data Mount

In addition, the T parameter can be converted to the partition format, FD is the raid type, E8 is the type of PV used to do LVM.

A few days ago to learn RHCE's zoning exercises. So these. Already quite familiar with, hehe.

Linux under FDISK command operation Disk--Add, delete, convert partitions, etc.

Linux under FDISK command operation Disk--Add, delete, convert partitions, etc.

The command format for Fdisk to manipulate the hard disk is as follows:

[[email protected] beinan]# fdisk device

For example, we know/dev/hda or/DEV/SDA device through fdisk-l, if we want to add or remove

Some partitions that can be used

[Email protected] beinan]# Fdisk/dev/hda

Or

[Email protected] beinan]# FDISK/DEV/SDA

Note In the following example, we will use the/DEV/SDA device as an example to explain how to operate with Fdisk to add, delete

In addition to zoning and other actions;

1, the description of Fdisk;

When we go through the FDISK device and enter the operation of the corresponding device, we will find the following prompt; FDISK/DEV/SDA

Equipment for example, the same as the same;

[Email protected] beinan]# FDISK/DEV/SDA

Command (M for help): pressing m here will output the aid;

Command Action

A toggle a bootable flag

b Edit BSD Disklabel

C Toggle the DOS compatibility flag

D Delete a partition note: This is the action of deleting a partition;

L list Known partition types Note: L is a list of partition types for us to set the corresponding partition type;

M Print this menu note: M is a list of help information;

n Add a new partition note: Add a partition;

o Create a new empty DOS partition table

P Print the Partition table Note: P lists the partition table;

Q Quit without saving changes Note: Do not save the exit;

s create a new empty Sun Disklabel

t change a partition ' s system ID Note: T changes the partition type;

U Change display/entry units

V Verify the partition table

W Write table to disk and exit Note: Write the partition table to the hard disk and exit;

X Extra functionality (experts only) Note: Extended application, expert function;

In fact, we commonly use only the note has the Chinese, other functions we do not use (oh, mainly I will not be used, otherwise sooner

Show off); X expansion function, also is not commonly used, in general, as long as the understanding of D l m p Q t W on the line

The

The following example operation to detail, no examples no way, novice also can not understand;

2, list the current operation of the partition of the hard disk, with P;

Command (M for help): P

disk/dev/sda:1035 MB, 1035730944 bytes

Heads, Sectors/track, cylinders

Units = Cylinders of 16128 * 8257536 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 1 201568+ C W95 FAT32 (LBA)

/dev/sda2 806400 5 Extended

/dev/sda5 201568+ Linux

/dev/sda6 200781 Linux

3. Delete a partition by using the D command of Fdisk;

Command (M for help): P Note: Lists the partitioning situation;

disk/dev/sda:1035 MB, 1035730944 bytes

Heads, Sectors/track, cylinders

Units = Cylinders of 16128 * 8257536 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 1 201568+ C W95 FAT32 (LBA)

/dev/sda2 806400 5 Extended

/dev/sda5 201568+ Linux

/dev/sda6 200781 Linux

Command (M for help): D Note: perform delete partition designation;

Partition number (1-6): 6 Note: I want to delete Sda6, just enter 6 here;

Command (M for help): P Note: Check the hard disk partition again to see if it was deleted?

disk/dev/sda:1035 MB, 1035730944 bytes

Heads, Sectors/track, cylinders

Units = Cylinders of 16128 * 8257536 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 1 201568+ C W95 FAT32 (LBA)

/dev/sda2 806400 5 Extended

/dev/sda5 201568+ Linux

Command (M for help):

Warning: Be careful when deleting partitions, please look at the number of partitions, if you delete the extended partition, the logical

The partition will be deleted, so be careful when you operate, and if you know you are wrong, please do not panic, use Q

Remember, remember! When the partition operation is wrong, do not enter W Save exit!!!

4. Add a partition via the n command of Fdisk;

Command (M for help): P

disk/dev/sda:1035 MB, 1035730944 bytes

Heads, Sectors/track, cylinders

Units = Cylinders of 16128 * 8257536 bytes

Device Boot Start End Blocks Id System

/DEV/SDA1 1 201568+ C W95 FAT32 (LBA)

/dev/sda2 806400 5 Extended

/dev/sda5 201568+ Linux

Command (M for help): N Note: add a partition;

Linux fdisk command parameters and usage details---Linux disk partition management command fdisk

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.