backup2007

          導(dǎo)航

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          統(tǒng)計

          公告

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);


          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          mount and umount [quote from ChinaUnix]

          Moduel 4   Performing Mounts and Umounts
           
              Note – While system administrators typically use the /usr/sbin/mount
          command, the system boot scripts use the /sbin/mount command.
           
               介紹/etc/vfstab文件:
           
                  /etc/vfstab列出系統(tǒng)啟動時自動mount的文件, 除/etc/mnttab和/var/run之外;
                  /etc/vfstab文件分出七個區(qū)域:
                      device to mount    被mount的設(shè)備和偽設(shè)備
                      device to fsck     The raw or character device e.g. /dev/rdsk下的
                                          對于偽設(shè)備如:/proc 或 fd 這項可寫  -  
                      mount point        mount 的路徑
                      FS type            文件系統(tǒng)類型
                      fsck pass          指示在系統(tǒng)啟動時是否fsck檢測;0不檢1表示fsck為系統(tǒng)正常啟動運行
                                          大于1時表示把此設(shè)備加入fsck運行列表,fsck可同時檢測8個設(shè)備,
                                          mountall命令忽略此項
                      mount at boot       yes 要求啟動時自動mount,no 則不
                      
              Note – For / (root), /usr, and /var (if it is a separate file system) file
          systems, the mount at boot field value is specified as no. The kernel
          mounts these file systems as part of the boot sequence before the
          mountall command is run. The mount command explicitly mounts the
          file systems / (root) and /usr as specified in the
          /etc/rcS.d/S30rootusr.sh script and the /var file system as specified
          in the /etc/rcS.d/S70buildmnttab script.
           
                      mount options        A comma-separated list of options passed to the
                                          mount command. A dash (-) indicates the use of
                                          default mount options.
           
           
              介紹/etc/mnttab文件:
                  此文件是一個只讀文件,當(dāng)mount一項時,會在此文件中入一條,umount后也會在此文件中刪除相應(yīng)項;
           
                  包括五項區(qū)域:
           
                      mount point    掛接點    
                      Device Name    設(shè)備名,塊設(shè)備是文件系統(tǒng)的物理名稱;
                      Mount Options              文件系統(tǒng)上生效的掛載選項列表  
                      dev=number                主從設(shè)備號
                      Date and time mounted     mount的日期時間
           
           
              使用mount
                  
                  mount /dev/dsk/c#d#t#s# /mountpoint 
                      不加參數(shù)時,使用以下默認(rèn)屬性:
           
                      read/write     Indicates whether reads and writes are allowed on
                                      the file system.
                      setuid         Permits the execution of setuid programs in the
                                      file system.
                      intr/nointr     Allows and forbids keyboard interrupts to kill a
                                      process that is waiting for an operation on a locked
                                      file system.
                      nologging       Indicates that logging is not enabled for the ufs file
                                      system.
                      largefiles      Allows for the creation of files larger than 2 Gbytes.
                                      A file system mounted with this option can contain
                                      files larger than 2 Gbytes.
                      xattr           Supports extended attributes not found in
                                      standard UNIX attributes.
                      onerror=action     Specifies the action that the ufs file system should
                                          take to recover from an internal inconsistency on a
                                          file system. An action can be specified as:
                                      panic—Causes a forced system shutdown. This is
                                              the default.
                                      lock — Applies a file system lock to the file
                                              system.
                                      umount — Forcibly unmounts the file system.
          ------------------------------------------------------------------------------
          Note – Due to file system overhead, the largest file size that can be created
          is approximately 866 Gbytes.
          ------------------------------------------------------------------------------
           
              使用mount命令的option
                  Some options used to mount local file systems include: ro, nosetuid,
          noatime, nolargefiles, and logging.
           
          格式:    mount -o option,option,... device_name mount_point
              
                  # mount -o ro /dev/dsk/c0t0d0s6 /usr        -------設(shè)成只讀
                  下面是使用多個參數(shù),設(shè)成只讀以及不允許執(zhí)行setuid進程,但并不限制生成setuid
                  # mount -o ro,nosuid /dev/dsk/c0t0d0s7 /export/home
                  為提高磁盤訪問性能,文件系統(tǒng)訪問頻繁,最后訪問時間并不計較的可以
                  # mount -o noatime /dev/dsk/c0t0d0s7 /export/home
                  防止成生超過2G的文件,
                  # mount -o nolargefiles /dev/dsk/c0t0d0s7 /export/home
                  如果文件系統(tǒng)已經(jīng)存在超過2G的大文件,mount會挫敗,如果想成功mount,則必須刪除相關(guān)大文件,
                  并且刪除后必須用fsck來更新超級塊的信息,如果一次運行fsck還不能成功mount則必須用fsck
                  來清除超級塊的信息;
           
                  使UFS文件系統(tǒng)寫日志;
                  # mount -o logging /dev/dsk/c0t0d0s7 /export/home
                  
                  存放日志文件的大小,大約是每1G分配1M的大小,最大不超過64M字節(jié);
                  當(dāng)UFS日志達(dá)其最大時,它就開始將事務(wù)記錄到文件系統(tǒng)中。文件系統(tǒng)被卸載時,整個UFS日志
                  都被清空,所有事務(wù)都被寫入文件系統(tǒng)。 
                  UFS日志有兩個好處。一,它文件系統(tǒng)的不一致性,也就不再需要長時間運行fsck掃描。
                  二,可以跳過fsck掃描,這就減少了系統(tǒng)在被以非正常的關(guān)閉方法關(guān)閉時,重啟的時間,
           
              使用mountall命令:
                  mountall -l 只mount本地的所有文件系統(tǒng);
                  mountall命令讀取/etc/vfstab文件內(nèi)容,當(dāng)device to fsck 項大于0時,fsck會檢測文件系統(tǒng)是否完好,以致于安全掛接.當(dāng)系統(tǒng)文件壞掉,fsck會試圖修復(fù),mountall會mount其它掛接點,和device to fsck 項等于0的掛接點.
           
              mount一個新的文件系統(tǒng):
                  八步:
                  1.把硬盤放入服務(wù)器,
                  2.重啟或devfsadm讓系統(tǒng)識別硬盤;
                  3.format把硬盤分區(qū);
                  4.newfs在磁盤slice上生成新的文件系統(tǒng);
                  5.在/目錄下用mkdir 生成一個新的掛接點;
                  6.mount文件系統(tǒng)到掛接點;
                  7.用mount命令查看是否mount成功;
                  8.修改/etc/vfstab文件,讓系統(tǒng)下次重啟時自動加載;
           
              mount不同類型的文件系統(tǒng):
                  
                  如果mount時沒有以mount -F fstype指明的話,mount會以ufs來作為默認(rèn)的類型,mount根據(jù)設(shè)備名, 塊名,或掛接點來判斷文件類型;
           
                  mount 不能從/etc/vfstab的fs entry來判斷,會以/etc/default/fs file 或
          /etc/dfs/fstypes來決定文件的掛接類型,如果是本地文件系統(tǒng)則是/etc/default/fs 文件中一行
          LOCAL=ufs  來確定掛接類型;
                  如果是遠(yuǎn)程文件系統(tǒng),則從/etc/dfs/fstypes第一行來確定
          nfs NFS Utilities
          autofs AUTOFS Utilities
          cachefs CACHEFS Utilities
                  
               Using the fstyp Command來查看文件類型:
           
                  # fstyp /dev/rdsk/c0t0d0s7
                  ufs
              指定一下hsfs文件系統(tǒng):
                  當(dāng)volume manage停止時,用hsfs來指定一個cdrom
                  # mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom
              指定一個pcfs文件系統(tǒng):
                  當(dāng)卷管理停止時,掛接一個駐留在diskette(軟盤)的文件系統(tǒng)
                  
                  # mkdir /pcfs
                  # mount -F pcfs /dev/diskette /pcfs
           
           
              執(zhí)行umount命令:
                  提示:在umount文件系統(tǒng)前,都是先從/etc/mnttab文件種刪除相應(yīng)行;
           
                  從掛接點刪除:
                  #umount /export/home
                  從邏輯硬件文件名刪除:
                  # umount /dev/dsk/c0t0d0s7
           
              執(zhí)行umountall命令:
                  /usr/sbin/umountall命令會在系統(tǒng)關(guān)閉或在命令輸入umountall時讀取/etc/mnttab文件,然后umount
              vfstab文件中除/ (root), /usr, /proc, /dev/fd, /var,/var/run, and /tmp.之外所有行;
                  
                  umount所有文件系統(tǒng):
                  #umountall 
                  umount所有本地的文件系統(tǒng):
                  #umountall -l
           
              umountall狀態(tài)為busy的系統(tǒng):
                  
                  以下四種情況,文件系統(tǒng)都會顯示:umount: file_system_name busy
           
                  1 A program is accessing a file or directory in the file system
                  2 A user is accessing a directory or file in the file system
                  3 A program has a file open in that file system
                  4 The file is being shared
           
                  有兩種方法解決:
                  (1) 使用fuser命令來確認(rèn)掛接點有那些進程在訪問,然后殺掉
                  (2) 用umount -f 強制umount;
           
                  用fuser命令的四步:
                  1.確認(rèn)掛接點有那些進程需要殺掉
                  #fuser -cu /mount_point 
                  2.向進程發(fā)出SIGKILL信號:
                  #fuser -ck /mount_point
                  3.確認(rèn)看是否還有進程在訪問掛接點
                  #fuser -c /mount_point
                  4.umount掛接點
                  #umount /mount_point
           
                  umount -f 丟失數(shù)據(jù),僵死進程,但比較適合遠(yuǎn)程共享時,遠(yuǎn)程沒有響應(yīng). 
           

          posted on 2007-09-02 13:40 backup2007 閱讀(377) 評論(0)  編輯  收藏 所屬分類: Linux

          主站蜘蛛池模板: 平塘县| 乌拉特后旗| 万荣县| 灯塔市| 长葛市| 满城县| 龙川县| 厦门市| 乌恰县| 久治县| 逊克县| 宜川县| 洛隆县| 科尔| 台东县| 津南区| 文化| 平定县| 囊谦县| 保山市| 新宁县| 安福县| 林口县| 内黄县| 农安县| 沿河| 万源市| 广德县| 岑巩县| 靖安县| 澎湖县| 友谊县| 八宿县| 丹阳市| 岚皋县| 通道| 福清市| 桓台县| 南部县| 若尔盖县| 陕西省|