mksdcard
Stay organized with collections
Save and categorize content based on your preferences.
Use the mksdcard
tool to create a FAT32 disk image that you can load into
emulators running different Android Virtual Devices (AVDs) to simulate the presence
of the same SD card in multiple devices.
The mksdcard
tool provided in the Android SDK Tools package
is located in android-sdk/emulator/mksdcard
.
If you don't need a disk image that can be shared
among multiple virtual devices, you don't need to use the mksdcard
command.
By default, the emulator uses the default image that is generated by and stored with the
active AVD instead.
Usage
To use the mksdcard
tool, use the following command:
mksdcard -l label size file
Options
The following table describes the command-line options of mksdcard
:
Option |
Description |
-l label |
A volume label for the disk image to create |
size |
An integer that specifies the size of the disk image to create.
If size is a simple integer, it specifies the size in bytes. You can also
specify the size in kilobytes, megabytes, or gigabytes by appending K, M, or G
to size. For example, 1048576K or 1024M . The
minimum size is 9M. The Android emulator cannot use smaller images. The maximum size is
1099511627264 bytes, which equates to 1023 GB.
|
file |
The path/filename of the disk image to create relative to the current working directory.
|
Example
Create the mySdCardFile.img
disk image:
mksdcard -l mySdCard 1024M mySdCardFile.img
Start two emulators with different AVDs. Use the -sdcard
flag to specify the name
and path of the disk image you created:
emulator -avd Pixel_API_25 -sdcard mySdCardFile.img
emulator -avd NEXUS_6_API_25 -sdcard mySdCardFile.img
For more information about the
emulator
command and its options,
see
Start the emulator from the command line.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-04-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-12 UTC."],[],[],null,["# mksdcard\n\nUse the `mksdcard` tool to create a FAT32 disk image that you can load into\nemulators running different Android Virtual Devices (AVDs) to simulate the presence\nof the same SD card in multiple devices.\n\n\nThe `mksdcard` tool provided in the Android SDK Tools package\nis located in \u003cvar translate=\"no\"\u003eandroid-sdk\u003c/var\u003e`/emulator/`\u003cvar translate=\"no\"\u003emksdcard\u003c/var\u003e.\n\n\nIf you don't need a disk image that can be shared\namong multiple virtual devices, you don't need to use the `mksdcard` command.\nBy default, the emulator uses the default image that is generated by and stored with the\nactive AVD instead.\n\n### Usage\n\n\nTo use the `mksdcard` tool, use the following command:\n\n```\nmksdcard -l label size file\n```\n\n### Options\n\nThe following table describes the command-line options of `mksdcard`:\n\n| Option | Description |\n|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `-l `\u003cvar translate=\"no\"\u003elabel\u003c/var\u003e | A volume label for the disk image to create |\n| \u003cvar translate=\"no\"\u003esize\u003c/var\u003e | An integer that specifies the size of the disk image to create. If \u003cvar translate=\"no\"\u003esize\u003c/var\u003e is a simple integer, it specifies the size in bytes. You can also specify the size in kilobytes, megabytes, or gigabytes by appending K, M, or G to \u003cvar translate=\"no\"\u003esize\u003c/var\u003e. For example, `1048576K` or `1024M`. The minimum size is 9M. The Android emulator cannot use smaller images. The maximum size is 1099511627264 bytes, which equates to 1023 GB. |\n| \u003cvar translate=\"no\"\u003efile\u003c/var\u003e | The path/filename of the disk image to create relative to the current working directory. |\n\n### Example\n\n\nCreate the `mySdCardFile.img` disk image: \n\n```\nmksdcard -l mySdCard 1024M mySdCardFile.img\n```\n\n\nStart two emulators with different AVDs. Use the `-sdcard` flag to specify the name\nand path of the disk image you created: \n\n```\nemulator -avd Pixel_API_25 -sdcard mySdCardFile.img\nemulator -avd NEXUS_6_API_25 -sdcard mySdCardFile.img\n```\nFor more information about the `emulator` command and its options, see [Start the emulator from the command line](/studio/run/emulator-commandline)."]]