[Q] [HELP] Swap sdcard with sdcard-ext - Motorola Droid 4

I've edited vold.fstab so that sdcard and sdcard-ext are swapped. But this doesn't work on my XT894. Nothing happens in my case.
Then I found this topic.
In short, you run a script containing:
Code:
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:97 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:97 /mnt/sdcard
if busybox mount | busybox grep vold/179:97; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
After running this script the result is that both sdcard and scard-ext are in fact pointing to my external 32GB card. So in a way I'm happy. Now I can install games and all navigational maps without any hassle. But, I would like my internal 8GB of storage back. To do so I take it "something" has to be mounted to /mnt/sdcard-ext.
My Linux/Unix is of n00b quality so here I am asking for help :cyclops:
I've tried adding these two lines:
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:1 /mnt/sdcard-ext
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:1 /mnt/sdcard-ext
Hoping 179:1 pounted to the internal sdcard and /mnt/sdcard-ext would mount it at exactly that. But it didn't work.
Can anyone explain to me what these commands do? Why vfat and exfat? Is this done so that you always mount the correct filesystem? And what about the vold/179:xx? Does anyone know which one points to the internal sdcard on an XT894 running ICS?
Trust me, I've Googled all I can. I have tried several options, multiple scripts, but my lack of Linux/Unix knowledge is killing me.
Edit:
When I connect as USB Mass storage I get my internal 8GB back. It is accessible on the laptop. When I switch back to MTP it shows a different directory (maybe due to vold/179:1 !?). After I re-run the script sdcard is back to my external 32GB. For now this will do.
I will update later. Sygic is downloading 2GB of data. After that I will switch back and forth between USB M / MTP with and without running the script.
Edit 2
After I connect as MTP, Internal Storage seems to be pointing to an unknown space. There is an .android directory which I am unable to find on the phone.
When I switch to USBMS (from MTP) it seems to switch back to the original setup, sdcard 8GB and sdcard-ext 32GB.
When I disconnect the USB cable everything is back to normal. But, all I need to do is re-run the script and sdcard points back to my external SD.

Related

Is there a way to make apps use /sdcard/ApplicationData rather than /sdcard ?

