天天看點

VM mount ISO/CD/USB

一、示範挂載ISO檔案。(前提:上傳xp_VLK_Sp2.iso到目錄/root/Desktop/)

  1. [root@localhost /]# mkdir /root/Desktop/ISO_MOUNT  
  2. [root@localhost ~]# ls /root/Desktop/ISO_MOUNT [root@localhost ~]# mount -o loop -t iso9660 /root/Desktop/xp_VLK_Sp2.iso /root/Desktop/ISO_MOUNT
  3. [root@localhost ~]# ls /root/Desktop/ISO_MOUNT AUTORUN.INF   DOCS      I386        SETUP.EXE    SMARTDRV.EXE  sn.txt   VALUEADD  WIN51IP      WinRAR.exe BOOTFONT.BIN  DOTNETFX  README.HTM  SETUPXP.HTM  SM.EXE        SUPPORT  WIN51     WIN51IP.SP2 [root@localhost ~]# df -h Filesystem            Size  Used Avail Use% Mounted on /dev/sda2             3.8G  2.6G  1.1G  71% / /dev/sda1              46M  9.2M   35M  22% /boot tmpfs                 913M     0  913M   0% /dev/shm /dev/sda3              14G  1.5G   12G  12% /home /root/Desktop/xp_VLK_Sp2.iso                       596M  596M     0 100% /root/Desktop/ISO_MOUNT
  4. [root@localhost /]# ls /root/Desktop/ISO_MOUNT  
  5. AUTORUN.INF   DOTNETFX    SETUP.EXE     SM.EXE   VALUEADD  WIN51IP.SP2  
  6. BOOTFONT.BIN  I386        SETUPXP.HTM   sn.txt   WIN51     WinRAR.exe  
  7. DOCS          README.HTM  SMARTDRV.EXE  SUPPORT  WIN51IP  
  8. [root@localhost /]# head -3 /root/Desktop/ISO_MOUNT/AUTORUN.INF  
  9. [AutoRun]  
  10. open=setup.exe  
  11. icon=setup.exe,0  
  12. [root@localhost Desktop]# cd /root/Desktop/ISO_MOUNT  
  13. [root@localhost ISO_MOUNT]# umount /root/Desktop/ISO_MOUNT  
  14. umount: /root/Desktop/ISO_MOUNT: device is busy  
  15. umount: /root/Desktop/ISO_MOUNT: device is busy  
  16. [root@localhost ISO_MOUNT]# cd ..  
  17. [root@localhost Desktop]# umount /root/Desktop/ISO_MOUNT  
  18. [root@localhost Desktop]# echo $?  

 二、示範挂載CD。(前提,設定好VM的CD/DVD連接配接,具體見附件。然後,在光驅中放入CD)

  1. [root@localhost ~]# mkdir /root/Desktop/CD_MOUNT  
  2. [root@localhost ~]# ls /root/Desktop/CD_MOUNT  
  3. [root@localhost ~]# mount -t iso9660 -o loop /dev/cdrom /root/Desktop/CD_MOUNT  
  4. [root@localhost ~]# df -h  
  5. Filesystem            Size  Used Avail Use% Mounted on 
  6. /dev/sda2             3.8G  2.6G  1.1G  71% /  
  7. /dev/sda1              46M  9.2M   35M  22% /boot  
  8. tmpfs                 913M     0  913M   0% /dev/shm  
  9. /dev/sda3              14G  1.5G   12G  12% /home  
  10. /dev/hdc              693M  693M     0 100% /root/Desktop/CD_MOUNT  
  11. [root@localhost ~]# ls /root/Desktop/CD_MOUNT  
  12. autorun.exe   ghost.exe  $oem$       tvas  tvob     win51ip.sp2  winpe??×°   xpemenu.ini  
  13. autorun.inf   hd-4.gho   readme.txt  tvbs  win51    windows      winpe.is_  
  14. bootfont.bin  oem        tools       tvoa  win51ip  winnt.xpe    wxpe  
  15. [root@localhost ~]# head -3 /root/Desktop/CD_MOUNT/autorun.inf  
  16. [AutoRun]  
  17. open=autorun.exe  
  18. icon=autorun.exe,0  
  19. [root@localhost ~]# cd /root/Desktop/CD_MOUNT  
  20. [root@localhost CD_MOUNT]# umount /root/Desktop/CD_MOUNT  
  21. umount: /root/Desktop/CD_MOUNT: device is busy  
  22. umount: /root/Desktop/CD_MOUNT: device is busy  
  23. [root@localhost CD_MOUNT]# cd ..  
  24. [root@localhost Desktop]# umount /root/Desktop/CD_MOUNT  
  25. [root@localhost Desktop]# echo $?  
  26. [root@localhost Desktop]# ls -l /dev/cdrom lrwxrwxrwx 1 root root 3 Apr  3 16:08 /dev/cdrom -> hdc
  27. #注意到/dev/cdrom是一個軟連結,真正的位置是/dev/hdc,是以我們在df -h的結果裡看到Filesystem是/dev/hdc。
  28. #同時,CD在挂載中的時候,是無法彈出光驅的,讀者可以試一試。

 三、示範挂載USB。這裡有三個前提:

         1. 在Windows中啟動VMware USB Arbitration Service服務(控制台中輸入“net start VMUSBArbService”)。

         2. 綠色或精簡版的VM要打上更新檔VMUSB。更新檔附件中可以見下載下傳。

         3. 設定VM—》Settings中的USB Controller選項,具體參見附件。 

  1. [root@localhost ~]# mkdir /root/Desktop/USB_MOUNT  
  2. [root@localhost ~]# ls /root/Desktop/USB_MOUNT  
  3. [root@localhost ~]# #顯示目前系統所挂載的磁盤裝置,可以看到隻有/dev/sda  
  4. [root@localhost ~]# fdisk -l  
  5. Disk /dev/sda: 32.2 GB, 32212254720 bytes  
  6. 255 heads, 63 sectors/track, 3916 cylinders  
  7. Units = cylinders of 16065 * 512 = 8225280 bytes  
  8.    Device Boot      Start         End      Blocks   Id  System  
  9. /dev/sda1   *           1           6       48163+  83  Linux  
  10. /dev/sda2               7         515     4088542+  83  Linux  
  11. /dev/sda3             516        2356    14787832+  83  Linux  
  12. /dev/sda4            2357        3600     ×××430   83  Linux  
  13. [root@localhost ~]# #插入U盤  
  14. [root@localhost ~]# #然後,VM->Removable Devices->Alcor Micro Mass Storage Device->Connect。這時Windows系統會讀不到該U盤。  
  15. [root@localhost ~]# #再次顯示目前系統所挂載的磁盤裝置,可以看到除了/dev/sda,還有/dev/sdb,這就是U盤裝置所在目錄  
  16. [root@localhost ~]# fdisk -l  
  17. Disk /dev/sda: 32.2 GB, 32212254720 bytes  
  18. 255 heads, 63 sectors/track, 3916 cylinders  
  19. Units = cylinders of 16065 * 512 = 8225280 bytes  
  20.    Device Boot      Start         End      Blocks   Id  System  
  21. /dev/sda1   *           1           6       48163+  83  Linux  
  22. /dev/sda2               7         515     4088542+  83  Linux  
  23. /dev/sda3             516        2356    14787832+  83  Linux  
  24. /dev/sda4            2357        3600     ×××430   83  Linux  
  25. Disk /dev/sdb: 522 MB, 522189824 bytes  
  26. 17 heads, 59 sectors/track, 1016 cylinders  
  27. Units = cylinders of 1003 * 512 = 513536 bytes  
  28. This doesn't look like a partition table 
  29. Probably you selected the wrong device.  
  30.    Device Boot      Start         End      Blocks   Id  System  
  31. /dev/sdb1   ?      775809     1913904   570754815+  72  Unknown  
  32. Partition 1 has different physical/logical beginnings (non-Linux?):  
  33.      phys=(357, 116, 40) logical=(775808, 8, 13)  
  34. Partition 1 has different physical/logical endings:  
  35.      phys=(357, 32, 45) logical=(1913903, 14, 4)  
  36. Partition 1 does not end on cylinder boundary.  
  37. /dev/sdb2   ?      168185     2098423   968014120   65  Novell Netware 386  
  38. Partition 2 has different physical/logical beginnings (non-Linux?):  
  39.      phys=(288, 115, 43) logical=(168184, 16, 27)  
  40. Partition 2 has different physical/logical endings:  
  41.      phys=(367, 114, 50) logical=(2098422, 8, 24)  
  42. Partition 2 does not end on cylinder boundary.  
  43. /dev/sdb3   ?     1864289     3794527   968014096   79  Unknown  
  44. Partition 3 has different physical/logical beginnings (non-Linux?):  
  45.      phys=(366, 32, 33) logical=(1864288, 10, 12)  
  46. Partition 3 has different physical/logical endings:  
  47.      phys=(357, 32, 43) logical=(3794526, 1, 20)  
  48. Partition 3 does not end on cylinder boundary.  
  49. /dev/sdb4   ?     2877051     2877106       27749+   d  Unknown  
  50. Partition 4 has different physical/logical beginnings (non-Linux?):  
  51.      phys=(372, 97, 50) logical=(2877050, 0, 3)  
  52. Partition 4 has different physical/logical endings:  
  53.      phys=(0, 10, 0) logical=(2877105, 5, 41)  
  54. Partition 4 does not end on cylinder boundary.  
  55. Partition table entries are not in disk order 
  56. [root@localhost ~]# mount /dev/sdb /root/Desktop/USB_MOUNT  
  57. [root@localhost ~]# df -h  
  58. Filesystem            Size  Used Avail Use% Mounted on 
  59. /dev/sda2             3.8G  2.6G  1.1G  71% /  
  60. /dev/sda1              46M  9.2M   35M  22% /boot  
  61. tmpfs                 913M     0  913M   0% /dev/shm  
  62. /dev/sda3              14G  1.5G   12G  12% /home  
  63. /dev/sdb              498M  294M  204M  59% /root/Desktop/USB_MOUNT  
  64. [root@localhost ~]# #可以看到U盤檔案夾下面20090509下面存儲了很多相片  
  65. [root@localhost ~]# ls /root/Desktop/USB_MOUNT/20090509  
  66. img_0852.jpg  img_0855.jpg  img_0858.jpg  img_0861.jpg  img_0864.jpg  img_0867.jpg  img_0870.jpg  img_0873.jpg  img_0876.jpg  p1060409.jpg  
  67. img_0853.jpg  img_0856.jpg  img_0859.jpg  img_0862.jpg  img_0865.jpg  img_0868.jpg  img_0871.jpg  img_0874.jpg  img_0877.jpg  
  68. img_0854.jpg  img_0857.jpg  img_0860.jpg  img_0863.jpg  img_0866.jpg  img_0869.jpg  img_0872.jpg  img_0875.jpg  p1060408.jpg  
  69. [root@localhost ~]# cd /root/Desktop/USB_MOUNT  
  70. [root@localhost USB_MOUNT]# umount /root/Desktop/USB_MOUNT  
  71. umount: /root/Desktop/USB_MOUNT: device is busy  
  72. umount: /root/Desktop/USB_MOUNT: device is busy  
  73. [root@localhost USB_MOUNT]# cd ..  
  74. [root@localhost Desktop]# umount /root/Desktop/USB_MOUNT  
  75. [root@localhost Desktop]# echo $?  

繼續閱讀