安裝了vmware tools但是虛擬機在開機狀態下無法共享文件夾

http://www.chinacloudly.com/%e5%ae%89%e8%a3%85%e4%ba%86vmware-tools%e4%bd%86%e6%98%af%e8%99%9a%e6%8b%9f%e6%9c%ba%e5%9c%a8%e5%bc%80%e6%9c%ba%e7%8a%b6%e6%80%81%e4%b8%8b%e6%97%a0%e6%b3%95%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6/

產生根源是因爲Linux kernel升級之後,vmware-tools沒有及時更新。

網上有個第三方的解決方案。測試centos6.4和Ubuntu 14.04 desktop可用

1、將vmware-tools複製出來

2、下載patch文件,鏈接見底部

3、

# cd ~/vmware-tools-distrib/lib/modules/source
# sudo tar xf vmhgfs.tar
# sudo wget https://raw.github.com/rasa/vmware-tools-patches/master/patches/vmhgfs/vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch
# sudo patch -p0 <vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch
# sudo mv vmhgfs.tar vmhgfs.orig.tar
# sudo tar cf vmhgfs.tar vmhgfs-only
#cd ~/vmware-tools-distrib

4、./vmware-install.pl 重新編譯安裝

如果patch失敗,可以嘗試手動將patch中的內容替換到相應文件中,patch內容見鏈接下

點擊下載

--- vmhgfs-only/inode.c	2013-08-15 22:32:22.000000000 -0700
+++ vmhgfs-only.patched/inode.c	2013-09-16 21:31:12.323041668 -0700
@@ -31,6 +31,9 @@
 #include <linux/namei.h>
 #endif
 #include <linux/highmem.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+#include <linux/dcache.h>
+#endif

 #include "compat_cred.h"
 #include "compat_fs.h"
@@ -1890,7 +1893,11 @@
 #endif
                            &inode->i_dentry,
                            d_alias) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+         int dcount = d_count(dentry);
+#else
          int dcount = dentry->d_count;
+#endif
          if (dcount) {
             LOG(4, ("Found %s %d \n", dentry->d_name.name, dcount));
             return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
@@ -1943,10 +1950,12 @@
       list_for_each(pos, &inode->i_dentry) {
          int dcount;
          struct dentry *dentry = list_entry(pos, struct dentry, d_alias);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
-         dcount = atomic_read(&dentry->d_count);
-#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+         dcount = d_count(dentry);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
          dcount = dentry->d_count;
+#else
+         dcount = atomic_read(&dentry->d_count);
 #endif
          if (dcount) {
             LOG(4, ("Found %s %d \n", (dentry)->d_name.name, dcount));


發佈了37 篇原創文章 · 獲贊 2 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章