Is there a way to make all applications store their data in a folder other than /sdcard (root folder on the sd card) ?
I'm planning on rooting and thought that this time round I can keep my sdcard nice and organized by creating an "ApplicationData" folder in the root of the sdcard and somehow configuring android to use that.
On a similar note, can I move the DCIM (camera photos) to a different location too?
Will the below change-mount-point idea work?
Maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData //change hdb0 to the appropriate device/partition
thanks.
Yeah, I see your point... but quite frankly, I believe it's upto the app developers [my knowledge of the Android world is still from the stone-age!!]... if the app specifies that it's data will be stored in /sdcard/AppName, there's not much you can do, unless you can modify the app...
I was thinking that maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData
edit: added to post#1
britoso said:
I was thinking that maybe as root we can
1) un-define /sdcard (in /etc/fstab) //or wherever its defined
2) define /sdcard as /dev/<hdb0>/ApplicationData
edit: added to post#1
Click to expand...
Click to collapse
I did think of this too...
/sdcard --> /sd/AppData
rest of sd card --> /sd
but I think it would mean some other changes as well... for example... the mount usb functionality would have to be modified to mount/unmount a different volume...
So heres the contents of my fstab file:
Code:
C:\>adb shell cat /system/etc/fstab
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mmcblk0p1 /sdcard vfat rw
/dev/block/mmcblk0p2 /system/sd auto rw
/system/modules/modules.sqf /system/modules squashfs ro,loop
/system/xbin/xbin.sqf /system/xbin squashfs ro,loop
I'll try changing line 4 (/sdcard), I'm guessing /system/sd is for when I apps2sd is enabled.
Question: How do I escape from INSERT/EDIT mode in VI? Tried pressing trackball+1, trackball+1+2...didnt work
Hey britoso!
Keep us updated with your accomplishments. I, personally, am very interested in being able to achieve this.
Good luck!
update: that didnt work.
Note: the way to get the ESCAPE character is CONTROL + [ (hold the trackball then press [ ). The control key is configurable and defaults to the Jogball/TrackBall
here are the contents of my fstab file, the camera app is still writing to the root of the sdcard (/sdcard/DCIM)
Code:
C:\>adb shell cat /system/etc/fstab
/dev/block/mtdblock3 /system yaffs2 rw
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/mtdblock5 /data yaffs2 rw
/dev/block/mmcblk0p1 /sdcard/AppData vfat rw
/dev/block/mmcblk0p2 /system/sd auto rw
/system/modules/modules.sqf /system/modules squashfs ro,loop
/system/xbin/xbin.sqf /system/xbin squashfs ro,loop
Heres the output of "df"
Code:
C:\>adb shell df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 197600 0 197600 0% /dev
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock3 148480 100088 48392 67% /system
/dev/block/mtdblock5 200960 63752 137208 32% /data
/dev/block/mtdblock4 97280 39628 57652 41% /cache
/dev/block//vold/179:1
15643712 6843256 8800456 44% /sdcard
@britoso
This is what I found out about mounts in Android...
The init program directly mounts all filesystems and devices using either hard-coded file names or device names generated by probing the sysfs filesystem (thereby eliminating the need for a /etc/fstab file in Android).
And from what I see in your df output, it didn't mount /sdcard/AppData...
Have a few ideas in mind... gonna try 'em out now...
craigacgomez said:
gonna try 'em out now...
Click to expand...
Click to collapse
thanks for the info. Let us know how it works out.
Here's what I reached finally...
To achieve this, I have 2 ideas...
1. We gotta modify the init and change the SD mount point to AppData and add another for the rest of the SD... this however would require a rebuilt ROM (I can't edit init on the phone, need to edit init.c from the source)
2. We push some startup scripts to achieve this, but so far, I haven't been able to mount anything else on /sdcard (operation failed), but I think I'm doing something wrong...
Didn't get much time to experiment... and it mite be a busy end of week for me... but I'll try to squeeze in so time to get this...
Why not ask Cyanogen to do this for us in his next ROM?
Or your next favorite modder?
I'm sure they'll like this idea!?
theres a setting in /init.rc that may help
Code:
export EXTERNAL_STORAGE /sdcard
However / is mounted read-only
mount
rootfs on / type rootfs (ro,relatime)
Click to expand...
Click to collapse

SDcard Issue...

Can someone explain how I can delete a file from the SDcard, yet still see it and open it on my drive in Windows? Also, why can't I see files placed on my SDcard from Windows until I reboot my device...
I created this script in attempt to fix the second issue, I think it works okay most of the time... Issue arise only if it can't unmount /sdcard successfully.
Code:
umount -f /dev/block/mmcblk0p1
mount -o rw,noatime,nodiratime,fmask=0000,dmask=0000,iocharset=iso8859-1,flush -t vfat /dev/block/mmcblk0p1 /sdcard

[9001]Mounting external SD Card as ext3

Hey,
I like to mount my external SD Card as ext3 to support large files. The SD Card is formatted with ext3 but now Android shows only an empty folder.
So i tried to remount the SD:
Code:
mount -o rw,remount -t ext3 /dev/block/vold/197:33 /mnt/sdcard/externald_sd
But it doesnt use something... Does anybody has an idea? Some Example or sthing else?
Greetz
FaxXer said:
Hey,
I like to mount my external SD Card as ext3 to support large files. The SD Card is formatted with ext3 but now Android shows only an empty folder.
So i tried to remount the SD:
Code:
mount -o rw,remount -t ext3 /dev/block/vold/197:33 /mnt/sdcard/externald_sd
But it doesnt use something... Does anybody has an idea? Some Example or sthing else?
Greetz
Click to expand...
Click to collapse
u need a kernel that supports ext3. u can ask one of the guys compiling at the moment if they have time to add an ext3 module for u.
May be a stupid question:
would ext4 work instead? I thought the system partition would use this FS.
filesystem is already ext4
wintel_mac said:
May be a stupid question:
would ext4 work instead? I thought the system partition would use this FS.
Click to expand...
Click to collapse
well the system uses ext4 so it should work, but i'm not sure what u're trying to achieve. i use a 16 gb class 10 formatted fat32
Blumdum said:
filesystem is already ext4
Click to expand...
Click to collapse
He's talking about formatting external sd-card
When I get him right, he has a file that exceeds the 4GB FAT32 limit.
So he looks for an alternative to FAT32, which might be some kind of ext*-FS.
wintel your right!
In the Android-Hilfe Forum someone said the system expect first an vfat partition and then the ext. I think thats wrong cause its not working but somehow it has to go.
Hmm should I write these mount command I postet in the init.rc? Or something else. Would be very nice if you post your ideas!
Thanks
init.rc+ ext3 module/object included in kernel
Hmm okay thats good but how do I use them? So I can read and write to my external sd card with an ext3 or ext2 partition.
Thanks
Come on guys where are the great developers?!
Ok I did a test with busybox inbuilt mount, but I tried only with an image.
Not with a real SD card! This worked for me:
On a linux box:
# dd if=/dev/zero of=/tmp/image bs=1M count=1k
# mkfs.ext4 /tmp/image
Copy file to your phone. Then:
On the phone with terminal:
# mkdir /sdcard/mmnt
# busybox mount -o loop /sdcard/image /sdcard/mmnt
To unmount:
# busybox umount -l /sdcard/mmnt
Anybody tried that?
If I understand u right u puting an image file (ext3/4) on the sd and mount that as a virtual disk. Wouldn't the image file be bound to the same restrictoins as other content on a fat32 file system? Like the 4 gig limit!
YOU WILL LOSE ALL DATA ON YOUR SDCARD IF YOUR FDISK
BACKUP WHATEVER IS ON THERE FIRST!!!
YOU'VE BEEN WARNED
using a photon 4g but....
what i did was get an external sdcard reader writer...
(used ubuntu) and let it mount
fdisk device and DELETE ALL PARTITIONS
write
fdisk again
create a linux primary type 83
type mount and grab the /dev/sdcX value (it was /dev/sdc1 for me)
umount that
then
mkfs.ext3 /dev/sdcX ... ( heres the thing though with cyanogen mod 7 kernel 2.6.32.9 SMP PREEMPT)
had to reboot twice for it to be seen in file manager...
its buggy but it does work for the most part
Reviving an old thread, but I just found that I can format a MicroSD under NTFS and it will work with Paragon's NTFS module. At the very least, my phone will mount the drive. I partitioned and formatted it with ext4 on my Linux machine and it didn't recognize it, but I did have it use the GUID partition table. Hoping to be able to load up some videos to take with me.
ext4 sdcard mount works
FaxXer said:
Hey,
I like to mount my external SD Card as ext3 to support large files. The SD Card is formatted with ext3 but now Android shows only an empty folder.
So i tried to remount the SD:
Code:
mount -o rw,remount -t ext3 /dev/block/vold/197:33 /mnt/sdcard/externald_sd
But it doesnt use something... Does anybody has an idea? Some Example or sthing else?
Greetz
Click to expand...
Click to collapse
The problem is with the shell interpreting the special character ":"
To make it work, first create a symlink to the device node:
Code:
ln -s /dev/block/vold/197\:17 /dev/sd2
Then mount it:
Code:
busybox mount /dev/sd2 /mnt/tmp
Code:
sh-4.1# ls -l /dev/sd2
lrwxrwxrwx root root 2013-11-16 14:45 sd2 -> /dev/block/vold/179:17
sh-4.1# mount|grep sd2
/dev/sd2 /mnt/tmp ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
success mounting ext formatted SD Card on Android
An improvement in technique to mount ext formatted SDcard:
1) be root and open terminal
2) insert the card
3) see the block device and partition names from dmesg
4) mount device to location of choice (create the directory if needed)
Below is an example of an SD card with one ext4 partition on it
Code:
bash-4.1# dmesg | tail | grep mmc
<6>[20230.719541] mmc1: new high speed SDHC card at address 0007
<6>[20230.722803] mmcblk1: mmc1:0007 SD32G 29.3 GiB (ro)
<6>[20230.728352] mmcblk1: p1
bash-4.1# busybox mount /dev/block/mmcblk1p1 /data/mnt/sdcard2
tribh said:
An improvement in technique to mount ext formatted SDcard:
1) be root and open terminal
2) insert the card
3) see the block device and partition names from dmesg
4) mount device to location of choice (create the directory if needed)
Below is an example of an SD card with one ext4 partition on it
Code:
bash-4.1# dmesg | tail | grep mmc
<6>[20230.719541] mmc1: new high speed SDHC card at address 0007
<6>[20230.722803] mmcblk1: mmc1:0007 SD32G 29.3 GiB (ro)
<6>[20230.728352] mmcblk1: p1
bash-4.1# busybox mount /dev/block/mmcblk1p1 /data/mnt/sdcard2
Click to expand...
Click to collapse
Would this work just the same way with i9000?
After this, no more access to the extSD by the Windows PC but only with Ubuntu, right?
tetakpatak said:
Would this work just the same way with i9000?
After this, no more access to the extSD by the Windows PC but only with Ubuntu, right?
Click to expand...
Click to collapse
Since it's generic Linux kernel and busybox functionality it should work on any 'droid. The SDcard device name might be different than in the above example - you will see the correct device and partition names after you insert SDcard and run `dmesg | tail` on the tablet or phone.
(of course your device must be rooted and have busybox...)
Typically Windows is engineered not to recognise anything that does not come from Microsoft, so you will not be able to mount the Linux partition via Windows.

