Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux mount 命令詳解:光盤、軟盤、U盤、移動硬碟掛載全攻略

編輯:Linux 教學

核心概念

Linux 將所有存儲設備視為文件系統樹的一部分。使用 mount 將設備(光盤、U盤、硬碟分區)掛載到目錄(掛載點),即可透過目錄路徑讀寫數據;umount 則用於安全卸載。

常見設備掛載命令速查

1. 光盤 (ISO9660 格式)

# 建立掛載點
mkdir -p /mnt/cdrom
# 掛載
mount -t iso9660 /dev/cdrom /mnt/cdrom
# 卸載
umount /mnt/cdrom

2. 軟盤

mkdir -p /mnt/floppy
mount /dev/fd0 /mnt/floppy
umount /mnt/floppy

3. U盤 (關鍵步驟:確認設備節點)

  1. fdisk -l 查看設備名(通常為 /dev/sda1)。
  2. 建立掛載點:mkdir /mnt/usb。
  3. 根據文件系統類型掛載:
# FAT16
mount -t msdos /dev/sda1 /mnt/usb
# FAT32 (常見)
mount -t vfat /dev/sda1 /mnt/usb

4. 移動硬碟分區 (FAT32 為例)

fdisk -l          # 確認分區,假設為 /dev/hda1
mkdir /mnt/vfat
mount -t vfat /dev/hda1 /mnt/vfat

實現普通用戶掛載與開機自動掛載:編輯 /etc/fstab

預設僅 root 可執行 mount。在 /etc/fstab 加入 user 選項賦予普通用戶權限,auto 實現開機自動掛載:

/dev/cdrom  /mnt/cdrom   iso9660  auto,owner,kudzu,ro,user  0 0
/dev/fd0    /mnt/floppy  auto     auto,owner,kudzu,ro,user  0 0

欄位說明: 設備 | 掛載點 | 文件系統類型 | 掛載選項 | dump 備份標記 | fsck 檢查順序。

man fstab 可查閱完整選項手冊,建議管理員細讀。
Copyright © Windows教程網 All Rights Reserved