You are not logged in.

#1 2017-01-12 19:58:06

overkill22
Member
Registered: 2016-01-16
Posts: 47

I can't format a SD anymore, not even with dd.

Hi guys,
I'm here asking your help because I know that you're the best community that could help with this problem.
I'm not very linux savvy so if you're suggesting me something, please provide the steps and/or the command.

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. The only thing that happened was that I was transferring some files from the phone with the SD in to my laptop, the process hanged and I pull out the cable. Then the SD stopped working, I still see all my data there, I can copy the data but I can't delete or create anything else.

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.

here some info, if you need more please let me know what to do:

$sudo lshw
*-disk
             description: SCSI Disk
             physical id: 0.0.0
             bus info: scsi@2:0.0.0
             logical name: /dev/sdb
             size: 29GiB (31GB)
             capabilities: partitioned partitioned:dos
             configuration: sectorsize=512
           *-volume
                description: Windows FAT volume
                vendor: android
                physical id: 1
                bus info: scsi@2:0.0.0,1
                logical name: /dev/sdb1
                logical name: /media/alessio/8437-130A
                version: FAT32
                serial: 8437-130a
                size: 29GiB
                capacity: 29GiB
                capabilities: primary bootable fat initialized
                configuration: FATs=2 filesystem=fat mount.fstype=vfat mount.options=rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro state=mounted
$sudo 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): 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

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-61405183, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-61405183, default 61405183): 
Using default value 61405183

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   83  Linux

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.
$sudo partprobe /dev/sdb
Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.

I've used `testdisk` and played around a bit with no results.

I really don't know what's wrong with this card.
Thank you in advance for your help smile

EDIT: I'm using Linux Mint 17.3 Cinnamon

Last edited by overkill22 (2017-01-12 21:14:01)

Offline

#2 2017-01-12 20:12:35

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: I can't format a SD anymore, not even with dd.

Just a shot in the dark:  There is a little slide on the side - "Lock | Unlocked" - is it Locked?


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2017-01-12 20:24:15

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Sector11 wrote:

Just a shot in the dark:  There is a little slide on the side - "Lock | Unlocked" - is it Locked?

Good question.
It is a micro SD so it doesn't have the lock. BUT I noticing that:

1. when I use an SD adapter it doesn't see the SD (I've tried with 2 adapters):

$sudo lshw
description: SCSI Disk
             product: Card  Reader
             vendor: Multiple
             physical id: 0.0.0
             bus info: scsi@6:0.0.0
             logical name: /dev/sdb
             version: 1.00
             serial: AU6485
             capabilities: removable
             configuration: ansiversion=4 sectorsize=512
           *-medium
                physical id: 0
                logical name: /dev/sdb

while with an USB adapter it "works". So definitely it's not the lock.

Offline

#4 2017-01-12 20:39:36

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

Have you tried:

sudo hdparm -r0 /dev/sdb

Offline

#5 2017-01-12 20:43:17

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: I can't format a SD anymore, not even with dd.

^ Ninja'd by the best!

Hmmm, my two macro-SD adaptors all have the "Lock|Unlock" switch.

OK, so not the lock ... I'm stumped.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2017-01-12 20:51:39

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Head_on_a_Stick wrote:

Have you tried:

sudo hdparm -r0 /dev/sdb
$sudo hdparm -r0 /dev/sdb

/dev/sdb:
 setting readonly to 0 (off)
 readonly      =  0 (off)

Then I did the fdisk process as before and the result was different:

The partition table has been altered!

Calling ioctl() to re-read partition table.

Error closing file

and still, nothing happened. sad



Sector11 wrote:

^ Ninja'd by the best!

Hmmm, my two macro-SD adaptors all have the "Lock|Unlock" switch.

OK, so not the lock ... I'm stumped.

You're right, the macro-SD do have the Lock (mine was always UNLOCK), but the USB adapter doesn't have. Since I can't see the micro SD with the macro-SD adapter, I always used the USB adapter.

Last edited by overkill22 (2017-01-12 20:53:52)

Offline

#7 2017-01-12 20:59:37

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

Any error messages if you try to mount the device?

sudo mount /dev/sdb1 /mnt

Remember to `umount` the device before removing it:

sudo umount -R /mnt

You may have to switch to a TTY (with <Ctrl>+<Alt>+F3) before plugging the device and running those commands to stop thunar (the file manager) from attempting to auto-mount the stick.

Offline

#8 2017-01-12 21:08:54

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

By the way, which operating system is this?

The desktop envirnoment (or window manager) in use should probably also be posted.

Offline

#9 2017-01-12 21:11:46

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Head_on_a_Stick wrote:

Any error messages if you try to mount the device?

sudo mount /dev/sdb1 /mnt

Remember to `umount` the device before removing it:

sudo umount -R /mnt

You may have to switch to a TTY (with <Ctrl>+<Alt>+F3) before plugging the device and running those commands to stop thunar (the file manager) from attempting to auto-mount the stick.

in TTY with

sudo mount /dev/sdb1 /mnt

it says

/dev/sdb1 is not a block device

EDIT: added operating system in the first post (Linux Mint 17.3 Cinnamon)

Last edited by overkill22 (2017-01-12 21:13:43)

Offline

#10 2017-01-12 21:15:10

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

