Solve the conflict between the virtual SD card and the real SD card in the Android system!

Source: Internet
Author: User

Solve the conflict between the virtual SD card and the real SD card in the Android system!

Because of the evolution of the mobile phone storage concept, the expression of the virtual SD card and the real SD card in Android4.1 and 4.2 is a bit complicated, as follows:

The virtual SD card is called the mobile phone storage in the system settings. It is also called the built-in SD card. It is also expressed as/sdcard,/mnt/sdcard, or/storage/sdcard0 in the system directory structure, it has the advantage of good compatibility and fast speed, but limited space cannot be expanded at will;
The real SD card is called the SD card in the system settings. It is often called an external SD card, the system directory is also expressed as/sdcard,/sdcard-ext,/mnt/sdcard2, or/storage/sdcard1. If the capacity is large, you can choose one of them, but there are old applications that are not compatible with each other, the disadvantage of low speed;

This also leads to various usage problems. For example, a large game data packet cannot be placed in the virtual SD card directory due to its large capacity, but it will cause the game to find no data packets.

By modifying/system/etc/vold. the fstab file swaps internal and external cards by modifying the ing between directories and hardware devices. Although simple, there are various problems, such as incompatibility with some applications, failure after refresh system, restart of each swap, and confusion in the application, an incorrect storage location is found for an application, which wastes internal storage space, reduces system running speed, and is incompatible with certain models!

In fact, many software programs, such as amap navigation 5.X, support manual or automatic specifying of map directories. The camera of Android4.1 will also store photos on the real SD card, easyVoiceRecorder, CallRecorder, and other software support custom storage directories. What should we do for large game data packets and applications that cannot customize storage directories?

After repeated consideration, in order to adapt to large-scale game applications, the advantages of the virtual SD card and the real SD card do not affect the read/write performance, make sure that the directory structure of the real SD card is clean and tidy, and the system can be changed at any time during operation to avoid modifying vold. fstab has caused various problems. I decided to return to the source, adopt the earliest practice, and best suit the Linux habits-use the self-starting script to map the directory to solve this problem!

The method is as follows:

(Take the dictionary file directory mapped to ColorDict in Android4.1 as an example)

1. Download and install Script_Manager;
2. Create the dictdata folder (the dictionary file directory of ColorDict) in the root directory of the/storage/sdcard0 (Virtual SD card) and/storage/sdcard1 (real SD card) partitions );
3. open Script_Manager, enter the root directory of the/storage/sdcard1 partition, "menu"-"New"-"New script", and enter the script name as "sdmnt. sh. The open mode interface is displayed in the form of a text editor;
4. Enter and save the following content in the Text Editor:

#! /System/bin/sh
Mount-o bind/storage/sdcard1/dictdata/storage/sdcard0/dictdata

5. Press "back", find "sdmnt. sh" in the file list, and click;
6. on the displayed page, select "Su" and "Boot", click "save", and then click "Run" to take effect immediately, you will find that the/dictdata of the virtual SD card points to the real SD card/dictdata. In fact, the real SD card is used for reading and writing. To add other directory ing, you only need to edit sdmnt. sh file. Do not restart after editing. Execute the command to take effect immediately.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.