Ubuntu 挂载 U 盘的步骤如下:
(1)使用 root 用户登陆 Ubuntu 系统,如下:
[hxstrive@localhost ~]$ su Password: [root@localhost hxstrive]#
(2)使用 fdisk -l 命令查看当前挂载,如下:
[root@localhost hxstrive]# fdisk -l Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VMware Virtual S Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xffc8c2a0 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 2099199 2097152 1G 83 Linux /dev/sda2 2099200 41943039 39843840 19G 8e Linux LVM Disk /dev/mapper/cs-root: 17 GiB, 18249416704 bytes, 35643392 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/cs-swap: 2 GiB, 2147483648 bytes, 4194304 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sdb: 28.84 GiB, 30966546432 bytes, 60481536 sectors Disk model: DataTraveler 2.0 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0239b15e Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 60481535 60479488 28.8G c W95 FAT32 (LBA)
一般情况未挂载的硬盘都在最后,这里是 /dev/sdb1。
(3)新建一个目录来挂载硬盘,例如:
[root@localhost hxstrive]# cd /mnt/ # 创建 usb 目录 [root@localhost mnt]# mkdir usb [root@localhost mnt]# cd usb/ [root@localhost usb]# pwd /mnt/usb
(4)使用 mount 挂载命令将 U 盘挂载到 /mnt/usb 目录,如下:
[root@localhost ~]# mount /dev/sdb1 /mnt/usb
(5)如果不出问题,此时就挂载成功。查看 U 盘的内容,如下:
[root@localhost ~]# ll /mnt/usb/ total 384 -rw-r--r--. 1 hxstrive hxstrive 34494 Nov 2 04:49 autorun.ico -rw-r--r--. 1 hxstrive hxstrive 230 Nov 2 04:49 autorun.inf drwxr-xr-x. 3 hxstrive hxstrive 16384 Nov 2 04:44 boot drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:44 casper drwxr-xr-x. 3 hxstrive hxstrive 16384 Nov 2 04:49 dists drwxr-xr-x. 3 hxstrive hxstrive 16384 Nov 2 04:49 EFI drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:49 install drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:49 isolinux -r--r--r--. 1 hxstrive hxstrive 69623 Nov 2 04:44 ldlinux.sys -rw-r--r--. 1 hxstrive hxstrive 24055 Nov 2 04:49 md5sum.txt drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:49 pics drwxr-xr-x. 4 hxstrive hxstrive 16384 Nov 2 04:49 pool drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:49 preseed -rw-r--r--. 1 hxstrive hxstrive 231 Nov 2 04:49 README.diskdefines -rw-r--r--. 1 hxstrive hxstrive 94 Nov 2 04:49 syslinux.cfg drwxr-xr-x. 2 hxstrive hxstrive 16384 Nov 2 04:44 'System Volume Information' -rw-r--r--. 1 hxstrive hxstrive 1 Nov 2 04:49 ubuntu
在使用完 U 盘后,在拔出前需要先键入卸载 U 盘命令,例如:
[root@localhost ~]# umount /mnt/usb [root@localhost ~]# ll /mnt/usb/ total 0
如果挂载时遇到,有进程占用硬盘,我们需要找到进程并 kill 掉,如下:
[root@localhost ~]# mount /dev/sdb1 /mnt/usb Mount is denied because the NTFS volume is already exclusively opened. The volume may be already mounted, or another software may use it which could be identified for example by the help of the 'fuser' command. [root@localhost ~]# Mount is denied because the NTFS volume is already e xclusively opened.
解决方式如下:
(1)查看进程,如下:
[root@localhost ~]# fuser -m -u /dev/sdb1 /dev/sdb1: 1977(root)
(2)结束进程,如下:
[root@localhost ~]# mount /dev/sdb1 /mnt/usb [root@localhost ~]# kill 1977
(3)重新挂载一次