computer_knowledge_notes/Software/设备管理/mount.md

136 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 语法
```bash
mount [-l|-h|-V]
mount -a [-fFnrsvw][-t fstype][-O optlist] # 挂载fsbab里记录的所有文件系统
mount [-fnrsvw][-o options] device|dir
mount [-fnrsvw][-t fstype] [-o options] device dir
```
#### 选项
```
-a, --all # 挂载fsbab里记录的所有文件系统
-B
-c
-F
-f
-i
-L
-l # 显示已加载的文件系统
-M
-n
-o, --options <list> # 指定挂载选项listlist内部的各选项用逗号分隔可用的选项详见#文件系统无关选项和#文件系统相关选项
-O, --test-opts <list> # 与-a一起使用限制文件系统的集合
-R
-r
-s
--source
--target
-T
-t # 指示文件系统的类型
-U
-v # 详细模式
-w
-V # 打印版本信息
-h # 打印帮助信息
```
#### 文件系统无关选项
```
remount # 重新挂载文件系统。它一般用于修改挂载标志,尤其是让只读的文件系统改为可写。
ro # 以只读的形式挂载文件系统
rw # 以可读写的形式挂载文件系统
```
#### 文件系统相关选项
##### adfs
##### affs
##### btrfs
cifs
cohernet
debugfs
devpts
ext2,ext3,ext4
fat
hfs
hpfs
iso9660
jfs
minix
msdos
ncpfs
nfs,nfs4
ntfs
overlay
proc
ramfs
reiserfs
romfs
squashfs
smbfs
sysv
tmpfs
ubifs
udf
ufs
umsdos
vfat
usbfs
xenix
xfs
#### 示例
```bash
# mount的标准形式将设备device上type类型的文件系统挂载到目录dir上
mount -t type device dir
# 将回环设备loop3对应到文件disk.img然后在/mnt上挂载这个设备
mount /tmp/disk.img /mnt -t vfat -o loop=/dev/loop3
# 使用了-o loop选项但没有指定具体的回环设备将会试着分配一个未使用的回环设备
mount /tmp/disk.img /mnt -o loop
# 挂载img文件
fdisk -l abc.img # 计算起始位置:起始扇区*扇区大小
sudo mount -o loop,offset=起始位置 abc.img /mnt
# 挂载ntfs分区
sudo pacman -S ntfs-3g # 下载ntfs-3g后即可正常挂载ntfs分区
```