[HOWTO] Copy/Move files TO/FROM internal memory/SD Card (Root & SU Needed) - Xoom Q&A, Help & Troubleshooting

Install Root Explorer and grant it Super User permissions. It appears Super User permissions is the key to writing to the SD card.
With SU permissions, Root Explorer can create/mv/delete/etc files/directories on the SD card. More importantly, Root Explorer also allows copying/moving files between the sd card and internal memory.
If you allow terminal emulator to have SU powers, you can delete (RM) files, move (MV) files (only within the SD card), create (MKDIR) and delete (RMDIR) directories from the command line within terminal.
I found that Astro couldn't create/delete/copy files because it didn't have SU powers on my Xoom. (How do you get Astro into the Super User app list?)
In terminal emulator on my Xoom
cat proc/mounts returns the following
/dev/block/vold/179:1 /mnt/external1 vfat rw,dirsync,relatime,uid=1000,gid=1023,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
Doesn't this mean that the SD card should be RW to all apps?

this is my problem as well ....
Why do u need root to write to SD card???
This is crazy

Interesting issue. I hadn't noticed until you pointed it out, and as you state, it doesn't make sense.
Thread moved to QA. Hopefully someone can figure out why.
Also, there's no way to give ASTRO root. The app has to be coded to request SU access.

Actually, the issue is with the fmask=0702, as that masks out write capability from the permissions. Use the following to remount as RW:
adb shell or any other terminal emulator to get to a shell on the xoom
su to get to the # prompt
umount /mnt/external1
mount -t vfat -o fmask=0000,dmask=0000,rw /dev/block/platform/sdhci-tegra.2/mmcblk0p1 /mnt/external1
That remounts the sdcard without using vold, which is enforcing a mask on the permissions.
I was thinking about writing a script/widget to remount it easily, but I don't know if it's a waste of time...

ekarelis said:
Actually, the issue is with the fmask=0702, as that masks out write capability from the permissions. Use the following to remount as RW:
adb shell or any other terminal emulator to get to a shell on the xoom
su to get to the # prompt
umount /mnt/external1
mount -t vfat -o fmask=0000,dmask=0000,rw /dev/block/platform/sdhci-tegra.2/mmcblk0p1 /mnt/external1
That remounts the sdcard without using vold, which is enforcing a mask on the permissions.
I was thinking about writing a script/widget to remount it easily, but I don't know if it's a waste of time...
Click to expand...
Click to collapse
Can you use vold with a different fmask/dmask?

shobirama said:
Can you use vold with a different fmask/dmask?
Click to expand...
Click to collapse
I didn't see a way to do it in the /etc/vold.fstab file, which is where I assume it goes. I just did this as a work around.

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

[Q] Can't mount /system as r/w

Have an HTC hero with CM7 stable. Been trying to modify sysctl.conf to increase the speed a little (if thats possible, CM7 is fast). I've used the command in ./adb shell and terminal emulator:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
When I type mount it displays /system as a r/w partition but I still can't edit the sysctl.conf file. When I do try to edit, the shell says that the directory doesn't exist (/ect/sysctl.conf).
Even with simpler commands like "adb pull /system/ect/sysctl.conf /" still come back as directory doesn't exist.
What am I doing wrong? Ultimately if I can want to get the sysctl file to my PC to edit and place back on the phone.
Have you tried using something like Root Explorer? While learning & knowing ADB comes in handy, I find most things are easier through Root Explorer. You can just copy the file to your SD card, then to your computer.
EDIT: On second look, you have /system/ect... instead of /system/etc...
I also believe it should be mtdblock4 instead of mtdblock3, but I could be wrong. I'm not good with this kind of stuff.
Type in mount to see what device is currently mounted as /system...I would just double check
Sent from my Droid using XDA App
This command should also work:
Code:
mount -w -o remount /system /system
I typed mount in cmd. Says that /system is in mtdblock3. I will try root explorer and see if it fixes my woes. Thanks.

[Q] Write, Execute Permissions

