一、演示挂载ISO文件。(前提:上传xp_VLK_Sp2.iso到目录/root/Desktop/)
[root@localhost /]# mkdir /root/Desktop/ISO_MOUNT
[root@localhost ~]# ls /root/Desktop/ISO_MOUNT
[root@localhost ~]# mount -o loop -t iso9660 /root/Desktop/xp_VLK_Sp2.iso /root/Desktop/ISO_MOUNT[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[root@localhost /]# ls /root/Desktop/ISO_MOUNT
AUTORUN.INF DOTNETFX SETUP.EXE SM.EXE VALUEADD WIN51IP.SP2
BOOTFONT.BIN I386 SETUPXP.HTM sn.txt WIN51 WinRAR.exe
DOCS README.HTM SMARTDRV.EXE SUPPORT WIN51IP
[root@localhost /]# head -3 /root/Desktop/ISO_MOUNT/AUTORUN.INF
[AutoRun]
open=setup.exe
icon=setup.exe,0
[root@localhost Desktop]# cd /root/Desktop/ISO_MOUNT
[root@localhost ISO_MOUNT]# umount /root/Desktop/ISO_MOUNT
umount: /root/Desktop/ISO_MOUNT: device is busy
umount: /root/Desktop/ISO_MOUNT: device is busy
[root@localhost ISO_MOUNT]# cd ..
[root@localhost Desktop]# umount /root/Desktop/ISO_MOUNT
[root@localhost Desktop]# echo $?
0
二、演示挂载CD。(前提,设置好VM的CD/DVD连接,具体见附件。然后,在光驱中放入CD)
[root@localhost ~]# mkdir /root/Desktop/CD_MOUNT
[root@localhost ~]# ls /root/Desktop/CD_MOUNT
[root@localhost ~]# mount -t iso9660 -o loop /dev/cdrom /root/Desktop/CD_MOUNT
[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
/dev/hdc 693M 693M 0 100% /root/Desktop/CD_MOUNT
[root@localhost ~]# ls /root/Desktop/CD_MOUNT
autorun.exe ghost.exe $oem$ tvas tvob win51ip.sp2 winpe??×° xpemenu.ini
autorun.inf hd-4.gho readme.txt tvbs win51 windows winpe.is_
bootfont.bin oem tools tvoa win51ip winnt.xpe wxpe
[root@localhost ~]# head -3 /root/Desktop/CD_MOUNT/autorun.inf
[AutoRun]
open=autorun.exe
icon=autorun.exe,0
[root@localhost ~]# cd /root/Desktop/CD_MOUNT
[root@localhost CD_MOUNT]# umount /root/Desktop/CD_MOUNT
umount: /root/Desktop/CD_MOUNT: device is busy
umount: /root/Desktop/CD_MOUNT: device is busy
[root@localhost CD_MOUNT]# cd ..
[root@localhost Desktop]# umount /root/Desktop/CD_MOUNT
[root@localhost Desktop]# echo $?
0
[root@localhost Desktop]# ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 Apr 3 16:08 /dev/cdrom -> hdc#注意到/dev/cdrom是一个软链接,真正的位置是/dev/hdc,所以我们在df -h的结果里看到Filesystem是/dev/hdc。
#同时,CD在挂载中的时候,是无法弹出光驱的,读者可以试一试。
三、演示挂载USB。这里有三个前提:
1. 在Windows中启动VMware USB Arbitration Service服务(控制台中输入“net start VMUSBArbService”)。
2. 绿色或精简版的VM要打上补丁VMUSB。补丁附件中可以见下载。
3. 设置VM—》Settings中的USB Controller选项,具体参见附件。
[root@localhost ~]# mkdir /root/Desktop/USB_MOUNT
[root@localhost ~]# ls /root/Desktop/USB_MOUNT
[root@localhost ~]# #显示当前系统所挂载的磁盘设备,可以看到只有/dev/sda
[root@localhost ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 2356 14787832+ 83 Linux
/dev/sda4 2357 3600 ×××430 83 Linux
[root@localhost ~]# #插入U盘
[root@localhost ~]# #然后,VM->Removable Devices->Alcor Micro Mass Storage Device->Connect。这时Windows系统会读不到该U盘。
[root@localhost ~]# #再次显示当前系统所挂载的磁盘设备,可以看到除了/dev/sda,还有/dev/sdb,这就是U盘设备所在目录
[root@localhost ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 2356 14787832+ 83 Linux
/dev/sda4 2357 3600 ×××430 83 Linux
Disk /dev/sdb: 522 MB, 522189824 bytes
17 heads, 59 sectors/track, 1016 cylinders
Units = cylinders of 1003 * 512 = 513536 bytes
This doesn't look like a partition table
Probably you selected the wrong device.
Device Boot Start End Blocks Id System
/dev/sdb1 ? 775809 1913904 570754815+ 72 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(357, 116, 40) logical=(775808, 8, 13)
Partition 1 has different physical/logical endings:
phys=(357, 32, 45) logical=(1913903, 14, 4)
Partition 1 does not end on cylinder boundary.
/dev/sdb2 ? 168185 2098423 968014120 65 Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(288, 115, 43) logical=(168184, 16, 27)
Partition 2 has different physical/logical endings:
phys=(367, 114, 50) logical=(2098422, 8, 24)
Partition 2 does not end on cylinder boundary.
/dev/sdb3 ? 1864289 3794527 968014096 79 Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(366, 32, 33) logical=(1864288, 10, 12)
Partition 3 has different physical/logical endings:
phys=(357, 32, 43) logical=(3794526, 1, 20)
Partition 3 does not end on cylinder boundary.
/dev/sdb4 ? 2877051 2877106 27749+ d Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(372, 97, 50) logical=(2877050, 0, 3)
Partition 4 has different physical/logical endings:
phys=(0, 10, 0) logical=(2877105, 5, 41)
Partition 4 does not end on cylinder boundary.
Partition table entries are not in disk order
[root@localhost ~]# mount /dev/sdb /root/Desktop/USB_MOUNT
[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
/dev/sdb 498M 294M 204M 59% /root/Desktop/USB_MOUNT
[root@localhost ~]# #可以看到U盘文件夹下面20090509下面存储了很多相片
[root@localhost ~]# ls /root/Desktop/USB_MOUNT/20090509
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
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
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
[root@localhost ~]# cd /root/Desktop/USB_MOUNT
[root@localhost USB_MOUNT]# umount /root/Desktop/USB_MOUNT
umount: /root/Desktop/USB_MOUNT: device is busy
umount: /root/Desktop/USB_MOUNT: device is busy
[root@localhost USB_MOUNT]# cd ..
[root@localhost Desktop]# umount /root/Desktop/USB_MOUNT
[root@localhost Desktop]# echo $?
0
[root@localhost Desktop]# #记得 VM->Removable Devices->Alcor Micro Mass Storage Device->Disconnect。Windows系统就能重新识别回U盘。
备注: 以上提到的“Alcor Micro Mass Storage Device”因你的U盘格式、品牌而不同。