又是一轮对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