Use parted to partition a disk larger than 2 TB, parted2t
1. Run the command parted/dev/sdb.
1 [root @ server ~] # Parted/dev/sdb 2 GNU Parted 2.1 3 Use/dev/sdb 4 Welcome to GNU Parted! Type 'help' to view a list of commands. 5 (parted) help 6 align-check type n check partition N for 7 TYPE (min | opt) alignment 8 check NUMBER do a simple check on the 9 file system10 cp [FROM-DEVICE] FROM-number to-NUMBER copy file system to11 another partition12 help [COMMAND] print general help, or13 help on COMMAND
2. Modify the gpt Partition Table
1 (parted) p 2 models: VMware, VMware Virtual S (scsi) 3 Disk/dev/sdb: 1074 MB 4 Sector size (logical/physical ): 512B/512B 5 Partition Table: msdos 6 7 Number Start End Size Type File system mark 8 9 (parted) mklabel gpt // use mklabel to change to gpt Partition 10 warning: the existing disk label on/dev/sdb will be destroyed and all 11 data on this disk will be lost. do you want to continue? 12 Yes/No? Yes 13 (parted) p 14 Model: VMware, VMware Virtual S (scsi) 15 Disk/dev/sdb: 1074MB16 Sector size (logical/physical): 512B/512B17 Partition Table: gpt
3. Partition creation instructions
Mkpart PART-TYPE [FS-TYPE] start end make a partition
Mkpartfs PART-TYPE FS-TYPE start end make a partition with
4. Create a m primary Partition
1 (parted) mkpart primary 0 200 // use command mkpart 2 warning: The resulting partition is not properly aligned for best 3 performance. 4 Ignore/discard/Cancel? I 5 (parted) p 6 Model: VMware, VMware Virtual S (scsi) 7 Disk/dev/sdb: 1074 MB 8 Sector size (logical/physical ): 512B/512B 9 Partition Table: gpt10 11 Number Start End Size File system Name Mark 12 1 17.4kB 200 MB 200 MB primary
5. Create a m primary partition.
1 (parted) mkpart primary 200 300 // start end 2 (parted) p 3 Model: VMware, VMware Virtual S (scsi) 4 Disk/dev/sdb: 1074 MB 5 Sector size (logical/physical): 512B/512B 6 Partition Table: gpt 7 8 Number Start End Size File system Name Mark 9 1 17.4kB 200 MB 200 MB primary10 2 200 MB 300 MB 99.6 MB primary
6. Create a logical partition and specify the file type ext4
1 (parted) mkpart logical ext4 301 400 ignore 2 align-check TYPE N check partition N for3 TYPE(min|opt) alignment4 check NUMBER do a simple check on the5 file system6 cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to7 another partition8 help [COMMAND] print general help, or
1 (parted) p 2 models: VMware, VMware Virtual S (scsi) 3 Disk/dev/sdb: 1074 MB 4 Sector size (logical/physical ): 512B/512B 5 Partition Table: gpt 6 7 Number Start End Size File system Name mark 8 1 17.4kB 200 MB 200 MB primary 9 2 200 MB 300 MB 99.6 MB primary10 3 301 MB 400 MB 98.6 MB logical
7. Partition directly under the command line
1 [root@server ~]# parted /dev/sdb mklabel gpt yes2 [root@server ~]# parted /dev/sdb mkpart primary ext4 0 10 ignore3 [root@server ~]# parted /dev/sdb mkpart primary linux-swap 11 20 ignore4 [root@server ~]# parted /dev/sdb mkpart logical ext4 21 30 ignore5 [root@server ~]# parted /dev/sdb p
8. Expansion
How to quickly partition A Newly Added Disk:
# Echo-e "n \ np \ n1 \ n + 10G \ nn \ np \ n2 \ n + 20G \ nw" | fdisk/dev/sdb
# Partprobe