Parted command details

Source: Internet
Author: User

Usage: parted [Option]... [device [Command [parameter]...]
Apply the command with "parameter" to "device ". If no "command" is provided, it is run in interactive mode.
Help options:

-H, -- help displays this help information
-L, -- list lists information about all the specified partitions.
-I, -- interactive prompts users when necessary
-S, -- script never prompts users
-V, -- version display version

Operation Command:

Check MINOR # perform a simple check on the file system
Cp [FROM-DEVICE] FROM-minor to-MINOR # copy the file system TO another partition
Help [COMMAND] # print common help information or COMMAND information
Mklabel label type # create a new disk label (partition table)
Mkfs MINOR file system type # create a file system of the "file system type" in MINOR
Mkpart partition type [file system type] Start Point termination point # create a partition
Mkpartfs partition type start point of the file system type # create a partition with a file system
Move MINOR start point termination point # move the shard numbered MINOR
Name MINOR name # name the partition numbered MINOR as "name"
Print [MINOR] # print the partition table or partition
Quit # exit the program
Rescue start point ending point # Save the lost partition near "Start Point" and "End Point"
Resize MINOR start point ending point # change the size of the file system in the partition numbered MINOR
Rm MINOR # delete a partition numbered MINOR.
Select device # select the device to edit
Set MINOR flag status # indicates the shard Id changed to MINOR.

Operation instance:
(Parted) indicates the command entered in parted. Other information is automatically printed.

1. First, select the hard disk to be partitioned like fdisk, where/dev/hdd:
Root@10.10.90.97 ~ # Parted/dev/hdd
GNU Parted 1.8.1
Using/dev/hdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
2. If/dev/hdd is selected as the disk for operation, create a partition table (in parted, run the help command to print the help information ):
(Parted) mklabel
Warning: The existing disk label on/dev/hdd will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? (Warn the user that the data on the disk will be destroyed and ask whether to continue. Here is the new disk. Enter yes and press Enter.) yes
New disk label type? [Msdos]? (The default format is msdos. to partition a disk larger than 2 TB correctly, use the partition table in gpt mode and press Enter.) gpt
3. After creating the partition table, you can perform the partitioning operation. Run the mkpart command and enter the partition name, file system, and start and end locations of the partition respectively.
(Parted) mkpart
Partition name? []? Dp1
File system type? [Ext2]? Ext3
Start? 0
End? 500 GB
4. Run the print command to print the partition information after partitioning. The following is an example of print.
(Parted) print
Model: vbox harddisk (ide)
Disk/dev/hdd: 2199 GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 500 GB 500 GB dp1
5. If the partition is incorrect, run the rm command to delete the partition. For example, we want to delete the partition and print the deleted result.
(Parted) rm 1 # rm is followed by the Partition Number
(Parted) print
Model: vbox harddisk (ide)
Disk/dev/hdd: 2199 GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
6. Divide the entire hard disk into good partitions according to the above method. The following is an example after dividing.
(Parted) mkpart
Partition name? []? Dp1
File system type? [Ext2]? Ext3
Start? 0
End? 500 GB
(Parted) mkpart
Partition name? []? Dp2
File system type? [Ext2]? Ext3
Start? 500 GB
End? 2199 GB
(Parted) print
Model: vbox harddisk (ide)
Disk/dev/hdd: 2199 GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 500 GB 500 GB dp1
2 500 GB 2199 GB 1699 GB dp2
7. Because the built-in mkfs of parted is not perfect, we can use the quit command to exit parted and use the mkfs command of the system to format the partition, in this case, if you use the fdisk-l command to print the partition table, a warning is displayed, which is normal.
Root@10.10.90.97 ~ # Fdisk-l
WARNING: GPT (GUID Partition Table) detected on '/dev/hdd '! The util fdisk doesn' t support GPT. Use GNU Parted.

Disk/dev/hdd: 2199.0 GB, 2199022206976 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/hdd1 1 267350 2147482623 + ee EFI GPT

Root@10.10.90.97 ~ # Mkfs. ext3/dev/hdd1
Root@10.10.90.97 ~ # Mkfs. ext3/dev/hdd2
Root@10.10.90.97 ~ # Mkdir/dp1/dp2
Root@10.10.90.97 ~ # Mount/dev/hdd1/dp1
Root@10.10.90.97 ~ # Mount/dev/hdd2/dp2

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.