码迷,mamicode.com
首页 > 系统相关 > 详细

linux下如何优雅的挂载一个外界设备(比如优盘)

时间:2015-03-15 22:33:06      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

        最近从事linux,实验室一个破服务器,能连上网,但是输入这样的命令:        yum -y install gcc


yum -y install gcc-c++ ,居然说是没有这样的镜像,也罢,就用U盘搞了一个linux gcc,gcc-c++,然后问题来了?

    外挂哪家强?   完全找不到移动设备有木有。  嗷嗷的哭呀!

     果断的敲入:   fdisk -l    -->查看分区的状态

Disk /dev/sdb: 4051 MB, 4051697664 bytes
151 heads, 42 sectors/track, 1247 cylinders
Units = cylinders of 6342 * 512 = 3247104 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

Device Boot Start End Blocks Id System
/dev/sdb1 1 1248 3956708 c W95 FAT32 (LBA)

  找到了,U盘的位置,但是就是进不去呀!

  于是先建立一个路径: mkdir  mnt/usb   

有木有,果然的去问了迅雷工作的学长韦回超学长,说是我mount命令用错了!!

 我看了,我的命令一下:mount /dev/gdb1/mnt/usb  

  并mount -help了一下!

  恩! 是的! 用错了! 少了一个空格!!   mount  file1  file2  

    mount /dev/gdb1   /mnt/usb

这样就挂载好了!  

   总结一下步骤吧!:

    第一步: fdisk -l    -->查看外界设备的位置   比如这个优盘  /dev/sdb1

  

[root@tomato2 ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x141cccb4

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 60802 487873536 8e Linux LVM

Disk /dev/mapper/vg_tomato2-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_tomato2-lv_swap: 3388 MB, 3388997632 bytes
255 heads, 63 sectors/track, 412 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_tomato2-lv_home: 442.5 GB, 442503266304 bytes
255 heads, 63 sectors/track, 53797 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/sdb: 4051 MB, 4051697664 bytes
151 heads, 42 sectors/track, 1247 cylinders
Units = cylinders of 6342 * 512 = 3247104 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

Device Boot Start End Blocks Id System
/dev/sdb1 1 1248 3956708 c W95 FAT32 (LBA)

   第二步: 设置一个路径    mkdir   mnt/usb       -->这个usb什么的就随便的起名字了!


[root@tomato2 ~]# mkdir /mnt/usb

   第三步: 将U盘挂载到这个路径中来!    mount  /dev/gdb1   /mnt/usb

 

  这样就ok 了!   但是最后还是有一个结尾就是卸载这个挂载点  unmount /mnt/usb

[root@tomato2 ~]# umount /mnt/usb

 

   然后删除路径:  rmkdir  mnt/usb

[root@tomato2 ~]# rmdir /mnt/usb

 

  然后就可以去优雅的去使用U盘里的东西啦!!!! 

linux下如何优雅的挂载一个外界设备(比如优盘)

标签:

原文地址:http://www.cnblogs.com/gongxijun/p/4340546.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!