Mount

新格式化的 USB 儲存設備,無法掛載

  • July 18, 2017

我剛買的便宜的 USB 驅動器有問題。這是我到目前為止所做的。

首先,在檢查了它的設備 ID 之後,我擦除了它:

$ sudo dd status=progress if=/dev/zero of=/dev/sdi
4027441664 bytes (4.0 GB, 3.8 GiB) copied, 1334 s, 3.0 MB/s    
dd: writing to '/dev/sdi': No space left on device
7866369+0 records in
7866368+0 records out
4027580416 bytes (4.0 GB, 3.8 GiB) copied, 1462.23 s, 2.8 MB/s

然後我在上面創建了一個分區:

$ sudo fdisk /dev/sdi

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xd899fea4.

Command (m for help): n
Partition type
  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-7866367, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-7866367, default 7866367): +2G

Created a new partition 1 of type 'Linux' and of size 2 GiB.

然後我把它變成了 FAT:

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help):

然後我創建了第二個分區:

Command (m for help): n
Partition type
  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (2-4, default 2): 
First sector (4196352-7866367, default 4196352): 
Last sector, +sectors or +size{K,M,G,T,P} (4196352-7866367, default 7866367): 

Created a new partition 2 of type 'Linux' and of size 1.8 GiB.

然後我也做了FAT:

Command (m for help): t
Partition number (1,2, default 2): 
Partition type (type L to list all types): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

然後我使第二個分區可啟動:

Command (m for help): a
Partition number (1,2, default 2): 

The bootable flag on partition 2 is enabled now.

然後我在檢查一切正常後保存了它:

Command (m for help): p
Disk /dev/sdi: 3.8 GiB, 4027580416 bytes, 7866368 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
Disklabel type: dos
Disk identifier: 0xd899fea4

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdi1          2048 4196351 4194304    2G  c W95 FAT32 (LBA)
/dev/sdi2  *    4196352 7866367 3670016  1.8G  c W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

然後我創建了文件系統:

$ sudo mkfs.vfat /dev/sdi1
mkfs.fat 4.1 (2017-01-24)
$ sudo mkfs.vfat /dev/sdi2
mkfs.fat 4.1 (2017-01-24)

然後我嘗試安裝它們,這就是我發現問題的地方:

$ sudo mount /dev/sdi1 /mnt/1
$ sudo mount /dev/sdi2 /mnt/2
mount: wrong fs type, bad option, bad superblock on /dev/sdi2,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

如您所見,我無法掛載第二個分區。所以首先我檢查了 /mnt/2 確實存在:

$ tree /mnt
/mnt
├── 1
├── 2
├── 3
└── laura

4 directories, 0 files

然後我嘗試改回可引導標誌,但無濟於事:

$ sudo fdisk /dev/sdi

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): a
Partition number (1,2, default 2): 

The bootable flag on partition 2 is disabled now.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

$ sudo umount /mnt/1
$ sudo partprobe
$ sudo mount /dev/sdi1 /mnt/1
$ sudo mount /dev/sdi2 /mnt/2
mount: wrong fs type, bad option, bad superblock on /dev/sdi2,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

接下來,我嘗試更改分區類型:

$ sudo umount /mnt/1
$ sudo fdisk /dev/sdi

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): t
Partition number (1,2, default 2): 
Partition type (type L to list all types): 83

Changed type of partition 'W95 FAT32 (LBA)' to 'Linux'.

Command (m for help): t
Partition number (1,2, default 2): 1
Partition type (type L to list all types): 83

Changed type of partition 'W95 FAT32 (LBA)' to 'Linux'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

並創建了 ext4 文件系統:

$ sudo mkfs.ext4 /dev/sdi1
mke2fs 1.43.4 (31-Jan-2017)
/dev/sdi1 contains a vfat file system
Proceed anyway? (y,N) y
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 25ddfdac-d7eb-4c00-b0fe-c58a46cfac17
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

