
我正在關注這裡找到的教程:如何將多個硬碟設定為一個磁碟區?
效果很好,但是我有一個 3TB 驅動器,每次創建分區(無論是透過 fdisk 還是 gparted),在我開始在 LVM 中創建卷後,我的分區大小都會重新調整為 2TB,分區表會變成msdos不允許我創建更多分區或擴展當前分區。
有沒有辦法讓 3TB 硬碟與 LVM 一起使用?
謝謝,亞當
答案1
看起來,透過建立一個分割區用作 LVM 中的實體卷,我們的捲大小被限制為 2TB。這是由於由fdisk
和管理的遺留 MSDOS 分區表系統的限製造成的為什麼應該使用 GPT。
幸運的是,LVM 還可以理解沒有分割表的普通設備。這樣做的缺點是您必須將整個設備用作物理卷,但這正是我想要實現的目標。
若要擦除目前分區表,請執行下列命令(警告:這會有效地擦除磁碟上的所有內容!):
sudo dd if=/dev/zero of=PhysicalVolume bs=512 count=1
替換PhysicalVolume
為您的設備路徑,例如/dev/sdb
.然後運行
sudo partprobe
讓核心重新讀取現在不存在的新分區表。
現在實際將其格式化為 LVM 物理磁碟區:
sudo pvcreate PhysicalVolume
(再次替換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
答案2
FWIW,GPT fdisk(gdisk
、、sgdisk
和cgdisk
)可以從 MBR 轉換為 GPT,但需要注意分區放置位置。學習GPT遲早是有必要的,所以不妨現在就做。使用整個磁碟作為 PV 也可以,但它有其自身的缺點。最重要的是,不熟悉 LVM 的磁碟實用程式在看到「原始」PV 而不是分割表時可能會出現錯誤行為。這可能會在未來產生未知的後果。
答案3
您可以用於gdisk
大於 2TB 的分割區。
例子:
# gdisk /dev/xvdk
GPT fdisk (gdisk) version 0.8.6
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-12582911966, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-12582911966, default = 12582911966) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8e00
Changed type of partition to 'Linux LVM'
這將建立 LVM 分區,該分區將佔據給定實體磁碟區上的所有空間。
信用歸於nixCraft
:
Linux 建立大於 2TB 的分割區
答案4
使用 gparted 這非常容易。您可以將分區表設定為幾種不同的類型。 GPT 將允許您建立大於 2TB 的分割區