在分区以前,介绍一下步骤:
Create a disklabel (partitioning) on disk.建立磁盘标签
Create a partition of the appropriate size.分配适合的大小
Create a filesystem (if needed).格式化分区,根据你需要的文件系统
Mount.挂载
#fdisk -l Disk /dev/sda: 232.4 GiB, 249510756352 bytes, 487325696 sectors Disk model: PERC H730P Mini Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xccc37b00
Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 476577806 476575759 227.3G 83 Linux /dev/sda2 476577807 487325695 10747889 5.1G f W95 Ext'd (LBA) /dev/sda5 476577809 487325695 10747887 5.1G 82 Linux swap / Solaris
Disk /dev/sdb: 20 TiB, 21998285619200 bytes, 42965401600 sectors Disk model: PERC H730P Mini Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
# parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print#==>使用print 对磁盘信息进行查看 Error: /dev/sdb: unrecognised disk label Model: DELL PERC H730P Mini (scsi) Disk /dev/sdb: 22.0TB #==>磁盘大小 Sector size (logical/physical): 512B/512B Partition Table: unknown Disk Flags: (parted)mklabel gpt #==>建立GPT的磁盘标签,换句话说就是创建磁盘分区表支持GPT (parted)mkpart primary ext4 022.0TB #==>创建一个分区,这里表示把所有空间分到一个区 Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? c #==>选择cancle (parted) mkpart primary ext4 1 -1#==>这一步就用到了对齐的概念 (parted) q#==>退出