VMwareの仮想ディスクをLinuxでマウントして使う
VMwareの仮想ディスクをLinuxでマウントして使う - adsaria moodによると、vmware-mountというコマンド使えば簡単に出来るらしい。
- ダウンロード及びインストール手順
LinuxでVMwareのハードディスクイメージのマウント さとーC++ぶろぐ/ウェブリブログ
WindowsマシンでダウンロードしたものをどうやってVMの仮想マシン上にもってくるかがめんどくさかった
ただ上に載ってる
sudo vmware-mount hdd.vmdk 1 /mnt
がどうしてもイミフ。他のサイトにこんな記述は見受けられなかったので何かの間違いかも
実行コマンドvmware-install.plを実行するとモジュールが足りないというエラーが出るが、fuse-libsというライブラリをインストールすればおk
VMWareのディスクイメージ".vmdk"をLinuxからmountする - rx7の技術メモ - 技術日記
# ./vmware-install.pl Creating a new VMware VIX DiskLib API installer database using the tar4 format. Installing VMware VIX DiskLib API. You must read and accept the VMware VIX DiskLib API End User License Agreement to continue. Press enter to display it. VMware(r) Virtual Disk Developer Kit License Agreement VMware, Inc. ("VMware") provides this Virtual Disk Developer Kit (the "VDDK") to you subject to the following terms and conditions. If you disagree with any of the following terms, then do not use this VDDK. 1. This VDDK contains a variety of materials, including but not limited to, interface definitions, documentation, and sample code regarding programming interfaces to one or more VMware products as referenced in such materials ("VMware Products"). This VDDK is intended to serve as a guide for writing programs to interact with the VMware Software. 2. Use Rights: Subject to the restrictions below, you may download and make a reasonable number of copies of the VDDK contents for your personal use solely for the purpose of creating software that communicates with VMware Software ("Developer Software"). 3. Restrictions: You may not (1) use the VDDK to design or develop anything other than Developer Software; (2) make any more copies of the VDDK than are reasonably necessary for the authorized internal use and backup and archival purposes; (3) modify, create derivative works of, reverse engineer, reverse compile, or disassemble the VDDK, except that you may modify and create derivative works of the sample code in connection with Developer Software; (4) distribute, sell, lease, rent, lend, or sublicense any part of the VDDK to any third party; (5) use the VDDK to (a) design or develop software or service to circumvent, enable, modify or provide access, permissions or rights which would violate the technical restrictions of VMware Products, any additional licensing terms provided by VMware via product documentation, email notification and/or policy change on VMware website, and/or the terms of the End User License Agreements of VMware products; (b) disable, remove, over-ride or modify the display of any VMware product End User License Agreements to the end customers; and (c) to upload or otherwise transmit any material containing software viruses or other computer code, files or programs designed to interrupt, destroy, or limit the functionality of any software or hardware. The restrictions in this Section 3 shall not apply if and to the extent they contradict mandatory local law (including, but not limited to, law implementing the EC Software Directive) provided that, before you exercise any rights that you believe to be entitled to based on mandatory law, you provide VMware with 30 days prior written notice at SDK_Legal@vmware.com and provide all reasonably requested information to allow VMware to assess your claim and, at VMware's sole discretion, to provide alternatives that reduce any adverse impact on VMware's intellectual property or other rights. 4. VMware retains ownership of the VDDK, including without limitation all copyrights and other intellectual property rights therein. The VDDK is intended for your own personal non-commercial use only. If you are interested in distributing any part of the VDDK in connection with Developer Software, please submit your request to vddk-distribution-request@vmware.com. 5. You may not represent that the programs you develop using the VDDK are certified or otherwise endorsed by VMware. You may not use the VMware name or any other trademarks or service marks of VMware in connection with programs that you develop using the VDDK. 6. You will not receive any VMware support or subscription services for the VDDK or any other services from VMware in connection with the VDDK. If you have purchased support and/or subscription services for a VMware product, such support and/or subscription services shall not apply to the VDDK or your use of the VDDK. 7. Any open source software in the VDDK is provided under the terms of the open source license agreement or copyright notice accompanying such open source software in the VDDK. 8. Term, Termination and Changes: This Agreement shall continue as long as you are in compliance with the terms specified herein or until otherwise terminated. You and or VMware each may terminate this Agreement for any reason at any time. You agree, upon termination, to destroy all copies of the VDDK within your possession or control. The Limitations of Warranties, Liability section set out in this Agreement shall survive any termination or expiration of this Agreement. 9. Limitations of Warranties and Liability: THE VDDK IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, VMWARE DISCLAIMS ANY IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL VMWARE BE LIABLE FOR ANY LOST PROFITS OR BUSINESS OPPORTUNITIES, LOSS OF USE, BUSINESS INTERRUPTION, LOSS OF DATA, OR ANY OTHER INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE VDDK OR YOUR USE OF THE VDDK, UNDER ANY THEORY OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, PRODUCT LIABILITY, OR OTHERWISE. BECAUSE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE PRECEDING LIMITATION MAY NOT APPLY TO YOU. VMWARE'S LIABILITY ARISING OUT OF THE VDDK PROVIDED HEREUNDER WILL NOT, IN ANY EVENT, EXCEED US$5.00. THE FOREGOING LIMITATIONS SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, REGARDLESS OF WHETHER VMWARE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF WHETHER ANY REMEDY FAILS OF ITS ESSENTIAL PURPOSE. 10. These terms are governed by the laws of the State of California and the United States of America without regard to conflict of laws principles. You may not assign any part of this Agreement without the prior written consent of VMware. Any attempted assignment without consent shall be void. You agree to comply with all U.S. export and re-export restrictions applicable to the VDDK provided hereunder. These terms constitute the entire agreement between you and VMware with respect to the VDDK, and supersede all prior written or oral communications, understandings and agreements. Any waiver of these terms must be in writing to be effective. If any provision of these terms is found to be invalid or unenforceable, the remaining terms will continue to be valid and enforceable to the fullest extent permitted by law. Do you accept? (yes/no) yes Thank you. What prefix do you want to use to install VMware VIX DiskLib API? The prefix is the root directory where the other folders such as man, bin, doc, lib, etc. will be placed. [/usr] The following libraries could not be found on your system: libfuse.so.2 You will need to install these manually before you can run VMware VIX DiskLib API. Press enter to continue. The installation of VMware VIX DiskLib API 1.2.0 build-230216 for Linux completed successfully. You can decide to remove this software from your system at any time by invoking the following command: "/usr/bin/vmware-uninstall-vix-disklib.pl". Enjoy, --the VMware team # vmware-mount vmware-mount: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory # yum install fuse-libs -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: www.ftp.ne.jp * base: www.ftp.ne.jp * extras: www.ftp.ne.jp * updates: www.ftp.ne.jp Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package fuse-libs.i386 0:2.7.4-8.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: fuse-libs i386 2.7.4-8.el5 base 72 k Transaction Summary =================================================================================================== Install 1 Package(s) Upgrade 0 Package(s) Total download size: 72 k Downloading Packages: fuse-libs-2.7.4-8.el5.i386.rpm | 72 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : fuse-libs 1/1 Installed: fuse-libs.i386 0:2.7.4-8.el5 Complete! # vmware-mount VixDiskLib: Failed to load libvixDiskLibVim.so : Error = libvixDiskLibVim.so: cannot open shared object file: No such file or directory.VMware DiskMount Utility version 1.2.0, build-230216 Usage: vmware-mount diskPath [partition num] mountPoint vmware-mount [option] [opt args] There are two modes for mounting disks. If no option is specified, we mount individual partitions from virtual disks independently. The filesystem on the partition will be accessible at the mount point specified. The -f option mounts a flat representation of a disk on a user-specified mount point. The user must explicitly unmount the disk when finished. A disk may not be in both modes at once. diskID is an identifier of the form username@hostname:/path/to/vm for remote disks and just the path for local disks. Options that mount a remote disk also require -h -u -F and optionally -v options. The -v option is required when connecting to a Virtual Center. Options: -p <diskID> list all partitions on a disk -l <diskID> list all mounted partitions on a disk -L list all mounted disks -d <mountPoint> cleanly unmount this partition (closes disk if it is the last partition) -f <diskPath> <mountPoint> mount a flat representation of the disk at "mountPoint/flat." -k <diskID> unmount all partitions and close disk -K <diskID> force unmount all partitions and close disk -x unmount all partitions and close all disks -X force unmount all partitions and close all disks Options for remote disks: -v inventory path of the vm -h hostname of remote server -u username for remote server -F file containing password -P optional TCP port number (default: 902)
上記のエラーが何度も出て気持ち悪かったが、本来はこれで解決できるみたい
共有ライブラリをシステムに認識させるには
だがこの通りやってもどうしてもライブラリを認識しない
# ldconfig -v|grep libvixDiskLibVim.so ldconfig: Path `/usr/lib' given more than once
仕方がないのでもうかなり強引に直接ライブラリを指定してやったw↓
# cat /etc/ld.so.conf include ld.so.conf.d/*.conf /usr/lib /usr/local/lib /usr/lib/vmware-vix-disklib/lib32 /usr/lib/vmware-vix-disklib/lib64
そしたらどうにか認識できたみたい
# ldconfig -v|grep libvixDiskLibVim.so ldconfig: Path `/usr/lib' given more than once libvixDiskLibVim.so.1 -> libvixDiskLibVim.so.1.1.1 libvixDiskLibVim.so.1 -> libvixDiskLibVim.so.1.1.1
GUIで見たら仮想ディスクは /dev/sdb として認識されていた
ただ追加した仮想ディスクをどう処理していいかわからず、
VMwareの仮想ディスクをLinuxでマウントして使う - adsaria mood
に従って仮想ディスクを初期化&フォーマットした
だがext3にフォーマットするのは間違いだった
FAQ/DRBD - OSSでLinuxサーバ構築
ext3などのファイルシステムが作成されているとmetaファイルの作成に失敗する事があります。
その場合はddコマンドを利用してmeta-diskのデバイスをゼロで埋めた後でメタファイルを作成すれば問題ありません。
dd if=/dev/zero of=/dev/sdb1 bs=1M count=1
だからといってext2にフォーマットしても結果は同じだった。よーわからん
[root@z151 ~]# mkfs -t ext2 /dev/sdb1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 655360 inodes, 1309289 blocks 65464 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@z151 ~]# /etc/init.d/drbd restart Restarting all DRBD resources: 0: Failure: (119) No valid meta-data signature found. ==> Use 'drbdadm create-md res' to initialize meta-data area. <== Command '/sbin/drbdsetup 0 disk /dev/sdb1 /dev/sdb1 internal --set-defaults --create-device --on-io-error=pass_on' terminated with exit code 10 . [root@z151 ~]# drbdadm create-md r0 md_offset 5362843648 al_offset 5362810880 bm_offset 5362647040 Found ext2 filesystem 5237156 kB data area apparently used 5236960 kB left usable by current configuration Device size would be truncated, which would corrupt data and result in 'access beyond end of device' errors. You need to either * use external meta data (recommended) * shrink that filesystem first * zero out the device (destroy the filesystem) Operation refused. Command 'drbdmeta 0 v08 /dev/sdb1 internal create-md' terminated with exit code 40 drbdadm create-md r0: exited with code 40 [root@z151 ~]# dd if=/dev/zero of=/dev/sdb1 bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.00984202 seconds, 107 MB/s [root@z151 ~]# drbdadm create-md r0 Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created.