当前位置: 首页>>技术教程>>正文


如何安装外置硬盘?

, , ,

问题描述

我现在最新的Ubuntu Linux 12.04版本。我想安装一个外置硬盘NTFS 1TB。我已经按照许多指南但仍然没有成功。我得到的错误是这样的:

Failed to read last sector (1953523119): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
   or it was not setup correctly (e.g. by not using mdadm --build ...),
   or a wrong device is tried to be mounted,
   or the partition table is corrupt (partition is smaller than NTFS),
   or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sdb1': Invalid argument
The device '/dev/sdb1' 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?
Using Storage Device MAnager i get this error:Error mounting: mount exited with exit code 1: helper failed with:
mount: only root can mount /dev/sdb1 on /media/Skliros_Diskos {external disk name} 

当我使用sudo fdisk -l时,这是输出:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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
Disk identifier: 0x000e0bc6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   618854399   309426176   83  Linux
/dev/sda2       618856446   625141759     3142657    5  Extended
/dev/sda5       618856448   625141759     3142656   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000202043392 bytes
255 heads, 63 sectors/track, 121600 cylinders, total 1953519616 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
Disk identifier: 0x0002093a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048  1953525167   976761560    7  HPFS/NTFS/exFAT

最佳解决办法

尝试查看磁盘列表中是否有条目

sudo fdisk -l  

然后尝试安装它

sudo mount -t ntfs /dev/sdb1 /media

要查找外部驱动器的正确/dev/sdb位置,请查看sudo fdisk -l的结果。

次佳解决办法

第1步:创建一个文件夹

sudo mkdir /media/Skliros_Diskos

第2步:挂载NTFS文件系统

sudo mount -t ntfs-3g /dev/sdb1 /media/Skliros_Diskos

请注意空格。根据您对该问题的评论,您没有在命令中添加空格。

您不应将其安装在/media目录中,因为系统可能会使用它,因此可能不允许您轻松地使用umount磁盘。另一个原因是,当你plug-in另一个外部驱动器时,Ubuntu会自动在/media中创建一个目录并在该目录上挂载系统,这可能有一些副作用,因为/media目录将是你的外部驱动器。

安装后,您可以通过Nautilus(默认的Ubuntu GUI文件浏览器)正常访问它。它应该列在左侧的列表中,如果不是,请按Ctrl + L并键入/media/Skliros_Diskos

或者您使用cd /media/Skliros_Diskos在终端中访问它。

第三种解决办法

我发现使用lsblk而不是fdisk -l更加舒适,因为最近并不总是需要将文件系统类型指定为priory。此外,我想通过命令行模拟通过Device Notifier进行安装的行为。在Kubuntu 14.04 LTS上测试。

第1步:从哪里开始个性化

为了个性化我喜欢在哪里使用lsblk(来自util-linux包)

lsblk 

这给了类似的东西

 NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0 925.5G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0     6G  0 part [SWAP]

sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part 

在这种情况下是sdb1,它没有安装(没有MOUNTPOINT),如果我拔掉外​​部HD,我将不再看到这个条目。

第2步:安装

如果我想将它挂载到现有目录/Full/path/和我的用户ID uid =1000我的组ID是gid=1000我可以直接使用

sudo mount  /dev/sdb1 /Full/path/ -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

这给了我与通过Device Notifier以图形方式安装时相同的安装选项

笔记:

  • 你可以看到你的uid:gid与grep $USER /etc/passwd:分别是由:分隔的第3和第4个字段

  • man mount适用于所有安装选项

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/2894.html,未经允许,请勿转载。