เจอคำถามจากพี่ทีใช้งาน VMware ว่าต้องการจะ Mount USB เข้าไปที่เครื่อง VMware ESX จะทำได้ไหม .. เท่าที่เคยทำมาจะเห็นว่า VI จะไม่มี Component ไว้สำหรับเลือก USB เลยหาจากพี่ใหญ่ Google เจอบทความตามนี้ครับ
วิธีที่ 1 :
http://communities.vmware.com/message/308880
1. Logon to the Service Console as ROOT
2. [Optionally] Load up the USB Device Drivers
insmod usbcore
insmod usb-storage
insmod usb-uhci
3. Use the dmesg to print a out a list of active devices and scroll up to locate Initializing USB Mass Storage Driver
.
Note:
The system assigns a SCSI device ID to the USB device (even though its like to be IDE Laptop Disk if its a portable hard-drive). The critical bits are reference to the SDG. This tells me the USB device has been added to the end of all my other SCSI disks (sda, sdb, sdc). This will help me in the next stage which is creating a mount point and mounting the partition on the USB disk.
Adding additional hard-drives to the system can upset this allocation of sdn.
4.Create a mount point with
mkdir /mnt/usb
5. Mount the first partition on the disk with
mount /dev/sdg1 /mnt/usb
Note:
If you unsure about the partition scheme on the disk you can use
fdisk l /dev/sdg to print to the console the partition table
6. List Files and Start using the disk with ls l /mnt/usb
7. Umount the USB device when finished with
cd /
umount /mnt/usb
Note:
Even after unmounting the drive. If I should down the ESX server with the USB Storage attached I get this worrying message which could be benign
scsi: device set offline not ready or command retry failed after bus reset : host 2 channel 0 id 0 lun 0
i/o error: dev 08:62, sector 4168
i/o error: dev 08:62, sector 4168
i/o error: dev 08:62, sector 0
For a more readable version try:
Guide to ESX 2.x Administration II
วิธีที่ 2 :
http://www.vladan.fr/plug-in-the-external-usb-drive-to-esx-server-directly-to-backup-or-copy/Now how-to copy data from Service Console to a USB device:
1. Plugin the external USB drive to your ESX host.
2. Run this command to find out to which device name the kernel assigned to it:
tail /var/log/dmesg
3. Now you will have to Run the following command to create a mount point (A mount point is a directory which a device or partition is attached to):
mkdir /mnt/usb
esx-how-to-mount-usb-drive
4. Run the following command to mount the drive ( When mounting, you must tell the mount command what is the device or partition you want to mount and what is the mount point. The mount point must be a directory that already exists on your system.:
mount /dev/[device_name] /mnt/usb -t [filesystem_type]
Please Note that you must:
* Replace [device_name] with your device name found in step 2
* Replace [filesystem_type] with vfat (FAT32) or ext3
5. After your copy(backup) you can type this command to unmount the device:
umount /dev/[device_name]
You might also want to export you VMDK files. Vmkstools is VMware ESX Server file system management tool. It is a program for creating and manipulating virtual disks, file systems, logical volumes and pyhsical storage device on the VMware ESX Server. Now what you need to do to export the VMDK (virtual disk)? You will use a command ‘vmfkstools’:
vmkfstools -i /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk /mnt/usb/[vm_name].vmdk -d 2gbsparse
And how-to import the VMDK (virtual disk):
vmkfstools -i /[path_to_USB_mount]/[vm_name].vmdk /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk
You might also want to copy the configuration files for a virtual machine. Those files are files with following extentions: *.vmx *.log *.nvram *.vmxf *.vmsd (you will not only copy the configuration files, but at the same time you will make a zip file in tar.gz format:
cd /vmfs/volumes/[datastore_name]/[vm_name]
tar -czvf [vm_name].tar.gz *.vmx *.log *.nvram *.vmxf *.vmsd
cp [vm_name].tar.gz /mnt/usb
Now you will be able to extract the configuration files of a virtual machine:
tar -xzvf [vm_name].tar.gz /vmfs/volumes/[datastore_name]/[vm_name]