Partitioning the filesystem on Android - android

I'm trying to re-partition an SDCard on Android, with root access.
I have the 512 byte MBR file, and it shows up as this:
Pos MBRndx Type/Name Size Active Hide Start Sector Sectors
--- ------ ---------- ---- ------ ---- ------------ ------------
0 0 0C-FAT32X 5.9G No No 64 12,124,096
1 1 0C-FAT32X 1.9G No No 12,124,160 3,932,160
What I'm trying to do is resize the 5.9GB partition into 3GB, and then make an EXT partition with the remaining space. I can think of two ways to do this, but I'm a bit stumped in doing either of them:
1) Cross-compile GNU parted, and run it on Android to modify the filesystem in place. This would be my preferred method, but I've been trying to statically compile parted using scratchbox and haven't had much luck, and I haven't been able to dynamically compile for Android in scratchbox either.
2) Directly modify the 512 byte MBR using some utility on my computer, and then dd the file on Android. I have a tool to view the MBR (mbrwiz), but I don't know how to edit it.
Does anybody have any suggestions for either, or possibly a third route?

Maybe I'm not seeing the problem, but it does not look like you want to automate this or make a program with that functionality. So, why not take the SD card out of the Android device and partition it in a card reader on your desktop machine? You could even do a full backup beforehand and avoid losing any data with the partitioning.

You could use fdisk instead of parted, as we used for years before the later tool came about.
Many of the android community roms include a busybox-based fdisk, which with care you could probably install without replacing the actual rom (which may not yet have a fully functional galaxy version)
Not sure how this helps the kernel changing it back problem. You could have a look in /init.rc and see if there's something you can comment out there (you would need to extract, modify, and reflash the ramdisk to make a change to that, splitting and recombining it from the kernel if they did it the same way as the htc phones)
It may also be possible to partition it with external tools when it's in usb mount mode - if the usb storage gadget just treats it as a sea of blocks, presumably you could put a partition table on it?

Related

How to change vendor.img contents with android emulator?

So, I have a custom AOSP image that I'm building, and it allows me to provide my own kernel and debugging features that I want (this is just for the record, because you can't do some things that are needed with a regular AVD). I need to change the contents of /vendor, and I thought that I could do this by providing my .img file to the emulator with:
emulator -vendor /path/to/my/vendor.img
But, as I checked, the md5sum does not match for some files between my vendor.img and in the /vendor/path/to/file when I run the emulator and connect with adb shell. This is perplexing to me, because when I run with -verbose, I can see the arguments given to qemu for the drive and I expect that img to be mounted under /vendor. Looking at the original vendor-qemu.img with 7z, I can check the md5sum of ome files and see that despite the -vendor argument, the sums did not change to the values in my img, but match the old intead. I even went to the length of renaming the original vendor-qemu.img and putting my img in it's place with the name vendor-qemu.img. Same result with the md5sums though.
Perhaps I could be wrong, and the -vendor emulator argument shouldn't change the contents of /vendor in the running emulator instance. What do I do to get the /vendor directory contents of a running emulator instance to match with the vendor.img?
The way I found to do it was to go to:
out/target/product/<lunch tgt>/vendor/
And just put the vendor contents the way you wish them to be. When finished do:
make vendorimage && make systemimage

What is the maximum size of DropBoxManager of Android system?

