Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Ubuntu Server 版本如何掛載 U 盤

Server 版沒有桌面環境,插入 U 盤不會自動掛載,必須手動掛到 /mnt 底下才能讀取。

步驟一:插入 U 盤

步驟二:確認裝置名稱

# fdisk -l /dev/sda
Disk /dev/sda: 131 MB, 131104768 bytes
3 heads, 32 sectors/track, 2667 cylinders
Units = cylinders of 96 * 512 = 49152 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        2668      128016    6  FAT16

如果硬碟走 SCSI 介面,裝置名可能不是 sda,而是 sdb、sdc、sdd,依此類推。

步驟三:掛載

從上面的輸出可知 U 盤是 /dev/sda1,假設要掛到 /mnt/usb:

mount -t auto -o iocharset=cp936 /dev/sda1 /mnt/usb/

步驟四:讀取內容

進入 /mnt/usb 就能看到 U 盤裡的檔案了。

常用參數

-t 指定檔案系統型態,常見值有:

  • minix:Linux 最早使用的檔案系統
  • ext2:Linux 常見檔案系統
  • msdos:MS-DOS 的 FAT16
  • vfat:Windows 98 常用的 FAT32
  • nfs:網路檔案系統
  • iso9660:CD-ROM 標準檔案系統
  • ntfs:Windows NT/2000 檔案系統
  • hpfs:OS/2 檔案系統
  • auto:自動偵測

-o 指定掛載選項,也可寫在 /etc/fstab 中,常用的有 codepage 指定代碼頁、iocharset 指定字符集、ro 唯讀、rw 可讀寫、nouser 禁止一般使用者掛載、user 允許一般使用者掛載。

調整檔案歸屬

這樣掛上去的檔案預設屬組是 root,若想改成指定使用者,可先查 UID 與 GID:

id xxx
sudo mount /dev/sdb1 /mnt/usb -o uid=1000,gid=1000
Copyright © Linux教程網 All Rights Reserved