一、演示挂载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.  

  13. [root@localhost Desktop]# cd /root/Desktop/ISO_MOUNT  

  14. [root@localhost ISO_MOUNT]# umount /root/Desktop/ISO_MOUNT  

  15. umount: /root/Desktop/ISO_MOUNT: device is busy  

  16. umount: /root/Desktop/ISO_MOUNT: device is busy  

  17. [root@localhost ISO_MOUNT]# cd ..  

  18. [root@localhost Desktop]# umount /root/Desktop/ISO_MOUNT  

  19. [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在挂载中的时候,是无法弹出光驱的,读者可以试一试。

  29.  

 三、演示挂载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.  

  6. Disk /dev/sda: 32.2 GB, 32212254720 bytes  

  7. 255 heads, 63 sectors/track, 3916 cylinders  

  8. Units = cylinders of 16065 * 512 = 8225280 bytes  

  9.  

  10.    Device Boot      Start         End      Blocks   Id  System  

  11. /dev/sda1   *           1           6       48163+  83  Linux  

  12. /dev/sda2               7         515     4088542+  83  Linux  

  13. /dev/sda3             516        2356    14787832+  83  Linux  

  14. /dev/sda4            2357        3600     ×××430   83  Linux  

  15. [root@localhost ~]# #插入U盘  

  16. [root@localhost ~]# #然后,VM->Removable Devices->Alcor Micro Mass Storage Device->Connect。这时Windows系统会读不到该U盘。  

  17. [root@localhost ~]# #再次显示当前系统所挂载的磁盘设备,可以看到除了/dev/sda,还有/dev/sdb,这就是U盘设备所在目录  

  18. [root@localhost ~]# fdisk -l  

  19.  

  20. Disk /dev/sda: 32.2 GB, 32212254720 bytes  

  21. 255 heads, 63 sectors/track, 3916 cylinders  

  22. Units = cylinders of 16065 * 512 = 8225280 bytes  

  23.  

  24.    Device Boot      Start         End      Blocks   Id  System  

  25. /dev/sda1   *           1           6       48163+  83  Linux  

  26. /dev/sda2               7         515     4088542+  83  Linux  

  27. /dev/sda3             516        2356    14787832+  83  Linux  

  28. /dev/sda4            2357        3600     ×××430   83  Linux  

  29.  

  30. Disk /dev/sdb: 522 MB, 522189824 bytes  

  31. 17 heads, 59 sectors/track, 1016 cylinders  

  32. Units = cylinders of 1003 * 512 = 513536 bytes  

  33.  

  34. This doesn't look like a partition table 

  35. Probably you selected the wrong device.  

  36.  

  37.    Device Boot      Start         End      Blocks   Id  System  

  38. /dev/sdb1   ?      775809     1913904   570754815+  72  Unknown  

  39. Partition 1 has different physical/logical beginnings (non-Linux?):  

  40.      phys=(357, 116, 40) logical=(775808, 8, 13)  

  41. Partition 1 has different physical/logical endings:  

  42.      phys=(357, 32, 45) logical=(1913903, 14, 4)  

  43. Partition 1 does not end on cylinder boundary.  

  44. /dev/sdb2   ?      168185     2098423   968014120   65  Novell Netware 386  

  45. Partition 2 has different physical/logical beginnings (non-Linux?):  

  46.      phys=(288, 115, 43) logical=(168184, 16, 27)  

  47. Partition 2 has different physical/logical endings:  

  48.      phys=(367, 114, 50) logical=(2098422, 8, 24)  

  49. Partition 2 does not end on cylinder boundary.  

  50. /dev/sdb3   ?     1864289     3794527   968014096   79  Unknown  

  51. Partition 3 has different physical/logical beginnings (non-Linux?):  

  52.      phys=(366, 32, 33) logical=(1864288, 10, 12)  

  53. Partition 3 has different physical/logical endings:  

  54.      phys=(357, 32, 43) logical=(3794526, 1, 20)  

  55. Partition 3 does not end on cylinder boundary.  

  56. /dev/sdb4   ?     2877051     2877106       27749+   d  Unknown  

  57. Partition 4 has different physical/logical beginnings (non-Linux?):  

  58.      phys=(372, 97, 50) logical=(2877050, 0, 3)  

  59. Partition 4 has different physical/logical endings:  

  60.      phys=(0, 10, 0) logical=(2877105, 5, 41)  

  61. Partition 4 does not end on cylinder boundary.  

  62.  

  63. Partition table entries are not in disk order 

  64. [root@localhost ~]# mount /dev/sdb /root/Desktop/USB_MOUNT  

  65. [root@localhost ~]# df -h  

  66. Filesystem            Size  Used Avail Use% Mounted on 

  67. /dev/sda2             3.8G  2.6G  1.1G  71% /  

  68. /dev/sda1              46M  9.2M   35M  22% /boot  

  69. tmpfs                 913M     0  913M   0% /dev/shm  

  70. /dev/sda3              14G  1.5G   12G  12% /home  

  71. /dev/sdb              498M  294M  204M  59% /root/Desktop/USB_MOUNT  

  72. [root@localhost ~]# #可以看到U盘文件夹下面20090509下面存储了很多相片  

  73. [root@localhost ~]# ls /root/Desktop/USB_MOUNT/20090509  

  74. 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  

  75. 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  

  76. 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  

  77. [root@localhost ~]# cd /root/Desktop/USB_MOUNT  

  78. [root@localhost USB_MOUNT]# umount /root/Desktop/USB_MOUNT  

  79. umount: /root/Desktop/USB_MOUNT: device is busy  

  80. umount: /root/Desktop/USB_MOUNT: device is busy  

  81. [root@localhost USB_MOUNT]# cd ..  

  82. [root@localhost Desktop]# umount /root/Desktop/USB_MOUNT  

  83. [root@localhost Desktop]# echo $?  

  84. 0  

  85. [root@localhost Desktop]# #记得 VM->Removable Devices->Alcor Micro Mass Storage Device->Disconnect。Windows系统就能重新识别回U盘。 

  86. 备注: 以上提到的“Alcor Micro Mass Storage Device”因你的U盘格式、品牌而不同。