又是一輪對ubuntu的折騰。裝了雙系統,在ubuntu下想開機自動mount windows的ntfs分區。主要兩個目標:node
開機自動mountlinux
將mount的磁盤指定給當前登陸用戶(掛在磁盤own爲當前登陸用戶和用戶組)shell
達到目標1很簡單,只須要編輯/etc/fstab文件便可,並且具體怎麼配置,fstab中已經有很詳細的說明文檔了,內容以下:ubuntu
dongchao@linux4dongchao:~$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda6 during installation UUID=431a0d34-9cc7-4a0e-ab10-a8b699d53fb4 / ext4 errors=remount-ro 0 1 # /opt was on /dev/sda7 during installation UUID=1ba482e6-f0c7-4766-a532-25b09bf2e4dc /opt ext4 defaults 0 2 # /var was on /dev/sda8 during installation UUID=0ca0e8ba-5d79-408e-8cb8-5a02924dc93d /var ext4 defaults 0 2 # swap was on /dev/sda9 during installation UUID=d1b28d9f-7704-4dd9-8f8d-b7b252da27eb none swap sw 0 0 # Data partation in windows will be mounted to /mnt/Data UUID=1222D3C822D3AF4B /media/dongchao/Data ntfs rw,dev,exec,auto,user,uid=1000,gid=1000 0 0 # Program partation in windows will be mounted to /media/dongchao/Program UUID=0E0CA2FE0CA2E047 /media/dongchao/Program ntfs rw,dev,exec,auto,user,uid=1000,gid=1000 0 0
關鍵點:使用blkid能夠獲得各個磁盤分區的UUID,剩餘的配置能夠參照已有的內容操做。windows
問題就出如今最後兩行配置。好比,在Program分區中我但願使用wine執行nyfedit.exe文件,就會出現以下報錯:less
err:virtual:map_image failed to set 60000020 protection on section .text, noexec filesystem?
一直提示是在noexec類型的文件系統上執行的,而後開始懷疑各類,好比重裝wine、配置WINPREFIX等等,實際仔細查看mount的man文檔以後就發現了問題:mount的options順序有問題。ide
user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab (or to the private libmount file in /run/mount on system without regular mtab) so that he can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
會發現user選項自己就表明了noexec,nosuid,nodev,開啓user後能夠在其後添加新的配置來覆蓋這三項,好比user,exec等。這樣的話原來的配置: rw,dev,exec,auto,user,uid=1000,gid=1000,最終exec和dev會被user所覆蓋,也就是最終仍是noexec的屬性。因此只要調整一下options順序便可rw,user,dev,exec,auto,uid=1000,gid=1000ui
因此...仔細看文檔....
this