RDM簡介
What Is Raw Device Mapping?
Introduced with ESX Server 2.5, raw device mapping allows a special file in a VMFS volume to act
as a proxy for a raw device. The mapping file contains metadata used to manage and redirect
disk accesses to the physical device. The mapping file gives you some of the advantages of a
virtual disk in the VMFS file system, while keeping some advantages of direct access to physical
device characteristics. In effect, it merges VMFS manageability with raw device access.
In prior releases, ESX Server has supported using raw disks as storage for virtual machines in
addition to virtual disk files stored in a VMFS volume. While VMFS is recommended for most
virtual disk storage, there is sometimes a need for raw disks. The most common use is as data
drives for Microsoft Cluster Services (MSCS) configurations using clusters between physical
machines, or between physical and virtual machines
With ESX Server 2.5, VMware is encouraging the use of raw device mapping in the following
situations:
· When SAN snapshot or other layered applications are run in the virtual machine. Raw
device mapping better enables scalable backup offloading systems using the features
inherent to the SAN.
· In any MSCS clustering scenario — virtual to virtual clusters as well as physical to virtual
clusters. VMware now recommends that cluster data and quorum disks be configured as
raw device mappings rather than as files on shared VMFS.
Until now, raw disks were difficult to manage for systems administrators. ESX Server 2.5 changes
this with raw device mappings. A raw device mapping is effectively a symbolic link from a VMFS
to a raw LUN. This makes LUNs appear as files in a VMFS volume. The mapping file — not the raw
LUN — is referenced in the virtual machine configuration. The mapping file contains a reference
to the raw LUN. Some important benefits of raw device mappings are:
· VMotion can now be used to migrate virtual machines using raw LUNs
· The process of adding raw LUNs to virtual machines is now simplified, both in the VMware
Management Interface and in the VMware VirtualCenter client.
· Distributed file system features such as file locking, permissions and naming become
available.
There are two compatibility modes for raw device mappings, virtual and physical. Virtual
compatibility mode allows a mapping to act exactly like a virtual disk file, including the use of
redo logs. Physical compatibility mode allows direct access to the SCSI device, for those
applications needing lower level control.
With raw device mappings, VMware now has the most flexible storage capability for virtual
machines in the industry.
工作原理
使用RDM,VMkernel不會對LUN進行格式化,而是由虛擬機客戶作業系統對LUN執行格式化。每個RDM是一塊單獨的虛擬機硬碟,而且通常只關聯到單個虛擬機。RDM存儲虛擬機的磁碟內容而非虛擬機檔案,構成虛擬機的檔案需要存放在RDM之外的數據存儲上。
部署RDM通常基於RDM能夠提供更好的性能這一理念,因為其開銷要比VMFS上的VMDK檔案低。但是在某些情況下,RDM要比VMFS的性能還要差一些。如果虛擬機需要最佳的磁碟性能,那么可以在數據存儲上存放VMDK檔案。
數據恢復
使用Vizioncore的vcbRestore檔案將鏡像手動恢復到ESX主機。由於伺服器信息塊(SMB/CIFS)不能正常工作也失敗了。我的方法是使用下面的命令恢復所有檔案:
/tmp/vcbrestore -D -I ./VM_4.tvzc -O /dev/stdout | tar -xvf -
不幸的是這也不起作用。(偶然發現這時可以將vcbRestore檔案移動到不同的邏輯單元號,並嘗試用這樣的方式執行恢復,不過我沒有足夠的LUN空間。)
接下來,我嘗試從ESX主機的服務控制台重新創建Linux logical volume manager (LVM) 2檔案系統。但那樣的努力在我重新啟動虛擬機時也失敗了:
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel.
更改只保留在記憶體里,除非你決定寫入它們。當然,先前的內容不能恢復。
The number of cylinders for this disk is set to 39162.
這樣做沒錯,但這比1024大,並且在某些設定下可能會導致兩個方面的問題:在啟動時間運行軟體(如LILO的舊版本(或者從其他作業系統(如DOS FDISK和OS/2 FDISK)啟動或劃分軟體。
局限
有兩種類型的RDM:虛擬兼容模式RDM和物理兼容模式RDM。尤其是物理兼容模式RDM有一些相當重要的局限:
•不能使用VMware快照
•不支持VCB,因為VCB需要VMware快照
•使用物理模式RDM不能克隆虛擬機
•在模板里使用物理模式RDM不能轉換虛擬機
•如果遷移包括複製磁碟,使用物理模式RDM不能遷移虛擬機
•物理模式RDM不能使用VMotion功能