首页 > 代码库 > ntfs-3g

ntfs-3g

ntfs-3g

tar zxvf ntfs-3g_ntfsprogs-2015.3.14.tgz
cd ntfs-3g_ntfsprogs-2015.3.14
./configure && make && make install

插上移动硬盘后,执行挂载命令:
mount -t ntfs-3g /dev/sdb1 /mnt

有的移动硬盘会有两个分区,其中前一个是隐藏的分区,用parted查看类似以下信息:
[root@localhost ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help‘ to view a list of commands.
(parted) print                                                           
Model: Seagate Expansion Desk (scsi)
Disk /dev/sdb: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      17.4kB  134MB   134MB                Microsoft reserved partition  msftres
 2      135MB   4001GB  4001GB  ntfs         Basic data partition

[root@idcb-rmdb ~]# parted /dev/sde
GNU Parted 1.8.1
使用 /dev/sde
Welcome to GNU Parted! Type ‘help‘ to view a list of commands.
(parted) print                                                           

Model: ST3000VX 000-1CU166 (scsi)
Disk /dev/sde: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          标志  
 1      17.4kB  134MB   134MB                Microsoft reserved partition  msftres
 2      135MB   3001GB  3000GB  ntfs         Basic data partition                

但用fdisk查看时,看不到sdb2,如下:

[root@localhost ~]# fdisk -l
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdb‘! The util fdisk doesn‘t support GPT. Use GNU Parted.

Disk /dev/sdb: 4000.8 GB, 4000787029504 bytes
256 heads, 63 sectors/track, 484501 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xf883381b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      266306  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

如果用下面的命令挂载,就会报错:
mount -t ntfs-3g /dev/sdb /mnt   或者 mount -t ntfs-3g /dev/sdb1 /mnt
报错信息类似以下:
NTFS signature is missing.
Failed to mount ‘/dev/sdb‘: Invalid argument
The device ‘/dev/sdb‘ doesn‘t seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

这种情况下,使用下面的命令即可正确挂载:
mount -t ntfs-3g /dev/sdb2 /mnt

ntfs-3g