重新整理了下mount/umount,免得老是不來新機忘記了

來源:互聯網
上載者:User
掛接就是將分離的檔案系統附加到檔案系統分成結構中。檔案系統要附加到某個掛接點,也就是目錄。  
掛接和卸載檔案系統發生在系統啟動和關閉時。  
系統啟動時,將讀取/etc/vfstab檔案。這個檔案記錄系統要掛接的檔案系統。因此/etc/vfstab檔案中的檔案系統將自動掛接。也可以從命令列方式下人工掛接檔案系統。  

不加參數的mount顯示系統目前已經掛接的檔案系統。  
# mount  
/ on /dev/dsk/c0t3d0s0 read/write/setuid/largefiles/logging on Mon Nov 18  
17:58:19 1998  
/usr on /dev/dsk/c0t3d0s6 read/write/setuid/largefiles/logging on Mon Nov 18  
17:58:19 1998  
/proc on /proc read/write/setuid on Mon Nov 18 17:58:19 1998  
/dev/fd on fd read/write/setuid on Mon Nov 18 17:58:19 1998  
/var on /dev/dsk/c0t3d0s1 nolargefiles/read/write/setuid on Mon Nov 18 17:58:19  
1998  
/opt on /dev/dsk/c0t3d0s5 setuid/read/write/largefiles on Mon Nov 18 17:58:20  
1998  
/tmp on swap read/write on Mon Nov 18 17:58:20 1998  
/pns on dbserver:/export/pse soft/nosuid/remote on Mon Nov 18 19:04:36 1998  

1.mount的選項,可以用-o標定mount的選項

nolargefiles參數將使檔案系統中所有建立的檔案小於2G位元組。
remount 向mount表明它應該向一個已經載入的檔案系統重新載入的檔案系統重新載入。這通常用來改變檔案系統的載入標記,特別可用來將一個唯讀檔案系統改成可讀寫的檔案系統。
ro 將檔案系統載入為唯讀
rw 將檔案系統載入為可讀寫
intr 允許殺死檔案系統中正在等待的進程。
  
# mount -o nolargefiles /dev/dsk/c0t3d0s7 /export/home  

檔案系統中檔案的大小不能超過2G,使用這個參數可能出現錯誤,原因是由於檔案系統包含了大於2G的檔案,注意:是/dev/dsk/下的而不是/dev/rdsk下的,
因為/dev/rdsk下的裝置是物理裝置,/dev/dsk下的檔案是串連到/dev/rdsk下的

要掛接在/etc/vfstab中已有的某個檔案系統時,只需要用命令  
# mount /export/home  

/etc/vfstab檔案格式  
#device device mount FS fsck mount mount  
#to mount to fsck point type pass at boot ops  
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -  
/proc - /proc proc - no -  
fd - /dev/fd fd - no -  
swap - /tmp tmpfs - yes -  
/dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no -  
/dev/dsk/c0t3d0s6 /dev/rdsk/c0t3d0s6 /usr ufs 1 no -  
/dev/dsk/c0t3d0s3 /dev/rdsk/c0t3d0s3 /export ufs 5 yes -  
/dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /export/home ufs 5 yes -  
/dev/dsk/c0t3d0s5 /dev/rdsk/c0t3d0s5 /opt ufs 8 yes -  
/dev/dsk/c0t3d0s1 - - swap - no -  
注意:一般不用yes用no -

#mount -a 通知mount應載入的所有檔案系統,等同於/usr/sbin/mountall
通常不由管理員使用而是在系統啟動時候/etc/init.d/MOUNTFSYS自動發出。

列出載入的檔案系統
#mount

查看檔案系統

umount卸載檔案系統  
# umount /dev/dsk/c0t3d0s7  
或  
# umount /export/home  
如果檔案系統中某個檔案正在使用,則不能卸載這個檔案系統。

當一個裝置busy狀態時
可以用
#umount -f /mount_point 強制卸載一個目錄 (容易遺失資料)
或用如下:(推薦)

Using the fuser Command
To stop all processes from accessinga file system:
As root,list all the processes accessing the file system
#fuser -cu mount_point
2.Kill all processes accessing the file system.
#fuser -ck mount_point
3.Verify there are no processes accessing the file system.
#fuser -c mount_point
4.Unmount the file system.
# umount mount_point

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.