mount 命令簡介: 掛載時使用mount命令: 格式:mount [-參數] [設備名稱] [掛載點] 其中常用的參數有 -t文件系統類型 指定設備的文件系統類型,常見的有: minix linux最早使用的文件系統 ext2 linux目前常用的文件系統 msdos MS-DOS的fat,就是fat16 vfat w
-o 參數里的codepage iocharset選項。codepage指定文件系統的代碼頁,簡體中文中文代碼是936;iocharset指定字符集,簡體中文一般用cp936或 gb2312。
mount 命令簡介:
掛載時使用mount命令:
格式:mount [-參數] [設備名稱] [掛載點]
其中常用的參數有
-t<文件系統類型> 指定設備的文件系統類型,常見的有:
minix linux最早使用的文件系統
ext2 linux目前常用的文件系統
msdos MS-DOS的fat,就是fat16
vfat
windows98常用的fat32
nfs
網絡文件系統
iso9660 CD-ROM光盤標準文件系統
ntfs
windows NT 2000的文件系統
hpfs OS/2文件系統
auto 自動檢測文件系統
-o<選項> 指定掛載文件系統時的選項。有些也可用在/etc/fstab中。常用的有
codepage=XXX 代碼頁
iocharset=XXX 字符集
ro 以只讀方式掛載
rw 以讀寫方式掛載
nouser 使一般用戶無法掛載
user 可以讓一般用戶掛載設備
-o 參數里的codepage iocharset選項。codepage指定文件系統的代碼頁,簡體中文中文代碼是936;iocharset指定字符集,簡體中文一般用cp936或 gb2312。
mount舉例:
1. 加掛 fat 文件系統
mount /dev/hda6 /mnt/d -o codepage=936,iocharset=cp936
mount -t vfat /dev/hda6 /mnt/d -o codepage=936,iocharset=cp936
注意:cp936是指簡體中文,cp950是指繁體中文。
2. 加掛NTFS文件系統
Install NTFS driver
If you need a
clearcase/" target="_blank" >ccess to NT file systems you'll probably want to download the Linux ntfs driver. There is a site that maintains pre-built modules for all released Fedora kernels at
http://linux-ntfs.sourceforge.net/rpm/fedora3.html. A pre-built ntfs module usually appears just a few days after a new Fedora kernel gets released. Be sure to match your kernel version and processor type. If you're not sure what version you're running do this:
# uname -r -p
For example if you're using the latest kernel (as of this writing) which is 2.6.9-1.667 and the i686 (even if it's an AMD) processor then you will want to download it to a local directory and install it as such:
# rpm -ihv kernel-module-ntfs-2.6.9-1.667-2.1.20-0.fc.1.2.i686.rpm
More detailed instructions on determining which RPM you need can be found at
http://linux-ntfs.sourceforge.net/rpm/instructions.html. Once installed the ntfs driver will be a dynamically loadable module and you can mount NT file systems with mount -t ntfs -o nls=utf8 /dev/hdXX /mnt .
3. 加掛usb 優盤
Linux對USB設備有很好的支持,在你插入U盤后,U盤被識別為一個SCSI盤,通常您用以下命令就能加掛U盤上的文件系統
mount /dev/sda1 /usb
同樣對于中文的文件名和目錄名會出現亂碼的問題可以指定字符集,命令類似于上面對FAT32介紹的:
mount /dev/sda1 /usb -o pagecode=936,iocharset=cp936
4. 加掛
Linux系統通過samba共享出來的目錄
利用samba共享出來的目錄其實很難說其原來是哪種文件系統,不過這一點不重要,只要它對用戶是透明的就好啦。加掛時,我們指定類型為smbfs,在加掛samba共享的分區時,也會出現中文的文件名和目錄名亂碼情況,可以用以下命令加掛:
mount -t smbfs -o
username=terry,password=terry,codepage=936,iocharset=cp936
//terry-linux/terry /mp3/
mount -t smbfs -o
username=terry,password=terry,codepage=936,iocharset=cp936
//192.168.100.228/terry /mp3/
注意:你可以不直接寫password=terry這個參數,系統界時會要你輸入密碼,這樣就可以防止有人直接看到你的密碼。視具體情況而定,-o后面的參數可以對應增減。
5. 加掛Window系統共享出來的目錄
在局域網中,常常需要去訪問其它
Windows系統共享出來的目錄,在Linux下,安裝了samba后就可以使用samba中帶的命令來訪問
Windows機器的共享資源。
用smbclient來列出
Windows機器的共享資源
smbclient -L 192.168.100.111
根據上面所列出
Windows的共享資源后,可以選擇需要加掛到本地Linux中去的
Windows的共享資源,然后使用smbmount或mount來加掛,請參照下面幾條命令:
smbmount //192.168.100.111/public /public/
mount //192.168.100.111/d /mnt/cdrom -o username=terry (這樣要在命令行輸入密碼的)
mount //192.168.100.111/d /mnt/cdrom -o username=terry34 (這樣則不必在命令行輸入密碼)
注:除了上面介紹的命令行方法之外,這時最好的方法就是使用其它的客戶端,如LinNeighborhood、networkneighbours、ksmbshare等,請參考其它文章。
mount自動掛在文件系統:
通常有2種方法:
方法1.
把加掛的命令放在/etc/rc.d/rc.local中。
方法2.
修改分區配置文件/etc/fstab,在啟動時加掛文件系統。
原文轉自:http://www.kjueaiud.com