自動掛載 windows 分區[摘自www.ubuntu.org.cn]

          Posted on 2006-03-19 14:51 Hally 閱讀(592) 評論(0)  編輯  收藏 所屬分類: Ubuntu

          自動掛載 windows 分區

          自動掛載 windows 分區
          執行下列命令, 編輯掛載腳本 autowinfs.

          sudo gedit /usr/sbin/autowinfs


          復制粘貼以下引用的內容,

          保存文件, 退出。

          #!/bin/sh
          #
          #autowinfs auto mount windows disks
          #
          # Copyright (c) 2005 Jiahua Huang <jhuangjiahua@gmail.com>
          #License: GPLv2

          #
          # /usr/bin/sutowinfs
          # 用來自動掛載機器上的 Windows 分區 , 并寫入 /etc/fstab
          # 五 2月 18 14:06:12 CST 2005

          mkdir -p /windows/
          rmdir /windows/* 1> /dev/null
          grep -v '/windows/' /etc/fstab > /etc/fstab.swp


          # 本腳本用于 UTF-8 的 Locale 下
          # 單獨的 fdisk -l 不能列出分區的情況很少了 , 所以把 /dev/[hs]d[a-z] 去掉
          ## fdisk -l /dev/[hs]d[a-z] | grep -E 'FAT|NTFS' | cut -d' ' -f1 | cut -d/ -f3 | while read WDISKS
          # 查找 NTFS 分區 , 新內核的 auto 好像有點問題 , 所以現在把 NTFS 和 VFST 分開來

          fdisk -l /dev/[hs]d[a-z] | grep 'NTFS' | cut -d' ' -f1 | cut -d/ -f3 | while read WDISKS
          do echo "/dev/$WDISKS /windows/$WDISKS ntfs auto,user,nls=utf8,umask=0 0 0" >> /etc/fstab.swp
          mkdir "/windows/$WDISKS"
          done

          fdisk -l /dev/[hs]d[a-z] | grep 'FAT' | cut -d' ' -f1 | cut -d/ -f3 | while read WDISKS
          do echo "/dev/$WDISKS /windows/$WDISKS vfat auto,user,utf8,umask=0 0 0" >> /etc/fstab.swp
          mkdir "/windows/$WDISKS"
          done

          mv /etc/fstab.swp /etc/fstab
          mount -a
          exit 0

          再運行命令:
          sudo chmod +x /usr/sbin/autowinfs
          sudo /usr/sbin/autowinfs
          就可以了,Windows分區將掛載在 /windows/ 下

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          posts - 43, comments - 200, trackbacks - 0, articles - 2

          Copyright © Hally

          主站蜘蛛池模板: 远安县| 光泽县| 乌拉特后旗| 南澳县| 大田县| 东光县| 治县。| 兴海县| 沙湾县| 吐鲁番市| 孙吴县| 石林| 梁山县| 昆明市| 彭阳县| 神木县| 宁南县| 米林县| 竹山县| 林州市| 句容市| 沁水县| 德令哈市| 古浪县| 南昌县| 阿拉善右旗| 巧家县| 博白县| 华容县| 庆安县| 乡城县| 嵊州市| 道孚县| 乌拉特中旗| 梁河县| 丰宁| 高邮市| 姜堰市| 静安区| 烟台市| 兴山县|