You are on page 1of 12

VMware Disk Mount Users Guide

Virtual Disk Development Kit

VMware Disk Mount Users Guide

VMware Disk Mount Users Guide Item: EN-000055-01

You can find the most up-to-date technical documentation on the VMware Web site at: http://www.vmware.com/support/ The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com

2008 VMware, Inc. All rights reserved. Protected by one or more U.S. Patent Nos. 6,397,242, 6,496,847, 6,704,925, 6,711,672, 6,725,289, 6,735,601, 6,785,886, 6,789,156, 6,795,966, 6,880,022, 6,944,699, 6,961,806, 6,961,941, 7,069,413, 7,082,598, 7,089,377, 7,111,086, 7,111,145, 7,117,481, 7,149,843, 7,155,558, 7,222,221, 7,260,815, 7,260,820, 7,269,683, 7,275,136, 7,277,998, 7,277,999, 7,278,030, 7,281,102, 7,290,253, 7,356,679, 7,409,487, 7,412,492, 7,412,702, 7,424,710, and 7,428,636; patents pending. VMware, the VMware boxes logo and design, Virtual SMP, and VMotion are registered trademarks or trademarks of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.

VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 www.vmware.com

VMware, Inc.

Contents

AboutThisBook

5 7

UsingVMwareDiskMount

LimitationsonMountingVirtualDisks 7 RunningVMwareDiskMountonaWindowsHost 8 LogFiles 8 ExamplesUsingVMwareDiskMountonaWindowsHost 9 RunningVMwareDiskMountonaLinuxHost 10 LogFile 10 ExamplesUsingVMwareDiskMountonaLinuxHost 11 InstallingtheFusePackage 12

VMware, Inc.

VMware Disk Mount Users Guide

VMware, Inc.

About This Book

ThisVMwaremanual,theVMwareDiskMountUsersGuide,providesanintroductiontousingthe vmware-mountcommandlineutility.

Revision History
Thisbookisrevisedwitheachreleaseoftheproductorwhennecessary.Arevisedversioncancontainminor ormajorchanges.Table P1summarizesthesignificantchangesineachversionofthisguide. Table P-1. Revision History
Revision 20050408 20070607 20080122 20080625 20080717 20080915 Description FirstversionoftheVMwareDiskMountUsersGuide. UpdatewithsupportforLinuxhostsandremotevirtualdisks. Newoptionforinventorypathofthevirtualmachine. UpdatedsupportinformationandFusemount. Correctedinformationaboutsnapshotsand/poption. AddedinformationaboutWindowsandLinuxlogfiles.

Intended Audience
ThisbookisintendedforanyonewhousesVMwareDiskMount.Userstypicallyincludepeoplewhodo softwaredevelopmentandtestingorworkwithmultipleoperatingsystemsorcomputingenvironments: systemadministrators,applicationdevelopers,QAengineers,andanyonewhowantstocreate,manage,and modifyvirtualdiskfilesfromscriptsoratthecommandline.

Documentation Resources
ToaccessthecurrentversionsofVMwareAPIandSDKdocumentation,goto: http://www.vmware.com/support/pubs/sdk_pubs.html ToaccessthecurrentversionsofotherVMwaremanuals,goto: http://www.vmware.com/support/pubs

Documentation Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Sendyourfeedbackto: docfeedback@vmware.com

VMware, Inc.

VMware Disk Mount Users Guide

Technical Support and Education Resources


Thefollowingsectionsdescribethetechnicalsupportandeducationalresourcesavailabletoyou.

Online Support
YoucansubmitquestionsorpostcommentstotheDeveloperCommunitySDKsandAPIsforum,whichis monitoredbyVMwaretechnicalsupportandproductteams.Toaccesstheforum,goto: http://communities.vmware.com/community/developer

Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto: http://www.vmware.com/support/services

VMware Professional Services


VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides offeringstohelpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabout educationclasses,certificationprograms,andconsultingservices,goto: http://www.vmware.com/services/

VMware, Inc.

Using VMware Disk Mount

