4/22/2019
Posted by 

In some versions of Android, and other variants of Linux, it's possible to get the serial number of a mounted SD card, e.g. by reading the contents of /sys/class/mmc_host/mmc0/mmc0:0001/serial or /sys/block/mmcblk0/device/serial (specific numbers may vary). In my testing this has worked pretty reliably, as long as the SD card is inserted in a built-in SD card slot (not mounted via USB adapter).

But as of Android 7.0 Nougat, the OS is said to be blocking access to this information, at least on some devices. I tested this by running a test app on a new Alcatel A30 GSM (Android 7.0), and in fact the above approach fails with a permission error:

For future reference, we (testing from an adb shell) have permissions to ls -ld the following:

  • /sys/class/mmc_host but not /sys/class/mmc_host/mmc0
  • /sys/block but not /sys/block/mmcblk0

Since the above approach no longer works,

I can retrieve the serial number of the secure digital card on the Pocketpc. Since you are trying to get the SD card serial number through a.

  • Is there another way to obtain the serial number of a mounted SD card in Android 7.0 or later?

  • Failing that, is there any documentation or other statement from Google on plans for providing or not providing this function? I haven't found anything in the Android issue tracker, but maybe I'm not searching right.

To make sure the question is clear, I'm talking about what an ordinary (non-system) app running on a non-rooted device can do, with any permissions that an app can normally request and receive.

FYI, the /sbin directory doesn't seem to be readable, so commands like /sbin/udevadm aren't an option.

LarsH
LarsHLarsH

4 Answers

In Android N access to /sys nad /proc was significantly restricted, this was done to provide stricter sandboxes where applications run. This is explained in https://issuetracker.google.com/issues/37091475 as intentional. Actually its not said that all the data in /sys is not accessible, and Google is open to allow access to other files from this location:

If there are specific files in /sys you believe should be available to applications, but are not, please file a new bug where the request can be evaluated. For instance, /sys/devices/system/cpu is available to all processes, so it's inaccurate to say all of /sys is restricted.

I have a bad feeling that google is making changes similar to Apple where it is not allowed to gain hardware id-s. If that is not resolved then the solution is to use google account IDs instead. But I am aware it is not always possible, and will require major changes in business logic (licensing etc.).

Hopefully your bug report will be considered positively. Adobe photoshop cs version 8.

another related SO I found : File system changes in Android Nougat

Community
marcinjmarcinj

Use StorageVolume.getUuid() on StorageVolume which you get from StorageManager.

The value is volume ID assigned during formatting of the card, and its length/format differs depending on file system type. For FAT32 it is XXXX-XXXX, for NTFS it's longer hex string, for Internal mass storage it returns null.

Pointer NullPointer Null

Block launcher pro android apk. try this: reference original link :Android get id of SD Card programmatically

Community
Vasudev VyasVasudev Vyas

adb shell cat /sys/class/mmc_host/mmc1/mmc1:*/cid

You can also try

sudo hwinfo --disk

to get information on your disks, including SD Cards.

Also try

sudo hdparm -I /dev/sdb more

ZedZed

Not the answer you're looking for? Browse other questions tagged androidsd-cardserial-number or ask your own question.

If you are having one of the below-listed problems on your SD card, it means that your SD card has got some tricky issues and you may even lose saved data in your card:

  • SD card is not recognized
  • SD card is not detected by PC, Android phone, camera or camcorder
  • SD card is not reading on cellphone, computer, camera or video player
  • SD card doesn't show up on PC, camera, Android phone, etc.

To find solutions to fix the SD card problems that you are having, you may first check and find how and why the detecting, recognizing issues occurred to your SD, SDHC, SDXC, Micro SD cards.

Why is SD Card Not Showing up

It is a common issue that SD is not showing up in Window PC. Check the list of possible reasons and you may find the exact reason that caused your SD card not showing up or recognized.

  • Poor contact between SD card and computer.
  • The drive letter of your SD card is missing.
  • The file system of the SD card is unrecognized or corrupted.
  • The device driver is outdated.
  • The SD card is infected with a virus.

These problems are not exclusive to PC users. Thus, it's really necessary for you to know how to solve these problems. The similar issue also occurs to Mac users now and then, you can follow this link: flash drive not showing up on Mac to get rid of this issue from your SD card on Mac.

Based on the reasons above, we have collected a list of solutions to fix this issue. You can try them one by one to repair corrupted memory card not detected, and no data loss will happen.

SOLUTIONS:
Solution 1. Test SD Card on Another PC or A New Card Reader
Solution 2. Change the Drive Letter of Unrecognized SD Card
Solution 3. Run CHKDSK to Make the SD Card Detectable
Solution 4. Update the SD Card Driver
Solution 5. Force SD Card to Show Up from Virus or Malware
Solution 6. Recover Data and Format SD card

Solution 1. Test SD Card on Another PC or A New Card Reader

Applies To: SD is not showing up, not reading issues