[Q] Updating Boot For SD based ICS

I am using "generic-sdcard-v1.3-ICS-large-Rev3" from leapinlar/verygreen and a knightly from @CM_Encore (TeamWin)
http://forum.xda-developers.com/showthread.php?t=1000957
Pulling the micro SD out of the nook, into the SD Adapter and into the PC isn't complicated, but I would rather handle this via a PC batch and adb.
By default partition 1 of the SDCard is not mounted on boot. (so far as I can tell)
My Linux days are a bit behind me, but I found /etc/vold.fstab pointing to dev_mount sdcard /mnt/sdcard 4 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1.
So I assume I want to mount somthing like:
dev_mount boot /mnt/boot 1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
Then I can ADB PUSH updated and ADB reboot recovery.
I don't see a path to dev_mount to reproduce this approach.
I am also not sure if I need to create a /mnt/boot path first.
jmiller76 said:
I am using "generic-sdcard-v1.3-ICS-large-Rev3" from leapinlar/verygreen and a knightly from @CM_Encore (TeamWin)
http://forum.xda-developers.com/showthread.php?t=1000957
Pulling the micro SD out of the nook, into the SD Adapter and into the PC isn't complicated, but I would rather handle this via a PC batch and adb.
By default partition 1 of the SDCard is not mounted on boot. (so far as I can tell)
My Linux days are a bit behind me, but I found /etc/vold.fstab pointing to dev_mount sdcard /mnt/sdcard 4 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1.
So I assume I want to mount somthing like:
dev_mount boot /mnt/boot 1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
Then I can ADB PUSH updated and ADB reboot recovery.
I don't see a path to dev_mount to reproduce this approach.
I am also not sure if I need to create a /mnt/boot path first.
Click to expand...
Click to collapse
Just create a directory on /sdcard called boot...
adb shell mkdir /sdcard/boot
adb shell mount /dev/block/mmcblk1p1 /sdcard/boot
adb push XXXXX /sdcard/boot
There are two easy ways to accomplish what you need if you don't want to mess with adb. But Dizzy's instructions work if you are comfortable with adb.
One is to us a third party program named NookColorUMS and it will mount the boot partition on the PC using your USB cable.
The second way is to install a script file that I created to make the boot partition mount directly on the Nook.
You can learn about both by reading my tips thread linked in my signature.
Is this right to set the mount folder on the sdcard (fat32)?
I can make the folder, but attempting:
255|[email protected]:/ # mount /dev/block/mmcblk1p1 /sdcard/boot
mount /dev/block/mmcblk1p1 /sdcard/boot
Usage: mount [-r] [-w] [-o options] [-t type] device directory​The direct "Usage" text isn't explaining the syntax problem.
Believe it or not the whole /dev/block/ wasn't there when I used Linux in school. everything was just under /dev/ an ls -al took a while. Impossible to find things.
NookColorUMS-CM9.apk seems to do the trick if I switch out of MTP to Mass Storage.
Is there a way to make this work for MTP?
Id also still like to understand why the mount commands aren't working.
Thanks,
Josh
jmiller76 said:
Is this right to set the mount folder on the sdcard (fat32)?
I can make the folder, but attempting:
255|[email protected]:/ # mount /dev/block/mmcblk1p1 /sdcard/boot
mount /dev/block/mmcblk1p1 /sdcard/boot
Usage: mount [-r] [-w] [-o options] [-t type] device directory​The direct "Usage" text isn't explaining the syntax problem.
Believe it or not the whole /dev/block/ wasn't there when I used Linux in school. everything was just under /dev/ an ls -al took a while. Impossible to find things.
NookColorUMS-CM9.apk seems to do the trick if I switch out of MTP to Mass Storage.
Is there a way to make this work for MTP?
Id also still like to understand why the mount commands aren't working.
Thanks,
Josh
Click to expand...
Click to collapse
No the app only works for UMS (mass storage).
The mount command was not working for you because in CM9, you must use the -t option. For boot it is vfat. So the command would be:
mount -t vfat /dev/block/mmcblk1p1 /sdcard/boot
Specifying the type makes sense, wish mount had told me that, or that a type was needed.
Do you know what the behavior would be to mount the SD via mass storage with that mount point?
I scanned your(Leapinlar) user tips again and saw that at some point this behavior was working out of the box with /data/sdboot linked to /sdboot. It said it would be discussed again, but I am not sure the current draft does that.[it is mentioned below, but not explained]
In MTP mode the /sdcard/boot is not visible. Is there a way to register this partition as visible via MTP?
Are there any gotchas I should keep an eye out for?
Or any issues adding this to /data/local/userinit.d?
Thanks.
jmiller76 said:
Specifying the type makes sense, wish mount had told me that, or that a type was needed.
Do you know what the behavior would be to mount the SD via mass storage with that mount point?
I scanned your(Leapinlar) user tips again and saw that at some point this behavior was working out of the box with /data/sdboot linked to /sdboot. It said it would be discussed again, but I am not sure the current draft does that.[it is mentioned below, but not explained]
In MTP mode the /sdcard/boot is not visible. Is there a way to register this partition as visible via MTP?
Are there any gotchas I should keep an eye out for?
Or any issues adding this to /data/local/userinit.d?
Thanks.
Click to expand...
Click to collapse
The sdboot folder only shows inside CM. The reason I set up that folder was so GooManager could use it, not to make it available to the PC. And it works well with no issues adding that script.
Mtp only shows sdcard and emmc folders and I don't know of a way to change that. It probably does not show the sdcard/boot because it is mounted there rather than an actual part of the sdcard.
Yes, I do know how to mount the boot partition with a userint script so that it mounts using UMS, but I now use the NookColorUMS app since it is easier.

[Q] Help for mount bind folders

A simple question
---> doesn't work
Code:
mount -o bind /mnt/test /storage/emulated/0/test
--->worked
Code:
mount -o bind /mnt/storage/emulsted/0/test /mnt/test
I just want to extend my internal sdcard via a mounted samba.
It seems that sdcard filesystem is not been supported.
Somebody have any idea ?

Categories

Resources