VMwareDiskMountisautilityforWindowsandLinuxhoststhatallowsyoutomountanunusedvirtualdisk asaseparatedriveorpartitionwithoutneedingtoconnecttothevirtualdiskfromwithinavirtualmachine. Youcanmountspecificvolumesofavirtualdiskifthevirtualdiskispartitioned. Afteryoumountavirtualdisk,youcanreadfromandwritetothemountedvirtualdiskasifitwereaseparate filesystemwithitsowndriveletterormountpointonyourcomputer.Forexample,youcouldscanthedisk forvirusesortransferfilesbetweenthehostsystemandapoweredoffvirtualmachine.Whenyouarefinished usingamountedvirtualdisk,youshouldunmountitsothevirtualmachinecanuseitsvirtualdiskagain. Thischaptercontainsthefollowingsections:


LimitationsonMountingVirtualDisksonpage 7. RunningVMwareDiskMountonaWindowsHostonpage 8. RunningVMwareDiskMountonaLinuxHostonpage 10.

Limitations on Mounting Virtual Disks


Considerthefollowingwhenyoumountvirtualdisks:

Youcannotmountavirtualdiskthatiscurrentlybeingusedbyarunningorsuspendedvirtualmachine. Youcanonlymountdisksthatareinapoweredoffvirtualmachine,ordisksthatarenotarenotassociated withavirtualmachine. YoucanmountandreadWindowsvirtualdisksonWindowshosts(withatleastoneNTFSvolume)or LinuxvirtualdisksonLinuxhosts.Crossmountingisrestrictedasdescribedbelow. YoucanuseDiskMountwithvirtualdiskscreatedbyVMwareESXServer3.xand2.x(preallocateddisks only),VMwareWorkstation6,5,or4,VMwarePlayer,VMwareACE,VMwareFusion,VMwareServer2 or1,andVMwareGSXServer3.xand2.5.Howeveryoucannotmountencryptedvirtualdisks. Youcannotmountavirtualdiskifanyofits.vmdkfilesarecompressedorhavereadonlypermissions. Changetheseattributesbeforemountingthevirtualdisk. OnWindowshosts,youmustmountvirtualdisksasdriveD:orgreater.Youcannotspecifyadriveletter alreadyinuseonthehost. OnWindowshosts,youcanmountvolumesformattedwithFAT(12/16/32)orNTFSonly.Ifthevirtual diskhasamixofpartitionsorvolumeswhere,forexample,apartitionisunformattedorisformattedwith aLinuxoperatingsystemandanotherpartitionisformattedwithaWindowsoperatingsystem,youcan mounttheWindowspartitionwithDiskMount. Ifyouspecifyavirtualdiskwithsnapshots,thiscommandlocatesandmountsthelastsnapshot.On Windowsyoucanmountprevioussnapshotsreadonly.OnLinuxyoucannotmountprevioussnapshots.

CAUTIONWhenyouhaveasnapshotmountedwithvmware-mount,donotreverttoaprevioussnapshot usinganyotherVMwareinterface.Doingsomakesitimpossibletounmountthepartition.

VMware, Inc.

VMware Disk Mount Users Guide

DiskMountrunsfromthecommandlineonanyversionofWindows2000,WindowsXP,WindowsServer 2003,orWindowsVista,aswellasanyversionofLinuxthatissupportedasahostforVMwareWorkstation. DiskMountonLinuxrequirestheFusepackage.SeeInstallingtheFusePackageonpage 12.

Running VMware Disk Mount on a Windows Host


TorunVMwareDiskMount,openacommandpromptonaWindowshost.TheDiskMountutilityinstallsin C:\Program Files\VMware\VMwareVirtualDiskDevelopmentKit\bin bydefault,whichtheinstaller addstoyoursearchpath,soyoucanprobablytypejustvmware-mounttoruntheutility. TheDiskMountcommandsyntaxis:
vmware-mount [driveletter:] [path-to-vmdk] [options]

Usedriveletter:tospecifythedriveletterwhereyouwanttomountorunmountavirtualdisk.Examples inthissectionusetheJ:driveandnearbyletters. Thepath-to-vmdkspecifiesthelocationofavirtualdiskthatyouwanttomountorqueryforinformation, C:\DocumentsandSettings\<user>\MyDocuments\MyVirtualMachines\<VMname>\<VMname>.vmdk forexample,where<VMname>isthenameofavirtualmachine. Withnoarguments,vmware-mountdisplaysmounteddrivemappings,ifany.Thisissimilartothe/Loption. Possibleoptionsare:


