Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition
Misc m print this menu x extra functionality (experts only)
Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file
Save & Exit w write table to disk and exit q quit without saving changes
Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table # 1、输入 n 新建分区,一切默认回车即可 Command (m for help): n Partition number (6-128, default 6): First sector (41940992-104857566, default 41940992): Last sector, +sectors or +size{K,M,G,T,P} (41940992-104857566, default 104857566):
Created a new partition 6 of type 'Linux filesystem' and of size 30 GiB. # 2、输入 p 查看新建分区情况,sda6就是新分区 Command (m for help): p Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors 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: gpt Disk identifier: D7617B57-3A11-4B5B-B28D-FE5A8EEAD05D
Device Start End Sectors Size Type /dev/sda1 2048 4095 2048 1M BIOS boot /dev/sda2 4096 2101247 2097152 1G Linux filesystem /dev/sda3 2101248 8392703 6291456 3G Linux swap /dev/sda4 8392704 29364223 20971520 10G Linux filesystem /dev/sda5 29364224 41940991 12576768 6G Linux filesystem /dev/sda6 41940992 104857566 62916575 30G Linux filesystem # 3、输入 w 保存分区,此时df -lh还看不到新建的分区 # 4、格式化sda6分区,至此分区新建完成 mkfs -t /dev/sda6
# 2、将分区信息固化到系统配置信息中 vim /etc/fstab # 参照原文件格式编写 # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> /dev/disk/by-uuid/bfae9057-2637-4bdb-b355-395ab9ca30f1 none swap sw 0 0 # / was on /dev/sda4 during curtin installation /dev/disk/by-uuid/9bdde825-6d74-45e2-bbf5-0b497e0d0fcf / ext4 defaults 0 1 # /home was on /dev/sda5 during curtin installation /dev/disk/by-uuid/40ca4129-cacf-4d8b-a213-fd3c654ca1ce /home ext4 defaults 0 1 # /boot was on /dev/sda2 during curtin installation /dev/disk/by-uuid/1e0131bc-9662-41b6-81e7-9a5db92f3509 /boot ext4 defaults 0 1 # 参照/home的挂载配置,追加上相似的配置信息 /dev/disk/by-uuid/01c6810e-738f-47c2-882f-2451b93a163d /data ext4 defaults 0 1 /swap.img none swap sw 0 0