2

I have this 32Gb micro SD card that was on my android phone. It was working as an external HD.

Now I want to format the SD card to use with another phone, but it seems impossible to format.

I've tried to format without success:

  • with the old phone
  • with the new phone
  • with gparted
  • with disks
  • with dd command
  • manually deleting items with shift+delete
  • with windows (because..who knows)

None of this worked. I still have all the files in the SD.

Errors

Gparted:

I see an orange triangle with the exclamation mark:

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.

I have dosfstools and mtools installed.

dd command:

Used the commands

sudo dd if=/dev/zero of=/dev/sdb1 bs=512 count=16

and then

sudo dd if=/dev/zero of=/dev/sdb1 bs=1M

the result were a bunch of similar errors:

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

with the last one

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

Why I can't format this SD card?

edit: correct typo in the first command

@roboboykm:

It is a micro SD with no lock. Following the instruction in your comment here the results:

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.

I've tried partprobe but it is not working either. Rebooting the system doesn't help too.

2 Answers2

1

You used:

sudo dd if=/dev/zero of=//dev/sdb1 bs=512 count=16

But you should have used:

sudo dd if=/dev/zero of=/dev/sdb bs=512 count=16

Using sdb1 in the first instance processes the first partition.

Using sdb in the second instance processes the first sector containing the MBR and the partition table. After the partition table is zeroed then gparted can be used to create new partitions.

On a side note if you are interested in a wrapper script that ensures you never run dd on your sda by accident see this (Prevent `dd` from destroying SSD or HDD) script I wrote last week.

  • That's correct, I found also a typo in the command. However I did the command with sdb but it is not working at all. It's like for some reason nothing can write on the SD card. – overkill22 Jan 11 '17 at 08:43
0

Assuming that sd card switch is at unlocked position

you can use fdisk command

 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

Where x can be replaced by device you get like sdc or sdb

  • I've added the results in the main question – overkill22 Jan 11 '17 at 08:38
  • @Alessio try the edited steps – roboboykm Jan 11 '17 at 11:52
  • @Alessio use sudo before fdisk command or work as root , also find in /dev/ what partition name has come like sdx1 – roboboykm Jan 11 '17 at 12:00
  • there is a typo in the 20480 should be only 2048. I followed your instructions, and this message came out 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.

    As I mentioned above, I did alredy a test with partprobe with no results.

    – overkill22 Jan 12 '17 at 19:31