Option /v:N /d /f Definition MountsvolumeNofavirtualdisk.Ndefaultsto1. Givenadriveletter,deletesthemappingtothevirtualdiskdrivevolume. Forciblydeletesthemappingtoavirtualdiskdrivevolume.Usethisoptionwhena technicalerrororacorrectableconditionsuchasopenfilehandlespreventsDiskMount fromunmountingthedrive.Otherwisestopaccessingthevolumeanduse/d. Givenpath-to-vmdk,displaysthepartitions(volumes)onthevirtualdisk.Localonly. Displaysallvirtualdisksmountedonthehostcomputer.Usewithoutotheroptions. Mountsdiskinreadandwritemode,thedefault. Mountsdiskinnonpersistentreadonlymode.Allowsmountingofsnapshotdisk. Displaysvmware-mountusageinformation.

/p /L /m:w /m:n /?

Theoptionsforremotevirtualdisksare:
Option /i:InventoryPath /h:HostName /u:UserName /s:Password /P:Port Definition SpecifiesinventorypathontheVirtualCenterthatmanagesthisvirtualdisk. SpecifiesthenameorIPaddressoftheESXServertoaccessthemanagedvirtualdisk. SpecifiesusernamefortheESXServer. SpecifiesthepasswordfortheESXServer. SpecifiesthePortnumberusedtocommunicatewiththeserver.Thisisoptionaland defaultsto902.

Log Files
OnWindowsthediagnosticlogfilesforeach<user>whoranvmware-mountarelocatedhere:
C:\Documents and Settings\<user>\Local Settings\Temp\vmware-<user>-<nnnn>/vmount.log C:\Documents and Settings\<user>\Local Settings\Temp\vmware-<user>-<nnnn>/vmount-client.log

VMware, Inc.

Using VMware Disk Mount

Examples Using VMware Disk Mount on a Windows Host


FollowingaresomeexamplesthatillustratehowtouseDiskMountonaWindowshost. To mount a local virtual disk AssumingshortcutC:\MyVirtualMachinesandvirtualmachineWindows98,typethiscommand:
vmware-mount J: "C:\My Virtual Machines\Windows98\Windows98.vmdk"

To mount a remote virtual disk Typeacommandinthisform,where<VMname>istheguestOSname,<inv>istheinventorypath,<server> isanESXserverorVirtualCenter,<user>isaprivilegeduser,and<password>istheaccountpassword:


vmware-mount K: "[storage1] <VMname>/<VMname>.vmdk" /i:<inv> /h:<server> /u:<user> /s:<password>

Herearetwoexamples,connectingthroughESXServerandVirtualCenter:
vmware-mount K: [storage1] WinXP/WinXP.vmdk /i:ha-datacenter/vm/WinXP /h:esx3 /u:root /s:secret vmware-mount K: [storage1] WinXP/WinXP.vmdk /i:Datacenter/vm/WinXP /h:vc2 /u:admin /s:secretv

NOTEESXpathnamesarecasesensitive. To unmount the J: drive, if not in use Usethe/doption:


vmware-mount J: /d

To mount a specific volume from a virtual disk Listthevolumepartitions,thendecidewhichtomount:


vmware-mount "C:\My Virtual Machines\Windows98\Windows98.vmdk" /p vmware-mount J: "C:\My Virtual Machines\Windows98\Windows98.vmdk" /v:2

To list the currently mounted virtual disks Usethe/Loption,withsampleoutputshownbelow:


vmware-mount /L Currently mounted volumes: J:\ => C:\My Virtual Machines\Windows98\Windows98.vmdk K:\ => [storage1]WindowsXP2/WindowsXP2.vmdk

To unmount a virtual disk so virtual machines can access it again Usingdrivelettersfromtheexamplesabove,type:


vmware-mount J: /d vmware-mount K: /d

Inventory Path OnanESXserverwiththe/ioption,specifyInventoryPathas:


/i:ha-datacenter/vm/<VMpathname as read from inventory tree in VC client UI>

