Linux服务器上挂载U盘

时间:2024-04-04 16:00:56

0. 查看U盘是否被读取

lsusb

 

1. 查看U盘位置

sudo fdisk -l

或者:

df -h

根据U盘的大小可以大致判断大致的路径

我这里的输出是

Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xfaae6f53

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    976895    974848   476M 83 Linux
/dev/sda2          978942 937701375 936722434 446.7G  5 Extended
/dev/sda5          978944  16977919  15998976   7.6G 82 Linux swap / Solaris
/dev/sda6        16979968 416978943 399998976 190.8G 83 Linux
/dev/sda7       416980992 937701375 520720384 248.3G 83 Linux

Partition 2 does not start on physical sector boundary.


Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x21d1d4fa

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1        2048 937701375 937699328 447.1G 83 Linux


Disk /dev/sdf: 7.3 TiB, 8001529315328 bytes, 15627986944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 9834A7E6-8A30-4C35-AE97-755625E245EF

Device     Start         End     Sectors  Size Type
/dev/sdf1   2048 15627984895 15627982848  7.3T Microsoft basic data

我的U盘大小是8T,所以可以大致判断,最后一个/dev/sdf1应该就是我的U盘了

 

2. 挂载

sudo mount U盘位置 目标位置

例如: 

sudo mount /dev/sdf1 /braindat/huangwei2

 

3. 复制

此时,U盘已经成功挂载在目标位置上了,但U盘上的内容并没有拷贝在目标机子上,我们此时需要执行cp进行拷贝

但一般数据都比较大,如果直接cp我们将不知道复制需要执行多久,如果有一个进度条就好了

这样就要介绍两个东西了:

第1个就是tmux,tmux怎么用见:tmux的使用教程,简单来说,tmux就是一个分屏和打开多个终端的小插件,有时候在服务器上我们需要在同一个路径上同时打开多个终端,并进行切换,这是就需要tmux了,tmux new表示新建一个终端,先按Ctrl+B再按D表示暂时退出该终端,等等

第2个就是mc了,第一个就是安装了:sudo apt-get install mc。使用教程:mc使用教程

复制窗口:

Linux服务器上挂载U盘