Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
The old LVM2_member signature will be removed by a write command.
Device does not contain a recognized partition table. The size of this disk is 3.7 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Created a new DOS disklabel with disk identifier 0xe461c452.
DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag
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 u change display/entry units 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
知道上面两点就够了,这里我使用在 Linux 服务器上,不需要考虑 windows 兼容性,此外是一块 4T 盘,因此采用 GPT 进行分区,下面两种方式请根据自己的需要选择。
采用GUID(GPT)分区结构
如果使用 GPT 则输入 g 创建一张新的空 GPT 格式分区表。
1 2 3
ommand (m forhelp): g Created a new GPT disklabel (GUID: D53735F6-8E14-504D-BDA5-89DB97A770DF). The old LVM2_member signature will be removed by a write command.
之后输入 n 进行分区,
1
Command (m forhelp): n
选择分区表编号,根据提示目前最多可以创建128个分区,保持默认即可:
1
Partition number (1-128, default 1):
之后选择该分区的起始磁盘数,这里可自定义也可不做选择,如无特殊需求强烈建议选择默认:
1
First sector (2048-7814037134, default 2048):
接下来是定义该分区的大小,默认使用整个,直接回车:
1
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7814037134, default 7814037134):
创建成功:
1
Created a new partition 1 of type'Linux filesystem' and of size 3.7 TiB.
最后记得 w 将分区表写入硬盘。
采用DOS(MBR)分区结构
如果使用 MBR 则输入 o 创建一张新的空 MBR 格式分区表:
1 2 3 4 5
Command (m forhelp): o The size of this disk is 3.7 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Created a new DOS disklabel with disk identifier 0xe3e2291c. The old LVM2_member signature will be removed by a write command.
输入 n 进行分区:
1 2 3 4
Command (m forhelp): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions)
一块物理硬盘只能有: 一到四个主分区(但其中只能有一个是活动的主分区),或一到三个主分区,和一个扩展分区。分别对应hda1,hda2,hda3,hda4. Linux 中规定,每一个硬盘设备最多能有 4 个主分区(其中包含扩展分区)构成,任何一个扩展分区都要占用一个主分区号码,也就是在一个硬盘中,主分区和扩展分区一共最多是 4 个。 —— 《**Linux主分区,扩展分区,逻辑分区的联系和区别**》
$ cat /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> # / was on /dev/sda7 during installation UUID=4ae9f128-7cee-48fd-998c-4257e394fa4a / ext4 errors=remount-ro 0 1 # /boot/efi was on /dev/sda1 during installation UUID=A5EB-573A /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0