OnVirtualCenterwiththe/ioption,specifyInventoryPathas:
/i:<Path to your datacenter>/vm/<VMpathname as read from inventory tree in VC client UI>

ThepathtoyourdatacenterisasreadfromthetreedisplayintheVirtualCenterUI.

VMware, Inc.

VMware Disk Mount Users Guide

Running VMware Disk Mount on a Linux Host


TorunDiskMount,openacommandterminalonaLinuxhost.DiskMountinstallsin/usr/binbydefault, soyoucantypejustvmware-mounttodisplayusageinformation.Manymountoperationsrequireroot(su -) orsuperuser(sudo)permission. VMwareDiskMountforLinuxofferstwomodesformountingdisks: 1 Youcanmountaspecificpartitionofavirtualdisk,eitherlocalorremote. Thecommandsyntaxformountingaspecificpartitionisasfollows(defaultpartitionNumberis1):
vmware-mount /path/to/disk [partitionNumber] /mount/point

Youcanmountaflatfilerepresentationofanentirevirtualdisk. Thecommandsyntaxformountingaflatfilerepresentationis:
vmware-mount -f /path/to/disk /mount/point

DiskMountincludesanumberofotheroptionstousewithvirtualdisksandmountpoints.Thecommand syntaxformostoptionsiseitherofthefollowing:
vmware-mount [option] [/path/to/disk] vmware-mount [option] [/mount/point]

Inthefollowinglistofoptions,<diskID>isanidentifieroftheformusername@hostname:/path/to/disk forremotedisks,orjustthe/path/to/diskforlocaldisks.Optionsthatmountaremotediskalsorequirethe -h,-u,-F,andpossibly-voptions.The-voptionisrequiredwhenconnectingtoaVirtualCenter.


Option <diskID> <mountPoint> -p <diskID> -l <diskID> -L -d <mountPoint> -f <diskID> <mountPoint> -k <diskID> -K <diskID> -x -X Definition Mounts Displaysthepartitionsonavirtualdisk. Displaysallmountedpartitionsavirtualdisk. Displaysallvirtualdisksmountedonthehostcomputer. Cleanlyunmountsthispartition,closingdiskifitisthelastpartition. Mountsaflatfilerepresentationofanentirevirtualdiskatthespecifiedmountpoint. Unmountsallpartitionsonavirtualdiskandclosesthevirtualdisk. Forciblyunmountsallpartitionsonavirtualdiskandclosesallvirtualdisks. Unmountsallpartitionsandclosesallvirtualdisks. Forciblyunmountsallpartitionsandclosesallvirtualdisks.

Theoptionsforremotevirtualdisksare:
Option -v InventoryPath -h HostName -u UserName -F PasswordFile -P Port Definition SpecifiesinventorypathontheVirtualCenterthatmanagesthisvirtualdisk SpecifiesthenameorIPaddressoftheESXServertoaccessthemanagedvirtualdisk. SpecifiesusernamefortheESXServer. SpecifiesthepathnametoaplaintextfilecontainingthepasswordfortheESXServer. SpecifiesthePortnumberusedtocommunicatewiththeserver.Thisisoptionaland defaultsto902.

Log File
OnLinuxthediagnosticlogfilesforeach<user>whoranvmware-mountarelocatedhere:
/tmp/vmware-<user>/fuseMount.log

10

VMware, Inc.

Using VMware Disk Mount

Examples Using VMware Disk Mount on a Linux Host


FollowingaresomeexamplesthatillustratehowtouseDiskMountonaLinuxhost. To show the partitions on a local virtual disk Assumingdirectory/vmware/guestandvirtualmachineRHEL4,typethiscommand,whichproducesthe followingoutput:
vmware-mount -p /vmware/guest/RHEL4/RHEL4.vmdk Volume 1 : 102 MB, Linux Volume 2 : 19862 MB, Linux Volume 3 : 510 MB, Linux swap

To mount a partition from a local virtual disk Tomountthesecondpartitionfromabove,typethiscommand:


vmware-mount /vmware/guest/RHEL4/RHEL4.vmdk 2 /mnt/rhel4

