1. 程式人生 > >centos7下掛載U盤和行動硬碟

centos7下掛載U盤和行動硬碟

本人系統為centos7 64bit

掛載U盤

1.使用fdisk -l命令檢視磁碟情況

[root@localhost liuyao]# fdisk -l

磁碟 /dev/sda:1000.2 GB, 1000204886016 位元組,1953525168 個扇區
……(此處為電腦內硬碟資訊,省略)

磁碟 /dev/sdb:16.0 GB, 16005464064 位元組,31260672 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 位元組 / 512 位元組
I/O 大小(最小/最佳):512 位元組 / 512 位元組
磁碟標籤型別:dos
磁碟識別符號:0xcad4ebea
裝置 Boot Start End Blocks Id System /dev/sdb4 * 256 31260671 15630208 7 HPFS/NTFS/exFAT

可以看到,U盤磁碟為sdb,用sdb4來表示U盤內容區域

2.使用mount命令掛載U盤,掛載位置為/mnt/udisk

2.1 若/mnt/udisk資料夾不存在,則新建

[root@localhost liuyao]# mkdir -p /mnt/udisk
[root@localhost liuyao]# ls /mnt
cdrom  udisk

mkdir引數-p表示如資料夾已存在,則不新建,使用該資料夾

2.2 掛載U盤

[root@localhost udisk]# mount -t ntfs-3g /dev/sdb4 /mnt/udisk/
[root@localhost udisk]# ls /mnt/udisk/
00Job  01Joy  02BigData  System Volume Information

若此時出現問題:未知的檔案系統型別“ntfs”,解決方法見下面問題1。

3.使用完U盤後,記得取消掛載,否則容易造成資料丟失

[root@localhost udisk]# umount /mnt/udisk/

掛載行動硬碟

內容待定……

FAQ

問題1:未知的檔案系統型別“ntfs”

在第2.2步掛載U盤時,本人先後使用預設方式(-w以讀寫方式掛載)和指明檔案系統型別的方式(mount [-t vfstype] [-o options] device dir)掛載U盤,都提示當前系統未知’ntfs’型別

[root@localhost liuyao]# mount -w /dev/sdb4 /mnt/udisk/
mount: 未知的檔案系統型別“ntfs”
[root@localhost udisk]# mount -t ntfs-3g /dev/sdb /mnt/udisk/
mount: 未知的檔案系統型別“ntfs-3g”

解決方法:安裝ntfs核心模組

1.檢視相應模組

[[email protected] udisk]# yum list *ntfs*
已載入外掛:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
……

可安裝的軟體包
findntfs.x86_64                                      1.3-1.el7.rf                                   rpmforge
fuse-ntfs-3g.x86_64                                  2013.1.13-2.el7.rf                             rpmforge
fuse-ntfs-3g-devel.x86_64                            2013.1.13-2.el7.rf                             rpmforge
ntfs-3g.x86_64                                       2:2016.2.22-1.el7                              epel    
ntfs-3g-devel.x86_64                                 2:2016.2.22-1.el7                              epel    
ntfsprogs.x86_64                                     2:2016.2.22-1.el7                              epel 

2.對於centos7 64bit來說,應該安裝fuse-ntfs-3g.x86_64

[root@localhost udisk]# yum install fuse-ntfs-3g

完畢!