I have been googling far too long for an explanation of how to change the Read, Write, Execute options on individual system and data apps, when I remembed how fast someone usually answers my n00b questions here. It is not even clear to me what the differences are between the Write and Execute options. Can someone give me a link to a tutorial regarding this?
I did read the suggested threads, not helpful, and one I didn't understand about remounting the "entire /system partion to read-write".
thanks. d
To be more specific, I want to change the permission on certain system apps so I can uninstall them.
If your phone is rooted then you need a file manager that will remount the system partition as RW ( read write). Or you can use adb with your first command being adb remount.
Sent from my HTC Vision using XDA App
As ESKIMOn00b started to explain, the process of removing apps from the /system partition isn't a matter of individual file or folder permissions. Android secures the /system partition by preventing it from being written to under normal circumstances. If you have rooted your device then you have the ability to become the root user and run most if not all commands.
ADB provides a nice convenience command, 'adb remount', that will allow you to modify the /system partition. This command will only work if you have root user privileges but will unlock all of the apps for you to remove. Be careful though, you shouldn't just delete APK's directly out of /system/app as the package manager in Android might not keep up with your deletions. The best way to go about it (after remounting /system read/write) is to use the 'pm uninstall' command:
# pm uninstall com.myapp
To figure out the package names you can use 'pm list packages' and it will dump a huge list of all installed apps on the device. You'll need to hunt through and find the right ones. Most developers use obvious naming schemes such as Amazon's MP3 Store: com.amazon.mp3.
Hope this helps!
-ObsidianX
I have root and some recent experience w/the AndroidSDK. Using the SDK on my SonyEricsson phone:
c:\Users\dSpr> cd c:\AndroidSDK\tools
c:\AndroidSDK\tools>dir
{list}
c:\AndroidSDK\tools>adb devices
{0123456789ABCDEF device}
c:\AndroidSDK\tools>adb ls /system/app
{list}
c:\AndroidSDK\tools>adb shell
$ pm list packages
{list}
Note the shell command produces a $ instead of a #, but it still gives me a list.
But w/the $ and the command adb remount this:
$adb remount
adb remount
adb: permission denied.
If: tools>adb remount
This: remount failed; Operation not permitted
Same operation w/my QT7 and tools>adb shell produces a #. In fact, I don't even have to I don't have to use the adb remount command on my first uninstall, just
#rm /system/app/{app}.apk
#pm uninstall {package name}
I don't recall that I used the remount command between uninstalls-don't think I did or I would have noted it because I was keeping careful track of what I was doing. I can't test it because I have no apps on that device to uninstall.
Get the same result when using the terminal with the su command on the phone itself.
This is why I thought I had to change the Read/Write permissions.
What are you telling me that's not getting thru.
Thank you both very much.
d
to remount your system, you can try this
Code:
adb shell
Code:
su
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
hesperides said:
to remount your system, you can try this
Code:
adb shell
Code:
su
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
Click to expand...
Click to collapse
Nope. adb shell results in a $. su results in a su w/out the $ and after some (close to a minute) hesitation: Permission denied $
Debugging is on, as is mock locations. I am also having the exact same problem with my new enTourage Pocket eDGe, but it isn't that bothersome because it doesn't have a lot of garbage like the cell phone.
d

[a510] /system as rw

i am trying to mount /system as rw, but keep running into errors. my tab is rooted and i have superuser elite installed. i have tried from a terminal app from the su prompt (#mount -o remount,rw /system and variations of), from adb shell, and using adb remount, but always get an error. (permission denied, are you root?)
any suggestions?
secondly, i messed up my permissions on both /system and /etc, as i had a similar issue with permissions when i was trying to get root, but forgot to note what they were previous so that i could set them back. i set them both to 755 for now, but if someone could tell me what they are suppose to be that would be appreciated.
Rusty_Gunn said:
i am trying to mount /system as rw, but keep running into errors. my tab is rooted and i have superuser elite installed. i have tried from a terminal app from the su prompt (#mount -o remount,rw /system and variations of), from adb shell, and using adb remount, but always get an error. (permission denied, are you root?)
any suggestions?
secondly, i messed up my permissions on both /system and /etc, as i had a similar issue with permissions when i was trying to get root, but forgot to note what they were previous so that i could set them back. i set them both to 755 for now, but if someone could tell me what they are suppose to be that would be appreciated.
Click to expand...
Click to collapse
Hi,
Try :
adb shell
su
mount -o rw, remount /system
It work fine for me on adb shell and terminal emulator
The command adb shell remount doesn't mount /system as rw
thanks, that put me on the write track. turns out i was getting rw the whole time, but i didnt have write permissions. did chmod 777 /system and it worked, and when i was done i put it back to chmod 755 /system
if anyone has a similar problem, the command 'mount | grep /system' is a great way to check to see if you actually have it mount as rw or not.
before this i tried a couple of the remount apps, as well as the mount as 'rw' option in es file explorer and they always fail to mount, presumably they aren't failing to mount but are running into the same permission issue and can't write

[Q] Mounted folders appear empty

I'm trying to mount /data/data/ to /storage/sdcard0/data/test/ with the following via adb shell:
Code:
su
mkdir /storage/sdcard0/data/test
mount -o bind /data/data/ /storage/sdcard0/data/test/
When /storage/sdcard0/data/test/ is viewed within ES File Explorer or any other application, it appears empty. The file contents appear when listing the contents via adb shell. Why is this happening?
bump
Code:
su
mkdir /storage/sdcard[b]0[/b]/data/test
mount -o bind /data/data/ /storage/sdcard0/data/test/
Seems like the 0 was missing in the second line.
peachpuff said:
Seems like the 0 was missing in the second line.
Click to expand...
Click to collapse
Oops. That was a typo in the post. Folders still appear empty even with the 'missing' 0. Is there another cause?

Categories

Resources