Skip to content

Instantly share code, notes, and snippets.

@ibreathebsb
Last active August 26, 2018 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibreathebsb/d09db7d00b3dcfff6d46c0abc9154321 to your computer and use it in GitHub Desktop.
Save ibreathebsb/d09db7d00b3dcfff6d46c0abc9154321 to your computer and use it in GitHub Desktop.

配置文件

cat /etc/fstab

# filesystem | mount point | type | mount option | dump | fsck
/dev/loop15 /snap/gnome-logs/37 squashfs ro,nodev,relatime 0 0
/dev/nvme0n1p1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/nvme0n1p2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0

/etc/fstab是启动时的挂在配置文件,实际的的挂载情况记录在/etc/mtab proc/mounts,二者均指向了/proc/self/mounts

isaac@hp:~$ ls -il /etc/mtab /proc/mounts
  14549181 lrwxrwxrwx 1 root root 19 Aug  8 19:06 /etc/mtab -> ../proc/self/mounts
4026531843 lrwxrwxrwx 1 root root 11 Aug 26 11:52 /proc/mounts -> self/mounts

说明

file system: 文件系统

mount point: 挂载点

type: 文件系统类型 ext4...

mount option: mount -o option 挂载选项如sync auto realtime remount rw suid exex等等

dump: 是否备份 0不备份,1 备份

fsck: 挂载时候是否做fsck,0不做检查,1最早检查,2检查,优先级比较低

@ibreathebsb
Copy link
Author

镜像挂载

已有的iso挂载

mount -o loop file.iso /mnt/mydir

创建文件并已光盘的方式挂载

  1. dd if=/dev/zero of=~/bigfile bs=1M count=512
  2. mke2fs -t ext4 ~/bigfile
  3. mount -o loop ~/bigfile /dir/to/mount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment