1. Using the command Parted/dev/sdb
1[[Email protected] ~]#Parted/dev/sdb2GNU Parted 2.13Using/dev/SDB4Welcome to GNU parted! Type' Help'To view a list of commands.5 (parted) help6Align-check TYPE n Check partition n for7TYPE (min|opt) Alignment8 Check number do a simple check on the9 File SystemTenCP [From-device] From-number to-Number Copy file system to One another partition AHelp [COMMAND]PrintGeneral Help,or -Help on COMMAND
2. Modifying the GPT partition table
1 (parted) p2 Model:vmware, VMware Virtual S (SCSI)3disk/dev/SDB:1074MB4Sector size (logical/physical): 512b/512B5 Partition Table:msdos6 7 Number Start End Size Type File system Flag8 9(parted) Mklabel GPT//modify to GPT partition using MklabelTenWarning: The existing disk label On/dev/sdb'll be destroyed and All OneData on this disk would be lost. Want toContinue? Ais/yes/no/No? Yes - (parted) p - Model:vmware, VMware Virtual S (SCSI) thedisk/dev/SDB:1074MB -Sector size (logical/physical): 512b/512B -Partition TABLE:GPT
3. Create a partition description
Mkpart Part-type [Fs-type] START END make a partition
Mkpartfs part-type fs-type START END make a partition with a
4. Create a partition with a primary partition of 200M
1(parted) Mkpart primary 0 200//using the command Mkpart2Warning: The resulting partition is notProperly aligned for Best3 performance.4Ignore/ignore/Discard/Cancel? I5 (parted) p6 Model:vmware, VMware Virtual S (SCSI)7disk/dev/SDB:1074MB8Sector size (logical/physical): 512b/512B9 Partition table:gptTen One Number Start End Size File system Name Flag A1 17.4kB 200MB 200MB Primary
5. Create a partition with a primary partition of 100M
1(parted) Mkpart primary 200 300//Mkpart Primary partition start end2 (parted) p3 Model:vmware, VMware Virtual S (SCSI)4disk/dev/SDB:1074MB5Sector size (logical/physical): 512b/512B6 Partition table:gpt7 8 Number Start End Size File system Name Flag91 17. 4kB 200MB 200MB PrimaryTen2 200MB 300MB 99.6MB Primary
6. Create a logical partition and specify the file type Ext4
1(parted) Mkpart logical EXT4 301 400Ignore2Align-check TYPE n Check partition n for3TYPE (min|opt) Alignment4 Check number do a simple check on the5 File System6CP [From-device] From-number to-Number Copy file system to7 another partition8Help [COMMAND]PrintGeneral Help,or
1 (parted) p2 Model:vmware, VMware Virtual S (SCSI)3disk/dev/SDB:1074MB4Sector size (logical/physical): 512b/512B5 Partition table:gpt6 7 Number Start End Size File system Name Flag81 17. 4kB 200MB 200MB Primary92 200MB 300MB 99. 6MB PrimaryTen3 301MB 400MB 98.6MB Logical
7. Partition directly under the command line
1 [[email protected] ~]# parted/dev/sdb mklabel gpt Yes2 [[email protected] ~]#< /c4> parted/dev/sdb Mkpart primary EXT4 0 Ignore3 [[email protected] ~]# parted/dev/sd b Mkpart Primary Linux-swap ignore4 [[email protected] ~]# parted/dev/sdb Mkpart logi Cal Ext4 Ignore5 [[email protected] ~]# parted/dev/sdb P
8. Expansion
Quick partitioning method for newly added disks:
#echo-E "N\NP\N1\N\N+10G\NN\NP\N2\N\N+20G\NW" |fdisk/dev/sdb
#partprobe
Use parted to partition a disk larger than 2T