linux挂载命令mount及U盘、移动硬盘的挂载
一.mount的命令格式是(注意mount只能在root权限下运行)
mount dervice dir
dervice是要挂载的设备,dir是挂载点
二.查看当前磁盘列表的设备
fdisk -l
显示如下信息
root@kali:~# fdisk -l Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0x1eb9aaf8 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 209719295 209717248 100G 7 HPFS/NTFS/exFAT /dev/sda2 209719296 976773119 767053824 365.8G f W95 Ext'd (LBA) /dev/sda5 209721344 465575935 255854592 122G 7 HPFS/NTFS/exFAT /dev/sda6 465577984 721432575 255854592 122G 7 HPFS/NTFS/exFAT /dev/sda7 721434624 976773119 255338496 121.8G 7 HPFS/NTFS/exFAT Disk /dev/sdb: 117.9 GiB, 126567317504 bytes, 247201792 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 Disklabel type: dos Disk identifier: 0x19ac4874 Device Boot Start End Sectors Size Id Type /dev/sdb1 * 2048 238815231 238813184 113.9G 83 Linux /dev/sdb2 238817278 247199743 8382466 4G 5 Extended /dev/sdb5 238817280 247199743 8382464 4G 82 Linux swap / Solaris Disk /dev/sdc: 29.7 GiB, 31876710400 bytes, 62259200 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 Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 62257151 62255104 29.7G c W95 FAT32 (LBA)
这里我们可以看到所有连接在电脑上的设备和分区情况,比如我们想挂载/dev/sda5
三.创建挂载点
mkdir /mnt/diskd
mount /dev/sda5 /mnt/diskd
挂载成功
四.弹出设备
umount /dev/sda5
通过df可以查看设备挂载点