$ sudo mkfs.ext4 /dev/sdi2
mke2fs 1.43.4 (31-Jan-2017)
/dev/sdi2 contains `ISO-8859 text, with very long lines, with no line terminators' data
Proceed anyway? (y,N) y
Creating filesystem with 458752 4k blocks and 114688 inodes
Filesystem UUID: 5cdf13ed-453a-4947-9a5e-84b32a426648
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

請注意,據報導,/dev/sdi2 不是 vfat 文件系統,而是包含“ISO-8859 文本,行很長,沒有行終止符數據”。

當我嘗試掛載分區時,它們都不起作用:

$ sudo mount /dev/sdi1 /mnt/1
mount: wrong fs type, bad option, bad superblock on /dev/sdi1,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

$ sudo mount /dev/sdi2 /mnt/2
mount: wrong fs type, bad option, bad superblock on /dev/sdi2,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

所以我決定改變它們的尺寸。為了做到這一點,我刪除了分區並再次創建了不同大小的分區:

$ sudo fdisk /dev/sdi

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-7866367, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-7866367, default 7866367): +128M

Created a new partition 1 of type 'Linux' and of size 128 MiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): n
Partition type
  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (2-4, default 2): 
First sector (264192-7866367, default 264192): 
Last sector, +sectors or +size{K,M,G,T,P} (264192-7866367, default 7866367): 

Created a new partition 2 of type 'Linux' and of size 3.6 GiB.

Command (m for help): p
Disk /dev/sdi: 3.8 GiB, 4027580416 bytes, 7866368 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
Disklabel type: dos
Disk identifier: 0xd899fea4

Device     Boot  Start     End Sectors  Size Id Type
/dev/sdi1         2048  264191  262144  128M 83 Linux
/dev/sdi2       264192 7866367 7602176  3.6G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

現在我創建了他們的 ext4 文件系統:

$ sudo mkfs.ext4 /dev/sdi1
mke2fs 1.43.4 (31-Jan-2017)
Creating filesystem with 131072 1k blocks and 32768 inodes
Filesystem UUID: 6ddbd9b9-590d-4566-9bd7-542fe208d3e3
Superblock backups stored on blocks: 
   8193, 24577, 40961, 57345, 73729

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

$ sudo mkfs.ext4 /dev/sdi2
mke2fs 1.43.4 (31-Jan-2017)
/dev/sdi2 contains `Lotus unknown worksheet or configuration, revision 0x0' data
Proceed anyway? (y,N) y
Creating filesystem with 950272 4k blocks and 237568 inodes
Filesystem UUID: 496ff913-1af7-4b9f-942a-29ae431cc9b2
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

同樣,請注意 /dev/sdi2 據稱如何包含“Lotus 未知工作表或配置,修訂 0x0 數據”

當我嘗試掛載分區時,出現了同樣的問題:

$ sudo mount /dev/sdi1 /mnt/1
$ sudo mount /dev/sdi2 /mnt/2
mount: wrong fs type, bad option, bad superblock on /dev/sdi2,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

然後我嘗試將它們的類型改回 FAT 並創建 fat 文件系統:

$ sudo umount /mnt/1
$ sudo fdisk /dev/sdi

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): t
Partition number (1,2, default 2): 1
Partition type (type L to list all types): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): t
Partition number (1,2, default 2): 
Partition type (type L to list all types): c

Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

$ sudo mkfs.vfat /dev/sdi1
mkfs.fat 4.1 (2017-01-24)
$ sudo mkfs.vfat /dev/sdi2
mkfs.fat 4.1 (2017-01-24)

然後,當我嘗試安裝它們時,猜猜是什麼:

$ sudo mount /dev/sdi1 /mnt/1
$ sudo mount /dev/sdi2 /mnt/2
$ echo "hello" | sudo tee /mnt/2/hi
hello
$ cat /mnt/2/hi
hello

噠噠噠!有用!

然而,我需要分區具有其原始大小。有任何想法嗎?這是硬體問題嗎?這個USB是不是太糟糕了?

我安裝了Michel Machado 的f3 工具。當我使用 Arch Linux 時,我做了:

$ cd /tmp
$ git clone https://aur.archlinux.org/f3.git
$ cd f3
$ makepkg -si

然後我用 f3probe 測試了這個 U 盤是否真的是假的:

$ sudo f3probe /dev/sdi
F3 probe 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
        it can take longer. Please be patient.

Probe finished, recovering blocks... Done

Bad news: The device `/dev/sdi' is a counterfeit of type limbo

You can "fix" this device using the following command:
f3fix --last-sec=473913 /dev/sdi

Device geometry:
            *Usable* size: 231.40 MB (473914 blocks)
           Announced size: 3.75 GB (7866368 blocks)
                   Module: 4.00 GB (2^32 Bytes)
   Approximate cache size: 1.00 MB (2048 blocks), need-reset=no
      Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 42.34s

它是:(感謝Bob Eager為我指明了正確的方向!另請參閱此相關問題

我懷疑它是一個流氓USB,對自己的容量有誇大的想法。獲取一個程序來測試這個東西,以確保多個邏輯塊沒有映射到同一個物理塊上。

不幸的是,其中大多數似乎是 Windows 程序:

https://www.raymond.cc/blog/test-and-detect-fake-or-counterfeit-usb-flash-drives-bought-from-ebay-with-h2testw/

但這只是通過快速Google。我看到了這個,雖然我沒有嘗試過:

https://fixfakeflash.wordpress.com/2010/08/20/linux-h2testw-alternative-program-called-f3-by-michel%C2%A0machado/

引用自:https://unix.stackexchange.com/questions/379165