无法在 Ubuntu 12.04 上安装外部 USB 驱动程序

无法在 Ubuntu 12.04 上安装外部 USB 驱动程序

当将外部 USB 驱动程序插入 PC 时,我看到以下信息:

Error mounting: mount exited with exit code 1: helper failed with:
mount: wrong fs type, bad option, bad superblock on /dev/sdd1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

我尝试使用lsblk,在安装此驱动程序后,我收到以下警告:

nazar_art@nazar-desctop:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 149.1G  0 disk 
├─sda1   8:1    0 148.1G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  1022M  0 part [SWAP]
sdb      8:16   1   3.8G  0 disk 
└─sdb1   8:17   1   3.8G  0 part /media/sdb1
sdd      8:48   1   7.2G  0 disk 
└─sdd1   8:49   1   7.2G  0 part 
nazar_art@nazar-desctop:~$ sudo mount /media/sdd
mount: can't find /media/sdd in /etc/fstab or /etc/mtab

它应该可以工作但是它却不行。

这是我的/etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc                                       /proc           proc  nodev,noexec,nosuid         0  0  
# / was on /dev/sda1 during installation
UUID=5f5d330f-d5f2-4157-9496-94f1dce2f181  /               ext4  errors=remount-ro           0  1  
# swap was on /dev/sda5 during installation
UUID=84747ef4-6f50-49bc-9df1-fcba364ba299  none            swap  sw                          0  0  

/dev/fd0                                   /media/floppy0  auto  rw,user,noauto,exec,utf8    0  0  
/dev/sdc1                                  /media/sdc1     vfat  uid=1000,noauto,users,exec  0  0  
/dev/sdd1                                  /media/sdd1     vfat  uid=1000,noauto,users,exec  0  0  
/dev/sdb1                                  /media/sdb1     vfat  uid=1000,noauto,users,exec  0  0

以下是内容sudo fdisk -l

nazar_art@nazar-desctop:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x000e28b8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   310484991   155241472   83  Linux
/dev/sda2       310487038   312580095     1046529    5  Extended
/dev/sda5       310487040   312580095     1046528   82  Linux swap / Solaris

Disk /dev/sdb: 4009 MB, 4009754624 bytes
16 heads, 32 sectors/track, 15296 cylinders, total 7831552 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: 0xd8e1f237

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          32     7831551     3915760    b  W95 FAT32

Disk /dev/sdd: 7751 MB, 7751073792 bytes
255 heads, 63 sectors/track, 942 cylinders, total 15138816 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: 0xc3072e18

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *          63    15138815     7569376+   7  HPFS/NTFS/exFAT

更新:

输出sudo blkid /dev/sdd1

nazar_art@nazar-desctop:~$ sudo blkid /dev/sdd1
/dev/sdd1: UUID="E6C05CB9C05C9223" TYPE="ntfs" 

问题:

  • 为什么会发生这种情况(在 Windows 上这个 USB 运行正常)?
  • 如何解决这个烦恼呢?

答案1

当 Linux 尝试挂载你的 USB 驱动器时,它会尝试以与 blkid 相同的方式猜测正确的文件系统(此例中为 NTFS),除非你告诉它使用特定的文件系统,如下所示/etc/fstab

/dev/sdd1    /media/sdd1    vfat    uid=1000,noauto,users,exec  0  0

注意第一列和第三列!

您可以使用 mount 命令手动解决此问题:

sudo mount -t auto /dev/sdd1 /media/sdd1

一种更简洁的方式是用设备 UUID¹、标签或 ID 替换所有实例/dev/sd*,因为后者对于每个设备或文件系统都是稳定的。前者按照 Linux 看到的顺序分配,这可能会发生变化,尤其是对于可移动媒体。

大多数情况下,您不想为可移动媒体分配固定的 fstab 条目,只想为计算机内的磁盘分配固定的 fstab 条目。

¹blkid或者palimpsest可以告诉你设备 UUID

请查看swap您或我的摘录中的一行/etc/fstab作为示例:

UUID=84747ef4-6f50-49bc-9df1-fcba364ba299  none    swap  sw    0  0

LABEL=root      /               ext4    errors=remount-ro,discard,noatime  0 1
LABEL=boot      /boot           ext4    defaults,discard,noatime    0       2
LABEL=usr       /usr            ext4    defaults,discard,noatime,data=writeback  0 2
LABEL=var       /var            ext4    defaults,user_xattr,data=writeback  0  2
tmpfs           /tmp            tmpfs   defaults,size=8g,nodev,nosuid,mode=1777  0 0
LABEL=swap1      none           swap    sw,discard,pri=100  0       0

UUID=d7662fe5-04fc-4b4b-a6e0-4d34637d56d3  /home  btrfs  defaults,compress=lzo,space_cache,inode_cache,noatime  0 2
LABEL=scratch   /mnt/scratch    ext4    rw,discard,noatime,data=writeback,user_xattr  0 2

# Windows partitions
LABEL=Windows7  /mnt/win7       ntfs    defaults,ro,nobootwait,noauto,noatime,nls=utf8,norecover,windows_names  0 0
LABEL=Windata   /mnt/windata    ntfs    defaults,ro,nobootwait,noauto,noatime,nls=utf8,norecover,windows_names  0 0

# dm-crypt partitions
UUID=82bf1677-acbf-41dd-814e-08652b2d325b  /home/david/media  crypto_LUKS.ext4  defaults,nobootwait,noauto,nosuid,nodev,noatime,data=writeback  0 0
UUID=d4f9d97c-0dd9-4ac8-959f-92818848505b  /mnt/winmedia  crypto_LUKS.ntfs  defaults,ro,nobootwait,noauto,noatime,nls=utf8,norecover,windows_names  0 0

相关内容