将 /dev/sda1 对应的 /media/w/9f6a2add-e287-4bf7-8e71-76cde406b11c 目录内容挂载到 /mnt/sda1
目录中,使用 sudo mount /dev/sda1 /mnt/sda1
命令
w@w:/mnt/sda1$ df -h Filesystem Size Used Avail Use% Mounted on udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 3.6M 1.6G 1% /run /dev/sdb2 234G 73G 149G 33% / tmpfs 7.8G 282M 7.6G 4% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/loop0 384K 384K 0 100% /snap/gnome-characters/550 /dev/loop6 1.0M 1.0M 0 100% /snap/gnome-logs/100 /dev/loop14 2.5M 2.5M 0 100% /snap/gnome-calculator/748 /dev/loop1 384K 384K 0 100% /snap/gnome-characters/539 /dev/loop11 1.0M 1.0M 0 100% /snap/gnome-logs/93 /dev/loop5 63M 63M 0 100% /snap/gtk-common-themes/1506 /dev/loop7 55M 55M 0 100% /snap/gtk-common-themes/1502 /dev/loop2 55M 55M 0 100% /snap/core18/1754 /dev/loop3 141M 141M 0 100% /snap/gnome-3-26-1604/98 /dev/loop4 2.5M 2.5M 0 100% /snap/gnome-calculator/730 /dev/loop10 2.3M 2.3M 0 100% /snap/gnome-system-monitor/148 /dev/loop15 162M 162M 0 100% /snap/gnome-3-28-1804/128 /dev/loop12 55M 55M 0 100% /snap/core18/1880 /dev/loop18 256M 256M 0 100% /snap/gnome-3-34-1804/33 /dev/loop16 256M 256M 0 100% /snap/gnome-3-34-1804/36 /dev/loop20 2.3M 2.3M 0 100% /snap/gnome-system-monitor/145 /dev/loop8 97M 97M 0 100% /snap/core/9436 /dev/loop13 161M 161M 0 100% /snap/gnome-3-28-1804/116 /dev/loop9 97M 97M 0 100% /snap/core/9665 /dev/loop17 133M 133M 0 100% /snap/postman/95 /dev/loop19 141M 141M 0 100% /snap/gnome-3-26-1604/100 /dev/sdb1 511M 16M 496M 4% /boot/efi tmpfs 1.6G 16K 1.6G 1% /run/user/121 tmpfs 1.6G 44K 1.6G 1% /run/user/1000 /dev/sda1 917G 129G 742G 15% /media/w/9f6a2add-e287-4bf7-8e71-76cde406b11c w@w:~$ sudo mount /dev/sda1 /mnt/sda1 w@w:/mnt/sda1$ ls w
注意
这样挂载完以后的目录,电脑重启后挂载的内容就没有了,需要重新操作,解决方式如下
使用 root 用户在 /etc/fstab
文件中添加一行内容 /dev/sda1 /mnt/sda1 ext4 errors=remount-ro 0 1
这样电脑重启后挂载的目录依然还在。
root@w:~# tail /etc/fstab # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sdb2 during installation UUID=b9bceef6-f44c-4882-9216-1d6b8ecf1e43 / ext4 errors=remount-ro 0 1 # /boot/efi was on /dev/sdb1 during installation UUID=5B15-2493 /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0 /dev/sda1 /mnt/sda1 ext4 errors=remount-ro 0 1
设备文件类型查询, 使用 root 用户执行 blkid
命令
root@w:~# blkid /dev/loop0: TYPE="squashfs" /dev/loop1: TYPE="squashfs" /dev/loop2: TYPE="squashfs" /dev/loop3: TYPE="squashfs" /dev/loop4: TYPE="squashfs" /dev/loop5: TYPE="squashfs" /dev/loop6: TYPE="squashfs" /dev/loop7: TYPE="squashfs" /dev/sda1: UUID="9f6a2add-e287-4bf7-8e71-76cde406b11c" TYPE="ext4" PARTUUID="ca890f89-01" /dev/sdb1: UUID="5B15-2493" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="d176220a-1c9f-4fba-9855-e24269a3dbe9" /dev/sdb2: UUID="b9bceef6-f44c-4882-9216-1d6b8ecf1e43" TYPE="ext4" PARTUUID="9798f821-a39c-4622-b367-c5f842620db1" /dev/loop8: TYPE="squashfs" /dev/loop9: TYPE="squashfs" /dev/loop10: TYPE="squashfs" /dev/loop11: TYPE="squashfs" /dev/loop12: TYPE="squashfs" /dev/loop13: TYPE="squashfs" /dev/loop14: TYPE="squashfs" /dev/loop15: TYPE="squashfs" /dev/loop16: TYPE="squashfs" /dev/loop17: TYPE="squashfs" /dev/loop18: TYPE="squashfs" /dev/loop19: TYPE="squashfs" /dev/loop20: TYPE="squashfs"