我的安卓手机上有一张 32Gb 的微型 SD 卡。它用作外部硬盘。
现在我想格式化 SD 卡以便在另一部手机上使用,但似乎无法格式化。
我尝试过格式化但没有成功:
- 用旧手机
- 用新手机
- 使用 gparted
- 带磁盘
- 使用 dd 命令
- 手动删除项目
shift+delete
- 使用窗户(因为..谁知道呢)
这些都不起作用。我仍然保留着 SD 卡中的所有文件。
错误
Gparted:
我看到一个带有感叹号的橙色三角形:
Fat problem while decoding 2 0
Streamcache allocation problem:: 2
Fat problem while decoding 2 0
Streamcache allocation problem:: 2
Unable to read the contents of this file system!
Because of this some operations may be unavailable.
The cause might be a missing software package.
The following list of software packages is required for fat32 file system support: dosfstools, mtools.
我已经安装了 dosfstools 和 mtools。
dd 命令:
使用命令
sudo dd if=/dev/zero of=/dev/sdb1 bs=512 count=16
进而
sudo dd if=/dev/zero of=/dev/sdb1 bs=1M
结果出现了一堆类似的错误:
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992321] sd 13:0:0:0: [sdb] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992331] sd 13:0:0:0: [sdb] Sense Key : Medium Error [current]
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992337] sd 13:0:0:0: [sdb] Add. Sense: Peripheral device write fault
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992344] sd 13:0:0:0: [sdb] CDB: Write(10) 2a 00 00 01 05 28 00 00 f0 00
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992348] blk_update_request: I/O error, dev sdb, sector 66856
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992355] buffer_io_error: 230 callbacks suppressed
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992360] Buffer I/O error on dev sdb1, logical block 64808, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992368] Buffer I/O error on dev sdb1, logical block 64809, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992371] Buffer I/O error on dev sdb1, logical block 64810, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992394] Buffer I/O error on dev sdb1, logical block 64811, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992397] Buffer I/O error on dev sdb1, logical block 64812, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992401] Buffer I/O error on dev sdb1, logical block 64813, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992405] Buffer I/O error on dev sdb1, logical block 64814, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992408] Buffer I/O error on dev sdb1, logical block 64815, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992419] Buffer I/O error on dev sdb1, logical block 64816, lost async page write
Jan 10 00:30:41 asus-ux305fa kernel: [34628.992423] Buffer I/O error on dev sdb1, logical block 64817, lost async page write
最后一个
Jan 10 00:31:36 asus-ux305fa kernel: [34683.849080] usb-storage 1-1:1.0: USB Mass Storage device detected
Jan 10 00:31:36 asus-ux305fa kernel: [34683.849160] scsi host14: usb-storage 1-1:1.0
Jan 10 00:31:37 asus-ux305fa kernel: [34684.847904] scsi 14:0:0:0: Direct-Access Mass Storage Device 1.00 PQ: 0 ANSI: 0 CCS
Jan 10 00:31:37 asus-ux305fa kernel: [34684.848611] sd 14:0:0:0: Attached scsi generic sg1 type 0
Jan 10 00:31:37 asus-ux305fa kernel: [34684.961392] sd 14:0:0:0: [sdb] 61405184 512-byte logical blocks: (31.4 GB/29.2 GiB)
Jan 10 00:31:37 asus-ux305fa kernel: [34684.961692] sd 14:0:0:0: [sdb] Write Protect is off
Jan 10 00:31:37 asus-ux305fa kernel: [34684.961698] sd 14:0:0:0: [sdb] Mode Sense: 03 00 00 00
Jan 10 00:31:37 asus-ux305fa kernel: [34684.961971] sd 14:0:0:0: [sdb] No Caching mode page found
Jan 10 00:31:37 asus-ux305fa kernel: [34684.961978] sd 14:0:0:0: [sdb] Assuming drive cache: write through
Jan 10 00:31:37 asus-ux305fa kernel: [34684.964368] sdb: sdb1
Jan 10 00:31:37 asus-ux305fa kernel: [34684.965321] sd 14:0:0:0: [sdb] Attached SCSI removable disk
Jan 10 00:31:37 asus-ux305fa kernel: [34685.137339] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853595] sd 14:0:0:0: [sdb] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853606] sd 14:0:0:0: [sdb] Sense Key : Medium Error [current]
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853611] sd 14:0:0:0: [sdb] Add. Sense: Peripheral device write fault
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853617] sd 14:0:0:0: [sdb] CDB: Write(10) 2a 00 00 00 08 01 00 00 01 00
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853622] blk_update_request: I/O error, dev sdb, sector 2049
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853628] buffer_io_error: 470 callbacks suppressed
Jan 10 00:32:33 asus-ux305fa kernel: [34740.853633] Buffer I/O error on dev sdb1, logical block 1, lost async page write
为什么我无法格式化这张 SD 卡?
编辑:更正第一个命令中的拼写错误
@roboboykm:
这是没有锁的微型 SD。按照您评论中的说明操作,结果如下:
fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 31.4 GB, 31439454208 bytes
256 heads, 63 sectors/track, 3807 cylinders, total 61405184 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: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 61405183 30701568 c W95 FAT32 (LBA)
Command (m for help): d
Selected partition 1
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 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)
Syncing disks.
我试过 partprobe,但它也不起作用。重新启动系统也无济于事。
答案1
您使用了:
sudo dd if=/dev/zero of=//dev/sdb1 bs=512 count=16
但你应该使用:
sudo dd if=/dev/zero of=/dev/sdb bs=512 count=16
sdb1
在第一个实例中使用处理第一个分区。
在第二个实例中使用sdb
处理包含分区表的第一个扇区MBR
。分区表清零后,gparted
即可用于创建新分区。
附注:如果你对一个可以确保你永远不会sda
意外运行 dd 的包装脚本感兴趣,请参阅此内容(防止`dd`破坏SSD或HDD) 我上周写的脚本。
答案2
假设 SD 卡开关处于解锁位置
您可以使用 fdisk 命令
sudo fdisk /dev/sdx
Type the following parameters (each followed by <ENTER>):
**p** [lists the current partitions]
**d** [to delete existing partitions. Repeat this until no unnecessary partitions are reported by the 'p' command to start fresh.]
**p** [to check if any partition left]
**n** [create a new partition]
**p** [create a primary partition - use for both partitions][create a primary partition - use for both partitions]
**1** [the first partition]
**20480** [starting at offset sector]
<Press Enter key > [using the default value will create a partition that extends to the last sector of the media]
**p** to check the partition
**w** [write]
sudo mkfs.vfat /dev/sdx1
其中 x 可以用你得到的设备替换,例如 sdc 或 sdb