What about dmesg(8)?

Open a terminal window and run this command:

dmesg -w

If you are using kernel >4.8 then you will probably have to run that command as root.

Then plug in the device and post any (extra) output that appears in the terminal window afterwards.

Offline

#11 2017-01-12 21:20:05

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Head_on_a_Stick wrote:

What about dmesg(8)?

Open a terminal window and run this command:

dmesg -w

If you are using kernel >4.8 then you will probably have to run that command as root.

Then plug in the device and post any (extra) output that appears in the terminal window afterwards.

invalid option

Offline

#12 2017-01-12 21:23:56

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

overkill22 wrote:

invalid option

Hmmm, is that all that appears after you run `dmesg -w`?

You should see a terminal full of kernel messages:

2017_01_12_212246_640x458_scrot.png

If the "-w" flag is not recognised, use this and look for the correct "follow" option:

dmesg --help

Offline

#13 2017-01-12 21:27:54

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Head_on_a_Stick wrote:
overkill22 wrote:

invalid option

Hmmm, is that all that appears after you run `dmesg -w`?

You should see a terminal full of kernel messages:

https://s23.postimg.org/xjr9afw6f/2017_01_12_212246_640x458_scrot.png

If the "-w" flag is not recognised, use this and look for the correct "follow" option:

dmesg --help

These are the options I have:

Usage:
 dmesg [options]

Options:
 -C, --clear                 clear the kernel ring buffer
 -c, --read-clear            read and clear all messages
 -D, --console-off           disable printing messages to console
 -d, --show-delta            show time delta between printed messages
 -E, --console-on            enable printing messages to console
 -f, --facility <list>       restrict output to defined facilities
 -h, --help                  display this help and exit
 -k, --kernel                display kernel messages
 -l, --level <list>          restrict output to defined levels
 -n, --console-level <level> set level of messages printed to console
 -r, --raw                   print the raw message buffer
 -s, --buffer-size <size>    buffer size to query the kernel ring buffer
 -T, --ctime                 show human readable timestamp (could be 
                             inaccurate if you have used SUSPEND/RESUME)
 -t, --notime                don't print messages timestamp
 -u, --userspace             display userspace messages
 -V, --version               output version information and exit
 -x, --decode                decode facility and level to readable string

Supported log facilities:
    kern - kernel messages
    user - random user-level messages
    mail - mail system
  daemon - system daemons
    auth - security/authorisation messages
  syslog - messages generated internally by syslogd
     lpr - line printer subsystem
    news - network news subsystem

Supported log levels (priorities):
   emerg - system is unusable
   alert - action must be taken immediately
    crit - critical conditions
     err - error conditions
    warn - warning conditions
  notice - normal but significant condition
    info - informational
   debug - debug-level messages

Offline

#14 2017-01-12 21:29:49

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

^ tsk...

Well, just plug in the stick and run this command immediately afterwards:

dmesg | tail

This will show the last 10 lines of the kernel ring buffer.

Offline

#15 2017-01-12 21:30:40

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

I used the -k option:

[  351.401180] scsi 2:0:0:0: Direct-Access     Mass     Storage Device   1.00 PQ: 0 ANSI: 0 CCS
[  351.401692] sd 2:0:0:0: Attached scsi generic sg1 type 0
[  351.514455] sd 2:0:0:0: [sdb] 61405184 512-byte logical blocks: (31.4 GB/29.2 GiB)
[  351.514644] sd 2:0:0:0: [sdb] Write Protect is off
[  351.514649] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
[  351.514818] sd 2:0:0:0: [sdb] No Caching mode page found
[  351.514822] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[  351.516800]  sdb: sdb1
[  351.517670] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[  351.697749] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

Offline

#16 2017-01-12 21:31:28

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

overkill22 wrote:
[  351.697749] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

I think we have an answer smile

Offline

#17 2017-01-12 21:32:05

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

$dmesg | tail
[  351.514822] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[  351.516800]  sdb: sdb1
[  351.517670] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[  351.697749] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  379.880112] sd 2:0:0:0: [sdb] FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  379.880121] sd 2:0:0:0: [sdb] Sense Key : Medium Error [current] 
[  379.880124] sd 2:0:0:0: [sdb] Add. Sense: Peripheral device write fault
[  379.880128] sd 2:0:0:0: [sdb] CDB: Write(10) 2a 00 00 00 08 01 00 00 01 00
[  379.880132] blk_update_request: I/O error, dev sdb, sector 2049
[  379.880137] Buffer I/O error on dev sdb1, logical block 1, lost async page write

Offline

#18 2017-01-12 21:32:54

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,068
Website

Re: I can't format a SD anymore, not even with dd.

Yeah, looks like the card is dead or dying sad

Offline

#19 2017-01-12 21:33:30

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

Head_on_a_Stick wrote:
overkill22 wrote:
[  351.697749] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

I think we have an answer smile

Yes, definitely it is.
I've been trying with fsck yesterday with no luck. But I probably did not use the correct commands.

Offline

#20 2017-01-12 21:35:13

overkill22
Member
Registered: 2016-01-16
Posts: 47

Re: I can't format a SD anymore, not even with dd.

This is what fsck is keep on telling me: Both FATs appear to be corrupt. Giving up.

Offline

Board footer

Powered by FluxBB