parted partition

clipboard.png

[root@localhost ~]# parted
GNU Parted 3.1
use /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) hel
align-check TYPE N                        check partition N for TYPE(min|opt) alignment
help [COMMAND]                           print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END     make a partition
name NUMBER NAME                         name partition NUMBER as NAME
print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a particular partition
quit                                     exit program
rescue START END                         rescue a lost partition near START and END
rm NUMBER                                delete partition NUMBER
select DEVICE                            choose the device to edit
disk_set FLAG STATE                      change the FLAG on selected device
disk_toggle [FLAG]                       toggle the state of FLAG on selected device
set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
unit UNIT                                set the default unit to UNIT
version                                  display the version number and copyright information of GNU
(parted) select /dev/sdc
use /dev/sdc
(parted) mklabel gpt
(parted) mkpart
partition name? []?afc
filesystem type? [ext2]?
starting point? 1
end point? 2000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  标志
1      1049kB  2000MB  1999MB               afc

(parted) mkpart ars 2000 3000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  标志
1      1049kB  2000MB  1999MB               afc
2      2000MB  3000MB  1000MB               ars

(parted) mkpart jsfc 3000 4000
(parted) mkpart jiang 4000 5000
(parted) mkpart su 5000 6000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   标志
1      1049kB  2000MB  1999MB               afc
2      2000MB  3000MB  1000MB               ars
3      3000MB  4000MB  1000MB               jsfc
4 4000MB 5000MB 999MB jiang
5      5000MB  6000MB  1000MB               su

(parted) rm 1
(parted) rm 2
(parted) rm 3
(parted) rm 4
(parted) rm 5
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  标志

(parted) mklabel msdos ## mbr format
警告: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/Yes/No/No? yes
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  标志

(parted) mkpart
Partition type? primary/primary partition/extended/extended partition? p
filesystem type? [ext2]?
starting point?
starting point? 0
end point? 2000
警告: The resulting partition is not properly aligned for best performance.
Ignore/Ignore/Abort/Cancel? cancel ##The starting point cannot be 0
(parted) mkpart
Partition type? primary/primary partition/extended/extended partition? p
filesystem type? [ext2]?
starting point? 1
end point? 2000 ##Partition cannot use command line mode
Partition type? primary/primary partition/extended/extended partition? p
filesystem type? [ext2]?
starting point? 2000
end point? 3000
(parted) mkpart
Partition type? primary/primary partition/extended/extended partition?
filesystem type? [ext2]?
starting point? 3000
end point? 4000
(parted) mkpart
Partition type? primary/primary partition/extended/extended partition? e
starting point? 4000
end point? 10000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  标志
1      1049kB  2000MB  1999MB  primary
2      2000MB  3000MB  1000MB  primary
3      3000MB  4000MB  1000MB  primary
4      4000MB  10.0GB  6000MB  extended               lba

(parted) mkpart
Partition type? logical/logical partition? l
filesystem type? [ext2]?
starting point? 4000
end point? 6000
警告: The resulting partition is not properly aligned for best performance.
Ignore/Ignore/Abandon/Cancel? cancel ##The starting position cannot be 4000
(parted) mkpart
Partition type? logical/logical partition? l
filesystem type? [ext2]?
starting point? 4001
end point? 6000
(parted) mkpart
Partition type? logical/logical partition? l
filesystem type? [ext2]?
starting point? 6001
end point? 10000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  标志
1      1049kB  2000MB  1999MB  primary
2      2000MB  3000MB  1000MB  primary
3      3000MB  4000MB  1000MB  primary
4      4000MB  10.0GB  6000MB  extended               lba
5      4001MB  6000MB  1999MB  logical
6      6001MB  10.0GB  3999MB  logical

(parted) quit##parted partition does not need to save the partition, it will be automatically saved when exiting
信息: You may need to update /etc/fstab.

[root@localhost ~]# fdisk -l /dev/sdc

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (min/best): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0002d0d6

设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     3905535     1951744   83  Linux
/dev/sdc2         3905536     5859327      976896   83  Linux
/dev/sdc3         5859328     7813119      976896   83  Linux
/dev/sdc4         7813120    19531775     5859328    f  W95 Ext'd (LBA)
/dev/sdc5         7815168    11718655     1951744   83  Linux
/dev/sdc6        11720704    19531775     3905536   83  Linux


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325344432&siteId=291194637