How to repair an SD card which shows incorrect size?
Solution 1
You have overwritten the card's partition table.
Most consumer embedded devices require a BIOS (PC) partition table, and I'll guess that your phone is such a device. My experience is with cameras; I guess that a phone is probably similar. I'll also assume, that unlike my cameras, the phone doesn't have a 'reformat memory card' action hidden in its menus somewhere.
# cfdisk /dev/sdc
should enable you to re-partition the media (interactively, with no writes until you explicitly okay it). You probably want to create one partition, using all the space.
Having done that, you should find that /dev/sdc1
appears (hdparm -z
may be your friend if not), and it's time to create a filesystem on it. Again guessing, I think you'll probably want a VFAT filesystem, unless your device's manual says otherwise:
# mkfs -t vfat /dev/sdc1
Now all that's left is to restore the data from the backup you made before you started meddling. ;-)
Solution 2
Your card doesn't work because it doesn't have any filesystem. You can use GParted to create one.
In the GParted window choose /dev/sdc
. Use appropriate menu option to create new MS-DOS partition table (GParted may automatically prompt you to do it). Then create new partition using entire available space. Click Apply and wait until the process completes. After that your card should be working just fine.
Solution 3
You can try a low level reformat. Download the format program from http://sdcard.org/downloads/formatter_4. Set the "Format Size Adjustment" option on
. This will re-flash the card irrespective of the filing system – or lack thereof – on the card.
Solution 4
Perhaps this utility - F3 by Digirati will be of use. I can not test it at the moment but among other things it promises:
f3probe is the fastest way to identify fake drives and their real sizes. f3fix enables users to use the real capacity of fake drives without losing data. f3brew helps developers to infer how fake drives work. f3probe, f3fix, and f3brew currently runs only on Linux.
Related videos on Youtube
frankborty
Updated on September 18, 2022Comments
-
frankborty over 1 year
I'm new on WPF and I'm tryng to figure out how to implement a binding with different type of user control. After the user clicks a button, a usercontrol (a simple shape like rectangle or ellipse) is added to the window.
I'm tryng to use an MVVM approach so the xaml appears as follow:
... Title="{Binding Path=Titolo}" Height="450" Width="800" d:DataContext="{d:DesignInstance vm:MainWindowViewModel}"> <Canvas> <Button Content="Add Shape" Command="{Binding TestCommand}"/> <ItemsControl ItemsSource="{Binding RectCollection}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <uc:MyCustomRectangle/> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.ItemContainerStyle> <Style> <Setter Property="Canvas.Left" Value="{Binding xLT}" /> <Setter Property="Canvas.Top" Value="{Binding yLT}" /> </Style> </ItemsControl.ItemContainerStyle> </ItemsControl> </Canvas>
All works fine but I want to add different type of UserControl (not only MyCustomRectangle) using the same button (for example, randomly adding rectangle or ellipse). A possible solution could be duplicate the section of ItemsControl and select a different collection of binding:
<Canvas> <Button Content="Add Shape" Command="{Binding TestCommand}"/> <ItemsControl ItemsSource="{Binding RectCollection}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <uc:MyCustomRectangle/> <!-- bind to my usercontrol --> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.ItemContainerStyle> <Style> <Setter Property="Canvas.Left" Value="{Binding xLT}" /> <Setter Property="Canvas.Top" Value="{Binding yLT}" /> </Style> </ItemsControl.ItemContainerStyle> </ItemsControl> <ItemsControl ItemsSource="{Binding EllipseCollection}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <uc:MyCustomEllipse/> <!-- bind to my usercontrol --> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.ItemContainerStyle> <Style> <Setter Property="Canvas.Left" Value="{Binding xLT}" /> <Setter Property="Canvas.Top" Value="{Binding yLT}" /> </Style> </ItemsControl.ItemContainerStyle> </ItemsControl> </Canvas>
I don't think this is the correct solution, especially because I would to add many different types of shapes (and also text and images). So, if exist, what is the correct way to bind a data template to different type of usercontrol? Is MVVM the correct approach to solve this problem?
-
gronostaj over 10 yearsIs it still available under
/dev/sdc
? -
Jjames over 10 yearsYou successfully wiped your SD card (you overwrote everything with zeros). If there was important data on it you might want to contact a data recovery company near you (note: they will most likely not be able to help you). You just need to create a new partition and format it, gParted would be the easiest answer.
-
archer over 10 yearsMan, I didn't have any data on that card. I'm just saying that after this operation my card is not recognizabl at all. Trying to access
/dev/sdc
saysNo medium found
. -
naught101 about 9 yearsWhen you do
sudo hdparm -I /dev/sdc
, do you see aSG_IO: bad/missing sense data ...
message? If so, you might want to check superuser.com/a/774673/48920, askubuntu.com/a/498797/41567 and/or dedoimedo.com/computers/low-level-formatting.html -
Alexander M about 4 yearsCan you use a different sd reader instead of your phone, and see if that works? I personally wouldn't trust a smartphone to be a usb sd reader if I'm fiddling around with partitions (but just moving files around is fine). Or you could try partitioning with the phone itself instead of through it, if you're on android. github.com/LegacyXperia/Wiki/wiki/… (this should give you the gist of what to do, but it's not a 1:1 guide for any android phone, except xperia phones.
-
-
Jjames over 10 yearsPlease correct me, but wouldn't a filesystem check need a filesystem to begin with? But according to OPs descriptions it's completely wiped. And booting a LiveCD just to format an SD Card is a little bit overkill.
-
archer over 10 yearsAs I already said there are no partitions, previously (when it was recognized)
fdisk -l
shown it's total size is 6Gb. However card is 16Gb in size. -
archer over 10 yearsAs I already stated, when I try to access
/dev/sdc
it saysNo medium found
-
gronostaj over 10 yearsAccess how? Have you tried the steps above?
-
archer over 10 yearsAs I said above initially my 16Gb been accessible as 6Gb card. After
dd if=/dev/zero of=/dev/sdc
I've got in completelly unaccessible. MeansNo medium found
. -
gronostaj over 10 yearsNo medium found when you try to do what? To "access" device is a very broad term.
-
archer over 10 yearsActually I'm looking for Linux alternative of this app.
-
gronostaj over 10 yearsYou don't have any partitions on your card, that may be the reason why both those commands fail. Have you actually tried the steps I have provided?
-
archer over 10 yearsMan, neither gparted nor fdisk sees my sd-card.
-
brotich over 9 yearsgparted should work
-
archer about 9 yearsthe problem is that
cfdisk /dev/sdc
is impossible as my system does not see /dev/sdc (it completely stopped to recognize that card as external storage device). -
Toby Speight about 9 yearsIf you can't drive it at all with
hdparm
or any partition editor, it's possible that your card reader is interpreting the empty blocks as "no card". At this stage, I'd try a different card reader - perhaps borrow a USB one from a friend? -
Toby Speight over 3 yearsIf you can't drive it at all with
hdparm
or any partition editor, it's likely that your phone is interpreting the empty blocks as "no card". At this stage, I'd try using a dedicated card reader - perhaps borrow a USB one from a friend?