I study about DropBoxManager of Android platform for crash tracking and debugging my app.
I referred this article. https://developer.android.com/reference/android/os/DropBoxManager
It describes that "The queue is size bounded and will drop old data if the enqueued data exceeds the maximum size." But I cannot find how big it is. What is the maximum size of DropBoxManager? If it is depends on devices, I would like to know Samsung flagship devices - Galaxy S20, Galaxy Note 20, etc.
Please help me. I tried to find the information, but it is very how to find.
Thank you
I don't know the answer, here's what I've discovered so far
According to https://android.stackexchange.com/a/218147/31304 it's possible to set the value, quote:
"settings put global dropbox_max_files 9
If you are rooted (or via adb shell - thanks #Irfan Latif) you can issue the command above to limit dropbox files in that dir to 9 (or any other number you prefer). You will only see only latest n events, older get overwritten."
We can list the global settings, however I cannot see any mention of settings for dropbox.
adb shell settings list global
There's an old version of the Java code online e.g. https://code.yawk.at/android/android-9.0.0_r35/android/os/DropBoxManager.java however that doesn't include the implementation details.
https://gitlab.tubit.tu-berlin.de/justus.beyer/streamagame_platform_frameworks_base/blob/marshmallow-x86/services/core/java/com/android/server/am/ActivityManagerService.java

Possible to determine size of android apk to be installed?

I want to calculate the space the installed APK needs before the APK installs.
Is it possible?
yes it is possible , you can check this by simply taking ur apk and using analyse ANDROID STUDIO->BUILD->ANALYSE APK tool to see approximate size your apps would take and see exactly why ( available only in android 2.2 and above). and if you simply want to know your apk size,you can simply right click on it and see properties for size.However i like to consider +10% margin to consider space on target device just as buffer.
And if you are talking about space taken up by the data of resources your app will write onto the storage,then that totally depends on your to be stored data size and overheads of storing it
if your looking for phone memory resources stats, you should try using tools such as systrace and memory trace tools available in android studio and run your app on emulator or device to see real time usages

Does Android Virtual Device SD Card size consumes computer's HD space?

I am learning from the online tutorial to create a new Android Virtual Device. There isn't much written for the settings of the AVD.
Question 1) If I set the SD Card size to (say 2GB), does it literally "eats up" my computer's Harddisk space of 2GB by creating an image file of 2GB?
Question 2) If it does takes up my computer's HD space, in future when I create multiple AVDs, it will requires a lot of HD space am I right?
EDIT: So when I delete the created AVDs, does it free up my HD space immediately, or do I need to do a series of thing to do a "clean" AVD deletion?
Sorry for the addition question. Thank you for all your replies. I will undoubtedly vote up all your constructive solutions by tomorrow.
Yes, the harddisk space is immediately allocated.
# First, I created a new AVD device called 2gb-sdcard and an AVD
# device called no-sdcard (which uses the minimum size of 10MB)
# Both are same device type, SDK, skin, etc.
#
$ cd ~/.android/avd/2gb-sdcard.avd
$ du -h
2.4G .
$ cd ~/.android/avd/no-sdcard.avd
$ du -h
410M .
I checked the same even in Windows. I've Win7-64 and Confirm that the SDCard sizes mentioned for individual AVDs does occupy the hard disk space.
For e.g. I've created AVD NexusS_AVD19 with 100MB SD Card size and I've shown in the screen shot, the memory occupation.
Similarly I've created other AVDs with 1GB and 2GB SDCard sizes and similar details were available when I go to the respective path like : for e.g: C:\Users\RAMA\.android\avd\2GBSDcard.avd
and C:\Users\RAMA\.android\avd\1GBSDcard.avd...i could see the occupation.
In case, if you want single SDCard Image to be used for all the AVDs available to use your memory efficiently / smartly, please follow this link which guides you the steps to go through to achieve this with single SDCard Image
how-to-create-a-new-virtual-sd-card-in-emulator-in-android
Emulator uses .iso disk images to emulate SD card. So SD card consumes that space which you specified.
But in case you need a lot of emulators you can use for all of them a single image. Check this Loading an SD card image

Creating an image of an Android phone

Does anyone know how to create a 1:1 disk image of an Android phone? I am taking a forensics course and our final project involves creating tools to recover information from a suspect's Android based phone, however to do this we need to be able to create a 1:1 image of the phone's disk for baseline comparisons. Also would the image be loadable into AVD?
Take a look at nandroid — it will take a full image of each of an Android phone's partitions and return them to you as yaffs2 image files.
I haven't tried it personally, but you should be able to drop these directly into an AVD directory. I can imagine you may have some issues with the hardware suddenly "changing" between a physical device and emulator, but it's worth a try...
Check nandroid.
I have backed up my SDcard and mount it on AVD, but I am not completely sure you can mount the internal mem that nandroid backs up.

Categories

Resources