Ubuntu/Debian 的Linux环境,格式化超过2TB的磁盘 2022-4-24

需求描述

买了一块4TB的磁盘,需要格式化,发现fdisk不支持2TB以上的容量

执行步骤

安装parted工具

root@server:~# apt-get install parted

执行磁盘格式化

root@server:~# parted /dev/sda
(parted) mklabel gpt    # 执行修改为GPT格式
(parted) unit s                                                           
(parted) print  # 查看是否有分区,如果有,就按编号删除
(parted) rm 1                                                             
(parted) mkpart HDD4TB ext4 0% 100%   # 执行分区,名字是HDD4TB,全部磁盘
(parted) print  # 查看分区执行完的效果                                                          
Model: ADplus SuperVer (scsi)
Disk /dev/sda: 7814037168s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End          Size         File system  Name    Flags
 1      2048s  7814035455s  7814033408s  ext4         HDD4TB

(parted) quit

如果出现提示,基本上没有按照系统的块大小对齐,用上面的unit s和mkpart百分比命令就OKAY

Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel

如果出现如下报错,则可依次执行

# pvcreate /dev/vdb
  Device /dev/vdb excluded by a filter.

# wipefs -a /dev/vdb
/dev/vdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/vdb: 8 bytes were erased at offset 0x136efffffe00 (gpt): 45 46 49 20 50 41 52 54
/dev/vdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/vdb: calling ioclt to re-read partition table: Success

# pvcreate /dev/vdb
  Physical volume "/dev/vdb" successfully created.

# vgcreate vg01 /dev/vdb
  Volume group "vg01" successfully created

Ubuntu/Debian 的Linux环境,格式化超过2TB的磁盘 2022-4-24》有2个想法

  1. Pingback引用通告: Debian 11 安装配置NFS Server,为Linux/容器提供持续化的文件存储 2022-6-25 | Dasmz

  2. Pingback引用通告: 搭建 Jellyfin,影视媒体平台,DIY一条龙教程,安装部署使用 2023-01-15 | Dasmz

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注