HOW TO MOUNT an SD card - Android Software/Hacking General [Developers Only]

I want to know what clockworkmod did after refermatting
What device do I use
mkdir mnt/c
mkdir mnt/d
mou mount -o rw,remount -t ?????????????? /mntc
I'm hardly a command line unix user but without knowledge of the exact device
I'm never ever going to succeeed
PLEASE ANSWER I'm hoping for an echo of the mounted file system
ext 3 /ext 4
PLease Help

Related

using the internal memory as a virtual sdcard

I managed to break my micro sd card in half today and I wasn't able to pickup a class 10 or 6 replacement locally so I thought I could use some of the 6gb of internal memory as a virtual filesystem to get me out of trouble.
So, after quickly looking at the android docs and the supported busybox commands I created a 2gb sdcard.img in /data and mounted to /sdcard. I copied some files to it with astro filemanager and fired up raging thunder 2 and it went ahead and downloaded the game data to /sdcard/ and worked correctly.
But, a few apps won't recognise it as an sdcard (Motorola SD card and phone storage settings applet) as well as things like PlayPro (states I have no sdcard present). I thought perhaps I could modify the /etc/vold.fstab file to auto mount the sdcard.img I created using vi but I'm a bit clueless as to what I should change on the dev_mount /sdcard line to get it automounted at boot and hopefully fool the rest of the apps into thinking it is a physical sdcard.
Can anyone possibly point me in the right direction? Not sure how to invoke cmd mode in vi using the milestone qwerty either but I'll keep digging.
What I did (roughly), maybe I'm going about it wrong but any advice would be appreciated.
1. rooted device
2. installed the free terminal app from the market
3. fired up the terminal shell
4. su
5. dd if/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=2000000
6. busybox mkfs.vfat /data/sdcard.img (didn't seem to support -F 32)
7. busybox mount -o loop /data/sdcard.img /sdcard/
+ 1 for this, it would be great to can use internal storage for user data
Why do you let this nice post die.. so "flibbulator" found anything more out?.. I'd like to know more.. like if you got it to work with Music Players and Video players??
Try to mount /data/sdcard.img to /mnt/sdcard (/sdcard is a link to /mnt/sdcard)
or try "export EXTERNAL_STORAGE /sdcard"
I made in a different way: created a 4GB storage.img in /data and mounted it in /sdcard/storage, so internal storage is finally usable for user data
the problem was to set mount point on boot, I can't find a way to execute a script on boot (you can't permanently modify init.rc)
flibbulator said:
What I did (roughly), maybe I'm going about it wrong but any advice would be appreciated.
1. rooted device
2. installed the free terminal app from the market
3. fired up the terminal shell
4. su
5. dd if/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=2000000
6. busybox mkfs.vfat /data/sdcard.img (didn't seem to support -F 32)
7. busybox mount -o loop /data/sdcard.img /sdcard/
Click to expand...
Click to collapse
I have actually tried this on my Droid2Global, and I get the error "unknown operand if/dev/zero" I feel like I am missing the point or do not fully understanding how to use the "dd" command?
the correct syntax is:
dd if=/dev/zero of=/data/sdcard.img bs=1024 count=4194340
4194340 --> 4GB
patton82 said:
the correct syntax is:
dd if=/dev/zero of=/data/sdcard.img bs=1024 count=4194340
4194340 --> 4GB
Click to expand...
Click to collapse
Thank you bro.
Quick question I keep getting these errors. I do have a folder in "/" named "sdcard-int"
Better Terminal Emulator Pro
/ # busybox mount -o loop /data/sdcard.img /sdcard-int/
mount: can't setup loop device: No such file or directory
/ # busybox mount -o /data/sdcard.img /sdcard-int
mount: can't read /etc/fstab: No such file or directory
/ #
Sent from my DROID2 GLOBAL using Tapatalk
you can't place anything in root folder, /sdcard is a link to /mnt/sdcard and is created by init.rc (you can't edit init.rc, it's provided by boot.img, so need to extract from boot.img and repack)
I made in this way but I have to manually execute a script or a command from terminal after every boot to mount storage.img
mkdir /sdcard/storage
su
dd if=/dev/zero of=/data/storage.img bs=1024 count=4194340
busybox mkfs.vfat /data.storage.img
mount -o loop -t vfat /data/storage.img /sdcard/storage
Will be lost anything after reboot when use this storage?
Sent from my MotoA953 using XDA App
all the stuff in img file will not be lost, as long as you put it in /data/
on the contrary the mount point must be restored after reboot
patton82 said:
you can't place anything in root folder, /sdcard is a link to /mnt/sdcard and is created by init.rc (you can't edit init.rc, it's provided by boot.img, so need to extract from boot.img and repack)
I made in this way but I have to manually execute a script or a command from terminal after every boot to mount storage.img
mkdir /sdcard/storage
su
dd if=/dev/zero of=/data/storage.img bs=1024 count=4194340
busybox mkfs.vfat /data.storage.img
mount -o loop -t vfat /data/storage.img /sdcard/storage
Click to expand...
Click to collapse
Thank you, I will use the Thank you button when I login via PC.
I still get the same error, I know that I'm doing something incorrectly or maybe I don't understand "mount" comment correctly?
/ $ su
/ # mkdir /sdcard/storage
/ # dd if=/dev/zero of=/data/storage.img bs=1024 count=41943404194340+0 recordsn
4194340+0 records out
4295004160 bytes (4.0GB) copied, 339.823883 seconds, 12.1MB/s
/ # busybox mkfs.vfat /data/storage.img
/ # mount -o loop -t vfat /data/storage.img /sdcard/storage
mount: can't setup loop device: No such file or directory
/ #
I am using my sdcard also, I'm not too sure if that makes any difference?
Sent from my DROID2 GLOBAL using Tapatalk
Better terminal pro uses BASH shell, I presume
try to switch to android shell, in preferences
or to use terminal emulator (free) from market
Okay, I tried Android Terminal Emulator, and this is a new error.
export PATH=/data/local/bin:$PATH
$ $ su
# mount -o loop -t vfat /data/storage.img /sdcard/storage
ioctl LOOP_SET_FD failed: Device or resource busy
#
Not too sure where to go now. I thank you again for all your help, and time.
Sent from my DROID2 GLOBAL using Tapatalk
resource busy, you have to reboot the phone
I use Gscript lite, add a script with the string
mount -o loop -t vfat /data/storage.img /sdcard/storage
and create a shortcut to homescreen, so when I reboot, I can mount the img file in one click
Cool mod for my ROM. Could I take it??
sure, they are simple shell commands
the best would be to do what happen with Samsung Galaxy S: internal storage mounted as sdcard and physical sdcard mounted in a folder /sdcard/sd
storage.img is 3-4 times faster than my peak 8GB class 6
There is an application "Autostart" in the market, which can automatially execute a script with root after boot up.
I up because I'm now also interested in making profit of the huge internal storage. I'd like to put my wikipedia data from wikidroyd to the internal storage. Hopefully I'm skilled enough to follow the given steps...I doubt that though
fKngFtd said:
Okay, I tried Android Terminal Emulator, and this is a new error.
export PATH=/data/local/bin:$PATH
$ $ su
# mount -o loop -t vfat /data/storage.img /sdcard/storage
ioctl LOOP_SET_FD failed: Device or resource busy
#
Not too sure where to go now. I thank you again for all your help, and time.
Click to expand...
Click to collapse
Guys, I need your help! I have exactly. The same problem:
Every time I try to mount my storage.img I get
Ioctl LOOP_SET_FD failed: Device or resource busy.
I rebooted several times and also tried to mount smaller images (first I tried 3gb then I tried 1mb).
Any solution?
Edit: I solved it myself. I always forgot to punch in busybox before the command. Now it worked for me!!
I do have a question now. With help of Gscript I made a shortcut to mount the storage.img to my sdcard. But my pc wont recognise the sdcard as long as the image is mounted. What is the command to unmount the partition so I wouldnt have to reboot my phone before connecting it to the pc...?
Any help is much appreciated! Thx
(Something like busybox unmount -o loop -t vfat...?)
Sent from my MotoA953 using XDA App

Sometimes impossible to mount system partition ?

How to explain that it is impossible to mount the system partition in recovery ? Should I format my sd card to correct that ?
the /system/ files do not reside in your sd card. They are stored in your phone. Are able to boot up your phone at all? If so you can mount it via a terminal app. You might also need busybox installed. At the terminal type the following
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system

[Q] Apps can't see mounted ext4 partition.

On my previous HTC phones, I was able to mount an ext4 partition simply by doing:
Code:
mount -o remount,rw /
mkdir /storage/sdcard3
mount -o remount,ro /
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard3
Problem is, I can only see the files in terminal. None of the other apps can see anything, even with root access. Anyone been able to do this successfully on this phone?
Bump. From the terminal, I see no reason why this shouldn't work. I've mounted with the same options as other partitions, and even used chmod and chown to modify permissions to be identical to those in other mounts. I'm not sure if this is a KitKat issue, or something HTC has done to the ROM itself.
I've been able to do this on both my Incredible and Rezound, both with stock and AOSP ROMs. I'm really stumped why I can't get this working on my M8.

[Completed] Cyanogenmod 12 and 2nd partition in Sdcard

Any one can tell me what I make round. I have cyanogenmod with one sdcard with 2 partitions the first is mount with ext4 and the second I try fat32 ext4 ext3 ...
I no found fuse.ko in the system but internal partition and storage is mount with fuse in /storage/....
I try to mount the second partition by many difference ways . Always is mount and show up
I copy files from internal memory or sdcard first partition to the second partition
But if I try to open the files I got permission errors . Very possible is a Selinux problem but I have in permissive mode
I look with rootexplorer and files a copy in the 2nd partition in the sdcard for the owner only can read or write
Any ideas how to make the correct mounts for the 2nd Partition on SD card
I make a simple script for make test that is the last configuration I make but still only the owner can read or write that means any app can't open the files if is not root
that is the configuration I use
#!/system/bin/sh
# Mount SD Card Ext4 Script
mkdir /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/vold/179:66 /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
chown media_rw:media_rw /storage/sdcard2
chmod g+w /storage/sdcard2
ln -s /storage/sdcard2 /mnt/media_rw/sdcard2
ln -s /storage/sdcard2 /mnt/sdcard2
chown media_rw:media_rw /mnt/sdcard2
chmod g+w /mnt/sdcard2
Hi there,
I'm sorry but I can't find anything related to your question.
Please post that in the forum bellow for more answers from the experts:
> Android Development and Hacking > Android Q&A, Help & Troubleshooting
Good luck

Mount external partition using rooted Z3 with locked bootloader

Hello.
I just started messing around with my Z3 and so far followed the tutorial here https://forum.xda-developers.com/z3-compact/general/recovery-root-mm-575-lb-t3418714 to install root and recovery without unlocking the bootloader. Also took the chance to make a backup of the ta partition.
My objective was being able to mount an external ext4 partition so I could move game data and free some internal space. I believe the official kernel doesn't support init.d so I searched and found a script that worked and added it to the bottom of init.qcom.post_boot.sh.
Code:
### Init.d support ###
busybox run-parts /system/etc/init.d/
It's a very simple script that creates /sd-ext folder if it's missing and mounts /dev/block/mmcblk1p2 there
Code:
#!/system/bin/sh
#
# mounts ext partition from sd card
if [ ! -d /sd-ext ];
then
mount -o rw,remount /
install -m 774 -o 1000 -g 1000 -d /sd-ext
mount -o ro,remount /
fi
if [ ! -d /sd-ext ];
then
echo sd-ext not created >> /data/Test.log
else
mount -o rw -t ext4 /dev/block/mmcblk1p2 /sd-ext
fi
It was something that I got on some forum plus some trial and error and some Linux knowledge I have.
It seemed to work. The directory was created and mounted and I was able to move the games there using Titanium Backup.
But after I rebooted, the folder was there and all the data, but the apps don't show up on the apps list. I have to reinstall them...
Am I missing something? How can I fix this?

Categories

Resources