硬盘在linux下分区格式化命令

2T硬盘在linux命令行分区格式化方法:

 小结如下:
1、sudo fdisk -l 2、sudo fdisk /dev/sdb p (分区) d(删除原有分区) p(分区) n(新分区) p(主分区) +800G p(分区) n p p w 3、格式化 sudo mkfs.ntfs /dev/sdb1 sudo mkfs.ntfs /dev/sdb2
原始操作记录:

emy@emy-test:~$ sudo fdisk -l Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 18386107-FBE9-405F-AB5D-8F2114A142D6 设备 Start 末尾 扇区 Size 类型 /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 960419839 959369216 457.5G Linux filesystem /dev/sda3 960419840 976771071 16351232 7.8G Linux swap Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 设备 启动 Start 末尾 扇区 Size Id 类型 /dev/sdb1 2048 3907029167 3907027120 1.8T 83 Linux emy@emy-test:~$ sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. 命令(输入 m 获取帮助): p Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 设备 启动 Start 末尾 扇区 Size Id 类型 /dev/sdb1 2048 3907029167 3907027120 1.8T 83 Linux 命令(输入 m 获取帮助): d Selected partition 1 Partition 1 has been deleted. 命令(输入 m 获取帮助): 1 1: unknown command 命令(输入 m 获取帮助): p Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 命令(输入 m 获取帮助): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p 分区号 (1-4, default 1): First sector (2048-3907029167, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167): 800G Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029167, default 3907029167): +800G Created a new partition 1 of type 'Linux' and of size 800 GiB. 命令(输入 m 获取帮助): p Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 设备 启动 Start 末尾 扇区 Size Id 类型 /dev/sdb1 2048 1677723647 1677721600 800G 83 Linux 命令(输入 m 获取帮助): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p 分区号 (2-4, default 2): First sector (1677723648-3907029167, default 1677723648): Last sector, +sectors or +size{K,M,G,T,P} (1677723648-3907029167, default 3907029167): Created a new partition 2 of type 'Linux' and of size 1 TiB. 命令(输入 m 获取帮助): p Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 设备 启动 Start 末尾 扇区 Size Id 类型 /dev/sdb1 2048 1677723647 1677721600 800G 83 Linux /dev/sdb2 1677723648 3907029167 2229305520 1T 83 Linux 命令(输入 m 获取帮助): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. emy@emy-test:~$ sudo fdisk -l Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 18386107-FBE9-405F-AB5D-8F2114A142D6 设备 Start 末尾 扇区 Size 类型 /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 960419839 959369216 457.5G Linux filesystem /dev/sda3 960419840 976771071 16351232 7.8G Linux swap Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0xb14807c7 设备 启动 Start 末尾 扇区 Size Id 类型 /dev/sdb1 2048 1677723647 1677721600 800G 83 Linux /dev/sdb2 1677723648 3907029167 2229305520 1T 83 Linux

 

posted @ 2021-03-12 13:30  Ranxf  阅读(3272)  评论(1编辑  收藏  举报