Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fill up disk space in android device

I want to fill my device disk space with any dump data as part of stress testing.

I tried writing bytes into a file in external storage; obviously larger & more spacious the disk is longer it will take to get filled. [approx half a minute for 1GB]

Can we do anything from adb shell in this case? I checked creating dump data using dd command:

dd if=/dev/zero of=/tmp/tempFiller.deleteMe bs=1024 count=$COUNT

which basically copies dump data to destination file Hence it also takes significant time. [approx 1 minute for 1GB]

Is there any faster approach? for a normal user / super user?

I also tried fallocate, truncate & mkfile commands in adb shell, but none of these commands are found even inside su. I guess these are bash commands & installing bash shell in Android device will require the device to be rooted.

fallocate -l 10G gentoo_root.img
truncate -s 10M output.file
mkfile 10240m 10Gigfile
like image 276
jQueen Avatar asked Jul 15 '14 11:07

jQueen


People also ask

What fills up internal storage on Android?

Miscellaneous files can come in all forms on your phone's internal storage. Such files could relate to a number of aspects of your phone, including apps or your system. Because of this, you shouldn't just clear all your miscellaneous files, as tempting as that may be if they're taking up a lot of space.

How do I manage low disk space on my phone?

On an Android phone, go to Settings > StorageIf you drill down into the category, you can delete individual files or data. For example, under “Audio,” long-press on one or more files and tap Delete. Or under “Apps,” tap the app's name and then Uninstall to remove it from your phone.


2 Answers

I tried same thing in past. My purpose was filling all memory on device. After experiments I found out that dd is the best way for writing big files. My best speed was when I used 1MB for block size. I used 100MB files in order to have ability to balance free space on device.

Writing 100MB file:

dd if=/dev/zero of=myfile.dat bs=1048576 count=100

Also for quick experiments I've used written free app FillMemory

like image 149
0x8BADF00D Avatar answered Sep 22 '22 07:09

0x8BADF00D


1GB in half a minute (30 seconds) is a write speed of over 30MB/s. Considering that the external storage on most Android devices these days is actually a Secure Digital flash card, that speed could very well be the maximum speed supported by either the card or the card interface of your device.

If using dd with a moderate block size (e.g. bs=1M) does not improve things, then chances are that you have just reached the limits of your current hardware.

like image 44
thkala Avatar answered Sep 20 '22 07:09

thkala