Detailed usage of the parted command: parted [option]... [device [command [parameter]...] applies a command with parameters to a device. If no command is provided, it is run in interactive mode. help options:-h, -- help display this help information-l, -- li... usage of the parted command: 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 display this help information-l, -- list lists all the partition information-I, -- interactive when necessary, prompt the user-s, -- script never prompts the user-v, -- version: www.2cto.com 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 the mklabel label type of COMMAND information # Create a new disk label (partition table) mkfs MINOR file system type # mkpart partition type in the file system where MINOR is created with the file system type "file system type" [file system type] start point termination point # Create a partition mkpartfs partition type file system type start point termination point # Create a partition with a file system move MINOR start point termination point # move the partition name MINOR name numbered MINOR # name the partition numbered MINOR as "name" print [MINOR] # print the partition table, or partition quit # exit program rescue start point ending point # save the lost partition resize MINOR start point ending point near "start point" and "end point" # Change to the file in the partition numbered MINOR system size rm MINOR # Delete the partition select device numbered MINOR # select the device set MINOR flag status to edit # Change the partition ID to MINOR
Operation instance: (parted) indicates the command entered in parted. Other information is automatically printed. 1. select the hard disk to be partitioned like fdisk./dev/hdd: root@10.10.90.97 ~ # Parted/dev/hddGNU Parted 1.8.1Using/dev/hddWelcome 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 (you can use the help command to print the help information in parted): (parted) mklabel www.2cto.com 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 if you want to continue. here we are new disks. enter yes and press Enter.) yesNew 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 a partition table, you can perform Partitioning. run the mkpart command and enter the partition name, file system, and partition start and end locations (parted) mkpartPartition name? []? Dp1File system type? [Ext2]? Ext3Start? 0End? 500 GB
4. run the print command to print the partition information after partitioning. The following is a print sample (parted) printModel: vbox harddisk (ide) Disk/dev/hdd: 2199 GBSector size (logical/physical): 512B/512 BPartition Table: gptNumber Start End Size File system Name Flags1 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 above and print the deleted result (parted) rm 1 # Use the partition number (parted) printModel: vbox harddisk (ide) Disk/dev/hdd: 2199 GBSector size (logical/physical): 512B/512 BPartition Table: gpt www.2cto.com 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 (parted) mkpartPartition name? []? Dp1File system type? [Ext2]? Ext3Start? 0End? 500 GB (parted) mkpartPartition name? []? Dp2File system type? [Ext2]? Ext3Start? 500 GBEnd? 2199 GB (parted) printModel: vbox harddisk (ide) Disk/dev/hdd: 2199 GBSector size (logical/physical): 512B/512 BPartition Table: gptNumber Start End Size File system Name Flags1 17.4kB 500 GB 500 GB dp12 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, at this point if you use the fdisk-l command to print the partition table will have a warning, this is normal www.2cto.com [root@10.10.90.97 ~] # Fdisk-lWARNING: 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 bytes255 heads, 63 sectors/track, 267349 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDevice 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 ~] # Ke Feng, author of mount/dev/hdd2/dp2
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