# vmkfstools ## 1 使用 `vmkfstools` - - `vmkfstools --activehosts /vmfs/volumes/<datastore>` - - `vmkfstools -X 1500G <path-to-vmdk>` - `mv <old-name>.vmdk <new-name>.vmdk` - `rm <name>.vmdk` - `vmkfstools -i <name>.vmdk -d zeroedthick <cloned-name>.vmdk` ## 2 快速参考 ### 2.1 `vmkfstools --help` 命令参考 ``` usage: vm-support [-h] [-g GROUPS] [-a MANIFESTS] [-e EXCLUDEMANIFESTS] [--manifestdir MANIFESTDIR] [-w WORKINGDIR] [-s] [-E ERRORFILE] [-l] [-z] [-o] [--listmanifests] [-G] [-t] [-p] [-d DURATION] [-i INTERVAL]                   [-v VM] [-V] [--action-threads ACTIONTHREADS] [-L] [-D] [-q] [--loglevel LOGLEVEL] [--version] [--allow-infinite-actions] [--default-timeout DEFAULTTIMEOUT] [--ignore-timeouts] [-r DIRECTORY]                   [-x BUNDLE [DIRECTORY ...]] optional arguments:   -h, --help            show this help message and exit Input:   -g GROUPS, --groups GROUPS                         Specify manifest groups. See --listgroups.   -a MANIFESTS, --manifests MANIFESTS                         Specify manifest files. See --listmanifests.   -e EXCLUDEMANIFESTS, --excludemanifests EXCLUDEMANIFESTS                         Exclude the listed manifests. See --listmanifests.   --manifestdir MANIFESTDIR                         Location to search for manifest files. Output:   -w WORKINGDIR, --workingdir WORKINGDIR                         Archive destination.   -s, --stream          Stream data to stdout.   -E ERRORFILE, --errorfile ERRORFILE                         Prints (non-fatal) errors to specified file (overrides --quiet and --stream).   -l, --listfiles       At the end print all gathered files.   -z, --zip             Archive bundle in zip format. Default is a gzipped tar archive.   -o, --obfuscate       Obfucate hostname in archive path. List:   --listmanifests       List available manifests.   -G, --listgroups      List available manifest groups.   -t, --listtags        List available manifest tags. Perfomance measurement:   -p, --performance     Gather performance data.   -d DURATION, --duration DURATION                         Duration of performance monitoring (in seconds).   -i INTERVAL, --interval INTERVAL                         Interval between performance snapshots (in seconds). VM options:   -v VM, --vm VM        Gather detailed information about this specific VM (ie --vm <path to .vmx file>)   -V, --listvms         List registered VMs. Parallel execution:   --action-threads ACTIONTHREADS                         Specify the number of actions that will run in parallel.   -L, --legacy          Run in legacy mode (no parallel execution). Misc:   -D, --dryrun          Prints out the data that would have been gathered.   -q, --quiet           Output only the location of the bundle.   --loglevel LOGLEVEL   Set logging to specified level: 0-50 (0=most verbose).   --version             Display the version.   --allow-infinite-actions                         Wait indefinitely for actions to finish. Use with caution.   --default-timeout DEFAULTTIMEOUT                         Set default timeout (300s) for actions without a specified TIMEOUT option. It is ignored when --allow-infinite-actions is used.   --ignore-timeouts     Ignore TIMEOUTs as specified in manifest files and use the default timeout. Reconstruct vm-support bundle:   -r DIRECTORY, --reconstruct DIRECTORY                         Unfragment a support bundle directory.   -x BUNDLE [DIRECTORY ...], --extract BUNDLE [DIRECTORY ...]                         Extract and reconstruct support bundle. [root@localhost:~] vmkfstools -h No valid command specified OPTIONS FOR FILE SYSTEMS: vmkfstools -C --createfs [vmfs5|vmfs6|vfat]                -S --setfsname fsName                -Y --unmapGranularity #[bBsSkKmMgGtT]                -O --unmapPriority <none|low|medium|high>            -Z --spanfs span-partition            -G --growfs grown-partition    deviceName            -P --queryfs -h --humanreadable            -T --upgradevmfs    vmfsPath            -y --reclaimBlocks vmfsPath [--reclaimBlocksUnit #blocks] OPTIONS FOR VIRTUAL DISKS: vmkfstools -c --createvirtualdisk #[bBsSkKmMgGtT]                -d --diskformat [zeroedthick                                |thin                                |eagerzeroedthick                                ]                -a --adaptertype [deprecated]                -W --objecttype [file|vsan|vvol|pmem|upit]                --policyFile <fileName>            -w --writezeros            -j --inflatedisk            -k --eagerzero            -K --punchzero            -U --deletevirtualdisk            -E --renamevirtualdisk srcDisk            -i --clonevirtualdisk srcDisk                -d --diskformat [zeroedthick                                |thin                                |eagerzeroedthick                                |rdm:<device>|rdmp:<device>                                |2gbsparse]                -W --object [file|vsan|vvol]                --policyFile <fileName>                -N --avoidnativeclone            -X --extendvirtualdisk #[bBsSkKmMgGtT]                [-d --diskformat eagerzeroedthick]            -M --migratevirtualdisk            -r --createrdm /vmfs/devices/disks/...            --sectorSize [512n|4kn]            -q --queryrdm            -z --createrdmpassthru /vmfs/devices/disks/...            -v --verbose #            -g --geometry            -x --fix [check|repair]            -e --chainConsistent            -Q --objecttype name/value pair            --uniqueblocks childDisk            --dry-run [-K]    vmfsPath OPTIONS FOR DEVICES:             -L --lock [reserve|release|lunreset|targetreset|busreset|readkeys|readresv|                      |registerkey|clearallkeys                      ] /vmfs/devices/disks/...            -B --breaklock /vmfs/devices/disks/... OPTIONS FOR VMFS MODULE:             --traceConfig [0|1]            --dataTracing [0|1]            --traceSize <x> (MB) vmkfstools -H --help ``` ## 3 参考资源 - VMware 文档 [[vsv-docs-contents|>>]] - [在 vSphere 中使用 vmkfstools](https://docs.vmware.com/cn/VMware-vSphere/8.0/vsphere-storage/GUID-A5D85C33-A510-4A3E-8FC7-93E6BA0A048F.html)