Linux挂载移动硬盘

在Linux系统里挂载移动硬盘或U盘;

以centos7为例:

1. 在没有连接移动硬盘到服务器之前,先使用命令:fdisk -l 看一下硬盘及硬盘的分区情况;

如:

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x00099872

现在是有一个 /dev/sda;

2. 连接上移动硬盘到USB接口,再用fdisk -l 看一下,看是否多了一块硬盘,

如:

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x00099872

Disk /dev/sdb: 40.0 GB, 40007761920 bytes

255 heads, 63 sectors/track, 4864 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 510 4096543+ 7 HPFS/NTFS

发现现在多了一个/dev/sdb,并且分区为/dev/sdb1,

3. 创建一个目录,作为挂载点,如:mkdir -p /mydata/data

4. yum -y install ntfs-3g

5. 挂载: mount -t ntfs /dev/sdb1 /mydata/data

注:对ntfs格式的磁盘分区应使用-t ntfs 参数,对fat32格式的磁盘分区应使用-t vfat参数。若汉字文件名显示为乱码或不显示,可以使用下面的命令格式。
   #mount -t ntfs -o iocharset=cp936 /dev/sdcb1 /mydata/data
   #mount -t vfat -o iocharset=cp936 /dev/sdcb1 /mydata/data
6. df -h 查看挂载
原文地址:https://www.cnblogs.com/weiyiming007/p/8522056.html