Transferred from: http://blog.csdn.net/h249059945/article/details/12668793
For Linux partitions, you can usually use the FDISK command tool and the parted tool
For partitioned tables there are usually MBR partition tables and GPT partition tables
For disks that have a disk size of less than 2T, we can use the Fdisk and parted command tools to partition
Features for MBR partitioned tables (typically partitioned using the FDISK command)
Maximum supported disk size: 2T
Supports up to 4 primary partitions or 3 primary partitions plus one extended partition
Features for GPT partitioned tables (partitioned using the parted command)
Maximum volume Supported: 18EB (1EB=1024TB)
Supports a maximum of 128 partitions
For an introduction to the parted command tool partition
Fdisk-l Viewing disk information
Parted/dev/sdb using the parted tool to operate the disk/dev/sdb
mktable GPT or Mklabel GPT to format a disk/dev/sdb as a GPT partition table
Mkpart Primary 0MB 50MB Create a 50M-sized primary partition
Mkpart Extended 50MB 100MB Create an extended partition of 50M size
RM 1 Delete partition with number 1
Print displays information about the disk/dev/sdb
Help Display assistance commands
Exit the parted command to format the partition in the Linux command line window
MKFS.EXT4/DEV/SDB2 formatted disk/DEV/SDB partition with the second partition of EXT4 format
Implement automatic disk Mount
Vi/etc/fstable
/dev/sdb2/backup EXT4 Defaults 1 2
Scenario Simulation:
The demand has a 1G disk/DEV/SDC,
Requires partition table to be GPT format,
Divided into two 400MB partitions,
A primary partition, an extended partition,
Format file system for EXT4 format
and automatically mount the boot, of which two directories are/backup/datafile
1 using FDISK-L for disk information viewing
Fdisk-l
2 using the command parted operation/DEV/SDC
Parted/dev/sdc
3 partitioned tables formatted in GPT format
Mktable GPT
4 Creating a 400M primary partition
Mkpart Primary 0MB 400MB
5 Exit
Quit
6 format file system for EXT4
Mkfs.ext4/dev/sdc1
7 Creating two Directories
Mkdir/backup
Mkdir/datafile
8 Disk expansion (hint: for direct disk expansion with formatted partition table as GPT format, refer to the following)
Parted/dev/sdc
9 Mkpart Extended 400MB 800MB
10 Viewing disk information
Print
11 exit
Quit
12 format file system for EXT4
Mkfs.ext4/dev/sdc2
13 Configuring the Boot auto mount disk
Vi/etc/fstab
/dev/sdc1/backup ext4 default 1 2
/dev/sdc2/datafile EXT4 Default 1 2
The system may need to be restarted during operation to take effect
[Turn]linux system disk partition parted