zoukankan      html  css  js  c++  java
  • Redhat linux 挂载命令mount

     

      命令格式:

      mount [-t vfstype] [-o options] device dir

      其中:

      1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。常用类型有:

      光盘或光盘镜像:iso9660

      DOS fat16文件系统:msdos

      Windows 9x fat32文件系统:vfat

      Windows NT ntfs文件系统:ntfs

      Mount Windows文件网络共享:smbfs

      UNIX(LINUX) 文件网络共享:nfs

      2.-o options 主要用来描述设备或档案的挂接方式。常用的参数有:

      loop:用来把一个文件当成硬盘分区挂接上系统

      ro:采用只读方式挂接设备

      rw:采用读写方式挂接设备

      iocharset:指定访问文件系统所用字符集

      3.device 要挂接(mount)的设备。

      4.dir设备在系统上的挂接点(mount point)。

      1、光盘挂载

      标注:光盘自动挂载到默认路径 /media 目录下


      假如想制作光盘挂载点进行下面操作:


      将当前光驱里的光盘制作成光盘镜像文件/home/mydisk.iso

      #cp /media /home/mydisk.iso

      建立一个目录用来作挂载点,一般默认挂载点在/mnt 目录下建立

      #mkdir /mnt/dvd

      制作的mydisk.iso进行挂载

      #mount -o loop -t iso9660 /home/mydisk.iso /mnt/dvd

      取消挂载
      #umount /mnt/dvd

      2、挂载U盘(U盘有两种文件格式NTFS和FAT32)

      
      使用 fdisk -l 查看系统硬盘和U盘分区情况 (会对U盘FAT32挂载)

      [root at pldyrouter root]# fdisk -l
      Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes
      255 heads, 63 sectors/track, 8924 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes
      Device Boot Start End Blocks Id System
      /dev/sda1 1 4 32098+ de Dell Utility
      /dev/sda2 * 5 2554 20482875 7 HPFS/NTFS
      /dev/sda3 2555 7904 42973875 83 Linux
      /dev/sda4 7905 8924 8193150 f Win95 Ext'd (LBA)
      /dev/sda5 7905 8924 8193118+ 82 Linux swap
      Disk /dev/sdd: 131 MB, 131072000 bytes
      9 heads, 32 sectors/track, 888 cylinders
      Units = cylinders of 288 * 512 = 147456 bytes
      Device Boot Start End Blocks Id System
      /dev/sdd1 * 1 889 127983+ b Win95 FAT32
      Partition 1 has different physical/logical endings:
      phys=(1000, 8, 32) logical=(888, 7, 31)


      建立一个目录用来作挂载点,一般默认挂载点在/mnt 目录下建立

      #mkdir /mnt/usb

      使用mount进行U盘挂载

      #mount -t vfat /dev/sdd1 /mnt/usb

      若汉字文件名显示为乱码或不显示,可以使用下面的命令

      #mount -t vfat -o iocharset=cp936 /dev/sdd1 /mnt/usb

      取消挂载
      #umount /mnt/usb

         使用 fdisk -l 查看系统硬盘和U盘分区情况 (会对U盘NTFS挂载)   

      [root@sstisystem ~]# 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 / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x09cb47e4

      Device Boot Start End Blocks Id System
      /dev/sda1 * 1 128 1024000 83 Linux
      Partition 1 does not end on cylinder boundary.
      /dev/sda2 128 25625 204800000 83 Linux
      /dev/sda3 25625 38373 102400000 83 Linux
      /dev/sda4 38373 60802 180161536 5 Extended
      /dev/sda5 38373 44747 51200000 83 Linux
      /dev/sda6 44747 45321 4608000 82 Linux swap / Solaris

      Disk /dev/sdb: 8053 MB, 8053063680 bytes
      255 heads, 63 sectors/track, 979 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0xcad4ebea

      Device Boot Start End Blocks Id System
      /dev/sdb4 * 1 980 7864192 7 HPFS/NTFS
      Partition 4 has different physical/logical endings:
      phys=(978, 254, 63) logical=(979, 15, 60)

      

      执行挂载命令提示如下错误:

      [root@sstisystem ~]# mount -t ntfs /dev/sdb4 /mnt/usb
      mount: unknown filesystem type 'ntfs'

      

      需要通过第三方软件ntfs-3g软件来实现,能过yum在线安装:

      [root@sstisystem ~]# yum -y install ntfs-3g*

      

      执行命令进行挂载:

      [root@sstisystem ~]# mount -t ntfs-3g /dev/sdb4 /mnt/usb

       

      

      3、挂载windows文件共享

      标注:首先在windows下设置一个共享文件夹backup,建立一个用户abc,密码设置成123,把backup文件夹访问权限分配给abc用户


      建立一个目录用来作挂载点,一般默认挂载点在/mnt 目录下建立

      #mkdir /mnt/file

      使用mount把windows共享文件夹挂载到linux目录下/mnt/file

      mount -t cifs -o username=abc,password="123" //192.168.1.10/backup /mnt/file

      取消挂载
      #umount /mnt/dvd

      强制取消挂载

      #umount -f /mnt/dvd

       问题1:

      如果运行umount取消挂载提示如下: (挂载目录正在使用中)

      [root@cloucentos6 ~]# umount /mnt/file/
      umount: /mnt/file: device is busy.
      (In some cases useful info about processes that use
      the device is found by lsof(8) or fuser(1))

      问题1解决办法:

      [root@cloucentos6 ~]# lsof /mnt/file/
      COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
      bash 2807 root cwd DIR 0,20 4096 562949953421362 /mnt/file
      [root@cloucentos6 ~]# kill -9 2807
      [root@cloucentos6 ~]# umount /mnt/file/

      

      问题2:

      linux 运行挂载目录共享提示如下错误:

      [root@ssticentos ~]# mount -t cifs -o username=abc,password="123" //192.168.1.10/backup /mnt/file
      mount error(12): Cannot allocate memory
      Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

      问题2解决办法:

      重启windows 系统挂载共享的系统Server服务即可。

      

  • 相关阅读:
    Changing Icon File Of Push Button At Runtime In Oracle Forms 6i
    Set Font Properties On Mouse Hover Of Push Button And Text Items At Run time In Oracle Forms
    Change An Item Property Using Set_Item_Property In Oracle Forms
    Calling / Running a report in Oracle forms 10g / 11g
    Change Or Set Report Object Property At Run Time In Oracle Forms Using Set_Report_Object_Property Command
    Refresh / Updating a form screen in Oracle D2k Forms 6i
    Know How And When To Use System.Message_Level To Control Messages In Oracle Forms
    Perform Cut Copy Paste Operations Using Cut_Region Copy_Region Paste_Region Commands In Oracle Forms
    CHECKBOX_CHECKED built-in in Oracle D2k Forms
    Limiting To Select Only 5 Check Boxes Out Of Ten In Oracle Forms
  • 原文地址:https://www.cnblogs.com/zoulongbin/p/5583854.html
Copyright © 2011-2022 走看看