如何创建 LVM 分区/物理卷 > 2TB

Ada*_*ate 4 partitioning lvm hard-drive

我正在关注此处找到的本教程:如何将多个硬盘驱动器设置为一个卷?

效果很好,但是我有一个 3TB 驱动器,每次我创建分区时(无论是通过 fdisk 还是 gparted),在我开始在 LVM 中创建卷后,我的分区大小都会重新调整为 2TB,分区表变为msdos 不允许我创建更多分区或扩展当前分区。

有没有办法让 3TB 驱动器与 LVM 一起使用?

谢谢,亚当

Ada*_*ate 8

似乎通过创建一个分区用作 LVM 中的物理卷,我们被限制为 2TB 的卷大小。这是由于由管理的传统 MSDOS 分区表系统的限制fdisk以及为什么应该使用 GPT

幸运的是,LVM 也能理解没有分区表的普通设备。这有一个缺点,即您必须将整个设备用作物理卷,但这正是我想要实现的。

要擦除当前分区表,请执行以下命令(警告:这会有效地擦除磁盘上的所有内容!):

sudo dd if=/dev/zero of=PhysicalVolume bs=512 count=1
Run Code Online (Sandbox Code Playgroud)

替换PhysicalVolume为您的设备路径,例如/dev/sdb. 然后运行

sudo partprobe
Run Code Online (Sandbox Code Playgroud)

让内核重新读取现在不存在的新分区表。

现在实际将其格式化为 LVM 物理卷:

sudo pvcreate PhysicalVolume
Run Code Online (Sandbox Code Playgroud)

(再次,替换PhysicalVolume为您的设备路径)

这是基于联机帮助页中pvcreate提到的信息:

DESCRIPTION
       pvcreate initializes PhysicalVolume for later use by the Logical Volume
       Manager  (LVM).   Each  PhysicalVolume  can  be a disk partition, whole
       disk, meta device, or loopback file.   For  DOS  disk  partitions,  the
       partition  id  should  be  set  to 0x8e using fdisk(8), cfdisk(8), or a
       equivalent.  For whole disk devices only the partition  table  must  be
       erased, which will effectively destroy all data on that disk.  This can
       be done by zeroing the first sector with:

       dd if=/dev/zero of=PhysicalVolume bs=512 count=1
Run Code Online (Sandbox Code Playgroud)