最後更新: 2019-06-19
目錄
- clone the VMDKs while preserving the thin provisioning
- 為 phyiscal harddisk 建立 vmdk 檔
- Check File Size
- vmdk disk description
- Rename vmdk file
- Check vmdk Consistent
- Troubleshoot
clone the VMDKs while preserving the thin provisioning
Example:
vmkfstools -i "source.vmdk" -d thin "destination.vmdk"
opts:
- -i --clonevirtualdisk srcDisk
- -d --diskformat [zeroedthick|thin|eagerzeroedthick]
- -x --fix [check|repair]
- -v --verbose
- -X --extendvirtualdisk #[gGmMkK]
output:
Destination disk format: VMFS thin-provisioned Cloning disk 'winsrv2k8.enterprise.201306.vmdk'... Clone: 10% done.
diskformat
--- VMDK 建立時立即佔用空間 ---
zeroedthick (default)
VM read / write HDD 時才 zeroed out block
eagerzeroedthick
VMDK 建立時立即 zeroed out allocated space
thick
doesn.t zero out any old data that might be present on this allocated space
EagerZeroedThick 及 ZeroedThick
EagerZeroedThick 及 ZeroedThick 在 SSD 上才有功能上的分別
When you delete a VM (or move one)
-> release space on filesystem, the underlying storage is not told.
(delete the vmdk so that the space is now free on the VMFS, but not on the physical device)
(底層要 UNMAP 才 free 出空間)
VM 刪除後立即建立一樣大小的 VM, 會有以下情況:
- the guest sees it as free
- VMFS sees it as reserves
- physical device sees it as fully written to
To release dead storage you either:
overwrite space with zero (VM use all space)
release the "dead" space By CLI (UNMAP, 需要在 VM 被刪除後立即執行)
Delete the physical volume (不可能這樣做, Volume 內有其他 VM)
eagerzeroedthick
When the FlashArray receives zeroes it will not store them on the SSDs.
It instead removes them inline and will return zeroes if those LBAs are read from.
writing zeroes to written space is very much like running UNMAP
------------
FlashArray 廠:
- Dell EMC
- NetApp
- Pure Storage
--- Thin-provisioned virtual disk ---
thin
Unlike with the thick format, space required for the virtual disk is not allocated during creation,
but is supplied, zeroed out, on demand at a later time.
RDM - 為 phyiscal harddisk 建立 vmdk 檔
RDM = Raw Device Mapper
Step1: 查看有什麼 Disk
ls -l /vmfs/devices/disks
lrwxrwxrwx 1 root root 36 Apr 6 11:33 vml.?2048 -> naa.?2ef1
Step2:
vmkfstools -r /vmfs/devices/disks/DEVICE ./RDM-DSK.vmdk -a lsilogic
map 的方式
-
# Creates a raw disk mapping (virtual compatibility mode)
--createrdm | -r DEVICE ?.vmdk -
# Creates a passthrough raw disk mapping (physical compatibility mode)
--createrdmpassthru | -z <device> <map_file>
other settings
- -q --queryrdm
- -a --adaptertype [ buslogic | lsilogic | ide | lsisas | pvscsi ]
virtual v.s. physical mode
Physical mode
specifies minimal SCSI virtualization of the mapped device
=> allowing the greatest flexibility for SAN management software.
The VMkernel passes all SCSI commands to the device, with one exception - "REPORT LUNs"
<= Otherwise, all physical characteristics of the underlying hardware are exposed.
Virtual compatibility mode
VMkernel sends only READ and WRITE to the mapped device.
=> The real hardware characteristics are hidden.
=> more portable across storage hardware than physical mode
* You cannot map a disk partition as RDM. RDMs require the mapped device to be a whole LUN.
performance:
-
For random reads and writes,
VMFS requires 5 percent more CPU cycles per I/O operation compared to RDM. -
For sequential reads and writes,
VMFS requires about 8 percent more CPU cycles per I/O operation compared to RDM.
=> RDM 比 vmfs 快 5~8%
Check File Size
du -h server2003sp2
4.9G server2003sp2
ls -lh server2003sp2/server03sp2-flat.vmdk
-rw------- 1 root root 80.0G Jul 9 05:05 server2003sp2/server03sp2-flat.vmdk
stat server2003sp2/server03sp2-flat.vmdk
File: "server2003sp2/server03sp2-flat.vmdk" Size: 85899345920 Blocks: 10356736 IO Block: 131072 regular file
Default block size: 512 byte
vmdk disk description
The disk description file or .vmdk, is a metadata file
It contains data that describe the geometric characteristics and size of the disk where the data will be stored.
A virtual disk is made up of two files:
* File descriptor, its extension is (.vmdk)
* Flat file, where the data is saved, its extension is (-flat.vmdk)
grep -i scsi *.vmx
scsi0.virtualDev = "lsilogic"
ls -l v3web-flat.vmdk
-rw------- 1 root root 12884901888 Jun 19 01:47 v3web-flat.vmdk
vmkfstools -c 12884901888 -a lsilogic -d thin temp.vmdk
rm -i temp-flat.vmdk
mv -i temp.vmdk v3web.vmdk
# 修改 Router.vmdk
RW 25165824 VMFS "vmdisk0-flat.vmdk" ddb.thinProvisioned = "1"
Rename vmdk file
Rename a virtual disk
1. Verify the virtual machine referring to the virtual machine disk is powered off
and does not have outstanding snapshots. (必須)
2. Remove the virtual disk from the virtual machine's configuration (必須)
3. -E, --renamevirtualdisk
vmkfstools -E OldName.vmdk NewName.vmdk
Check vmdk Consistent
-e|--chainConsistent # to check the entire snapshot chain
-v --verbose
-x --fix [check|repair] # check or repair a virtual disk if it gets corrupted
# check vmdk
vmkfstools -x check /vmfs/volumes/my_datastore/my_disk.vmdk
Troubleshoot
行以下 cmd
vmkfstools -i "/vmfs/volumes/datastore1/vm1/disk-flat.vmdk" \
-d thin "/vmfs/volumes/iscsi_bak/vm1/d.vmdk"
Error
DiskLib_Check() failed for source disk The file specified is not a virtual disk (15).
原因
Leave -flat out of the destination and source file name !!