针对nvme2n1新建分区
管理硬盘
fdisk /dev/nvme2n1
开始设置
Command (m for help): m Command (m for help): n Partition number (1-128, default 1): 1 First sector (2048-1953525134, default 2048): 2048 Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525134, default 1953523711): Created a new partition 1 of type 'Linux filesystem' and of size 931.5 GiB.
如果有原有分区,会有红色提示Partition #1 contains a vfat signature,后面[Y]es/[N]o:输入 N
针对nvme2n1删除分区
查看所有硬盘
fdisk -l
比如有多个硬盘,找到对应的盘符比如nvme2n1
管理硬盘
fdisk /dev/nvme2n1
删除分区,有3个分区和1个逻辑分区依次删除
删除分区1 Command (m for help): m Command (m for help): d Partition number (1-3, default 3): 1 Partition 1 has been deleted. 删除分区2 Command (m for help): m Command (m for help): d Partition number (2,3, default 3): 2 Partition 2 has been deleted. 删除分区3 Command (m for help): m Command (m for help): d Selected partition 3 Partition 3 has been deleted. 删除逻辑分区 Command (m for help): m Command (m for help): d Selected partition 1 Partition 1 has been deleted. 稳妥删除完按g或者不使用g命令也可以 Command (m for help): g Created a new GPT disklabel (GUID: 7C12872D-AB7F-434F-B4D1-42098D5472A9). 保存退出 Command (m for help): w The partition table has been altered. Failed to remove partition 3 from system: Device or resource busy The kernel still uses the old partitions. The new table will be used at the next reboot. Syncing disks. 最后重启 reboot
在web页面就可以看到分区的硬盘
如果要创建磁盘的LVM、LVM-Thin、目录、ZFS根据实际使用创建即可
原创文章,作者:开心电脑网,如若转载,请注明出处。