When you encounter this issue that the SD card or hard drive is not showing up on your PC, the first thing you should check is whether the SD card has a connection issue. Here, you’ll have two ways to test your unrecognized or undetectable SD card:

  • Change a new SD card reader or a new SD card USB adaptor
  • Connect the SD card to another PC

Then you can test your SD card and see if it shows up on your PC or not. If it does work with the new SD card reader or the new computer, then it’s not a faulty card. Your card reader should be faulty.

If your SD card neither works on the other PC nor the new card reader, the problem exists in your SD card. Read on and you'll find better solutions to resolve this problem.

Solution 2. Change the Drive Letter of Unrecognized SD Card

Applies To: SD is not showing up, reading or detected

If your SD card is connected to computer well but it fails to show up in File Explorer, you can go to Disk Management to see whether its drive letter is missing or disappearing.

If it's so, you can assign a new drive letter to your card and make it recognizable again with steps below:

  • Step 1: Press 'Windows' + 'R' at the same time to open Run dialogue.
  • Step 2: Input 'diskmgmt.msc' and press 'Enter' key to open Disk Management.
  • Step 3: Located the SD card, right-click the partition on it and select t 'Change Drive Letter and Path…'.
  • Step 4: In the pop-up window, click 'Add' to assign the drive letter to your SD card.

Solution 3. Run CHKDSK to Make the SD Card Detectable

Applies To: SD is not detected, recognized

Micro Sd Card Serial Number Check

  • Step 1: Right-click on My Computer/This PC and select 'Manage', click on 'Disk Management'.
  • Find the device in the drive viewer and check out whether the computer can detect your memory card or not.

If it is not detectable, continue the process with the CHKDSK command with the following steps.

  • Step 2: Press 'Win+R' keys > Type: cmd and hit Enter.
  • Step 3: Type: chkdsk D: / f and hit Enter. (D is the drive letter of your memory card).
  • Or you can type: chkdsk D:/f /offlinescanandfix and hit Enter.

This will check and fix the found errors in your memory SD card automatically and make the card detectable again.

Solution 4. Update the SD Card Driver

Applies To: SD is not working error

Adata Micro Sd Card Serial Number

Go to Device Manager, here you will see the card reader in the list. If it has a yellow sign beside it, the problem is most probably caused by a driver issue. Then you need to update the driver. Here's how to do:

  • Step 1: Connect the SD card to the PC
  • Step 2: Navigate Control Panel -> System -> Device Manager -> Disk drivers.
  • Step 3: Find and select your USB device, right click and first choose 'Uninstall' and then choose 'Scan for hardware changes' to refresh the drivers.

Solution 5. Force SD Card to Show Up from Virus or Malware

Applies To: SD is not working, reading

Sometimes, virus attack or malware may encrypt or even hide your SD card on Windows PC. You can run a virus cleaning software to clean up virus or malware on your SD card and PC. And follow the guidelines below to force SD card showing up:

  • Step 1: Plug in your SD memory card to your computer.
  • Step 2: Go to the start menu, type in 'cmd' in a search bar, hit enter and then you can see something named 'cmd. exe' under a list of programs.
  • Step 3: Right-click 'cmd. exe' and then you will get the command windows that allows you to recover virus infected files. Type in 'attrib -h -r -s /s /d drive letter:*.*', for example, 'attrib -h -r -s /s /d G:*.*'.

Solution 6. Recover Data and Format SD card for Reusing

Applies To: SD is not working or reading

If the SD card is still not working or recognized, or your SD card can be detected but you lost important files after trying all the methods above, we advise you to apply EaseUS disk data recovery to recover data from your SD card. Video forensic software free download. Then format the sd card to make it reusable again.

Tip
Only if your SD card can be detected in Disk Management, EaseUS Data Recovery Wizard will work for a fast data scanning and restoring.

To recover data from an SD card, follow these steps:

Stop using your SD card immediately once you lost files on it. Continuing using the card would hugely increase the chance of data overwriting, which makes data unrecoverable.

Step 1: Connect the SD card to PC

Insert the SD card to a card reader, and connect the card reader with your SD card to a healthy computer.

Step 2: Run SD card recovery software and scan the card.

  • Launch EaseUS Data Recovery Wizard on your PC and select your SD card under theExternal Devices column.
  • Then click Scan to start finding lost data on your SD card now.
Number

Step 3: Check found SD card data.

After the scanning process, you can preview and find your lost SD card files from below listed tabs:

  • Deleted Files: List your deleted files there.
  • Drive X: All lost files can be found here.
  • Lost Partition Files: Check first if it's for formatted recovery.
  • Extra Files: Finds files that lost names or paths.

And you can use Filter and Search to quickly find your files.

Step 4: Restore SD card data.

  • You can check and preview found files by double-clicking each one of them.
  • Then click Recover to save found SD card files to a secure location on your PC or an external storage.

After restoring and saving the SD card to another secure location on your PC, you can then format your SD card and convert the file system to FAT32 or NTFS, make it available for saving data again.