To mount a remote virtual disk Typeacommandinthisform,where<VMname>istheguestOSname,<inv>istheinventorypath,<srv>is anESXserverorVirtualCenter,<user>isaprivilegeduser,and<pfile>isafilecontainingthepassword:


vmware-mount -v <inv> -h <srv> -u <user> -F <pfile> "[storage1] <VMname>/<VMname>.vmdk" /mount/pt

Herearetwoexamples,connectingthroughESXServerandVirtualCenter:
vmware-mount -i ha-datacenter/vm/RH5 -h esx3 -u root -F pwf "[storage1] RH5/RH5.vmdk" /mnt/rh5 vmware-mount -i Datacenter/vm/RH5 -h vc2 -u admin -F pwf "[storage1] RH5/RH5.vmdk" /mnt/rh5

NOTEESXpathnamesarecasesensitive. To mount a flat representation of a virtual disk Usethe-foption:


vmware-mount -f /vmware/guest/SUSE10/SUSE10.vmdk /mnt/suse10

To list the currently mounted virtual disks Usethe-Loption,withsampleoutputshownbelow:


vmware-mount -L Disks with mounted partitions: /vmware/guest/RHEL4/RHEL4.vmdk partition2 /mnt/rhel4 root@esx3.example.com:[storage1]RHEL5/RHEL5.vmdk /mnt/rhel5 /vmware/guest/SUSE10/SUSE10.vmdk /mnt/suse10/flat

To unmount a virtual disk so virtual machines can access it again Youcanusethe-doptionandsupplyamountpoint:


vmware-mount -d /mnt/rhel4

Youcanalsousethe-koptionandsupplyadiskID:
vmware-mount -k root@esx3.example.com:[storage1]RHEL5/RHEL5.vmdk

Youmayalsousethe-xor -Xoptiontounmount,orforceunmount,allpartitions. Inventory Path OnanESXserverwiththe/ioption,specifyInventoryPathas:


/i:ha-datacenter/vm/<VMpathname as read from inventory tree in VC client UI>

OnVirtualCenterwiththe/ioption,specifyInventoryPathas:
/i:<Path to your datacenter>/vm/<VMpathname as read from inventory tree in VC client UI>

ThepathtoyourdatacenterisasreadfromthetreedisplayintheVirtualCenterUI.
VMware, Inc. 11

VMware Disk Mount Users Guide

Installing the Fuse Package


Fuse(filesysteminuserspace)isaloadablekernelmoduleforUNIXoperatingsystems.Itallowsregular (nonroot)userstocreateandaccesstheirownfilesystems.Thefilesystemcoderunsinuserspace,whilethe Fusemoduleprovidesabridgetotheactualkernelmountinterfaces.FusewasmergedintomainstreamLinux inkernelversion2.6.14.ForearlierversionsofLinux,youmightneedtoinstallit. To check if your system has Fuse Runthemodprobe-lcommand:
modprobe -l fuse /lib/modules/2.6.22-14-generic/kernel/fs/fuse/fuse.ko

Ifthesecondlineshowingfuse.koappears,stop. Ifnooutputappears,proceedtooneofthesectionsbelow. To install Fuse with APT ObtaintheFusepackageonLinuxsystemsthatuseAPTinstallerasfollows:


sudo apt-get install fuse-utils

Nowyoucanrunthevmware-mountcommandasdescribedinthismanual. To install Fuse from the Web 1 2 DownloadFusesoftwarefromthehttp://fuse.sourceforge.netWebsite. Unpackthesoftwareandchangetotheunpackeddirectory:


tar -zxf <FusePackage>.tar.gz cd <FusePackage>

Configurethemakefileforyoursystemandrunmaketocompileit:
./configure make

Assuperuser,installthepackage(thisputsitin/usr/local/lib):
sudo make install

If/usr/local/libisnotlistedin/etc/ld.so.conforanincludedfile,insertalineforitandrunthe ldconfigcommand.Alternatively,modifyyourLD_LIBRARY_PATHenvironment.
sudo edit /etc/ld.so.conf sudo ldconfig

RunthemodprobecommandtoinsertFusemoduleintothekernel:
sudo modprobe fuse

Nowyoucanrunthevmware-mountcommandasdescribedinthismanual.

12

VMware, Inc.

You might also like