(Q) how to mount the sdcard in ubuntu of the slide - myTouch 3G Slide Q&A, Help & Troubleshooting

I was wondering if you could mount the phones sdcard the same way you mounted the ubuntu.img file so it could be used within the ubuntu environment on the phone I since running the phone a mobile pc with all the functionality as a home computer with the ability to right the the sdcard as if you would the hard drive.
I tried
Mount -t vfat /mnt/sdcard /data/local/mnt/sdcard
Mount -t ext2 /mnt/sdcard /data/local/mnt/sdcard
And
Mount -o noatime -t vfat /mnt/sdcard /data/local/mnt/sdcard
Also
Mount -o remount,rw -t vfat /dev/block/vold/179:1 /data/local/mnt/sdcard
After creating a /sdcard directory within /data/local/mnt using a second instance of terminal emulator (using two seperate terminal emulator apps) one running the ubuntu environment and the other with root permissions of the device itself.
All options resulted in error "Block Device Required"
Anyone think this could work if so what am I missing.
Thank you
Sent from my T-Mobile myTouch 3G Slide using XDA App

I think you're making things harder than they need to be. Ubuntu automounts USB media by default.
When you plug your phone into the computer, it should pop up a message in the notification pulldown on the phone where you can turn on USB mass storage. The stock ROM for the Slide even has the option to turn USB mass storage on automatically, as well, when it's plugged in.
Also, pluggable media is mounted in a folder under /media on Ubuntu. Ubuntu doesn't use /mnt as a rule. My sdcard's volume name is "Espresso" (that's what I named it when I formatted it.) When I plug it in, its contents are available under /media/Espresso.
If your file manager (Nautilus) doesn't pop open a window when you plug the phone in, make sure USB storage is on on the phone, and check the Nautilus sidebar to see if it actually mounted it.
If it doesn't auto-mount, find out which device node your card was assigned by Ubuntu. Ubuntu assigns hard drives as /dev/sda for the first drive on your system (with /dev/sda1 being the first partition on the drive), /dev/sdb, etc. Since I have a multi-card reader taking up a few nodes, my Slide's sdcard came up as /dev/sdg. To manually mount it, you'd type:
Code:
sudo mount -t vfat /dev/sdg1 /mnt
That would make everything available under /mnt. I notice you have both a fat and an ext partition. That command up there is assuming your fat partition is the first on the sdcard. If it's ext, just remove "-t vfat". To unmount it after use, make sure no file managers are in /mnt (and no terminal is cd'd to /mnt) and type
Code:
sudo umount /mnt
I've never had a problem with Ubuntu NOT automounting partitions on three different Android phones' sdcards. Ubuntu is made so you don't have to do all that bs above. But if you can't get automounting to work, create two folders in /media and alter your mount commands to point to them. You could even get creative and write scripts to mount and unmount them.
Example script:
Code:
#!/bin/bash
mount /dev/sdg1 /media/slide-ext
mount -t vfat /dev/sdg2 /media/slide-fat

no you miss understood me I'm trying to mount the sdcard within unbuntu on the device using sauriks virtual machine
Sent from my T-Mobile myTouch 3G Slide using XDA App

Oh crap. My bad, then.

All good
Sent from my T-Mobile myTouch 3G Slide using XDA App

Solved!
To mount the phones sdcard in the ubuntu virtual machine run is a seperate window (I used two different terminal emulators) run:
Mkdir /data/local/mnt/sdcard
Mount -t vfat /dev/block/vold/179:1 /data/local/mnt/sdcard
Sent from my T-Mobile myTouch 3G Slide using XDA App

Related

data2ext for HTC Hero & G2 Touch

Hi!
I was experimenting with the data2ext script made for the Desire in following thread:
http://forum.xda-developers.com/showthread.php?t=859419
Now I managed to get it working with HTC Hero and Flykernel12a and Amon RA-s recovery v1.7.0.1 .
MAKING THIS WORKING IS A RISKY OPERATION! DO NOT START IF YOU DO NOT UNDERSTAND WHAT IS WRITTEN BELOW! I'M NOT RESPONSIBLE IF YOU DAMAGE YOUR PHONE OR YOU LOOSE YOUR DATA!
So here is what I made:
- make backup of your entire SD card, because we are going to repartition it, so all data will be lost on your SD card
- reboot to recovery and MAKE NANDROID BACKUP of your existing configuration!!! Then stay in recovery mode, and copy your NANDROID BACKUP to a safe place on your computer from the SD card!!!!! DURING THE OPERATION WE WILL ERASE THE WHOLE SD CARD!!!
- wipe your cache and dalvik-cache (only this 2, NO factory/data reset!!)
- connect to your phone with "adb shell" (while in recovery!!)
- in the shell execute following commands:
(do this only if you have active app2sd and your app/app-private/dalvik-cache directories are on the SD card EXT partition)
mount /data
rm -rf /data/app
rm - rf /data/app-private
rm - rf /data/dalvik-cache
mkdir /data/app
mkdir /data/app-private
mkdir /data/dalvik-cache
chmod 777 /data/app*
chmod 777 /data/dalvik-cache
chown 1000:1000 /data/app*
chown 1000:1000 /data/dalvik-cache
- now we will copy back the apps on the nand
mount /sd-ext
cp /sd-ext/app/* /data/app
cp /sd-ext/app-private/* /data/app-private
(no need to copy the dalvik-cache content!)
umount /sd-ext
- so now we have all our app on the nand again. next step is to put the 04data2extV4 script into the right place
umount /data
mount /system
exit
(now leaving shell to copy file)
in the command prompt execute:
adb push pathtothescript/04data2extV4 /system/etc/init.d/
adb shell
(back to shell again)
chmod 755 /system/etc/init.d/04data2extV4
chown 0:2000 /system/etc/init.d/04data2extV4
rm /system/etc/init.d/05mountsd
(remove script which mounts SD card differently)
rm /system/etc/init.d/10apps2sd
(remove script which makes app2sd)
umount /system
exit
(now leaving shell)
now we have to repartition your SD card to 2 ext and 1 fat partition. For this use the utility1 I uploaded which is modified version of the original utility in /sbin.
in command prompt:
adb push pathtoyourscript/utility1 /sbin/
adb shell
(back to shell)
chmod +x /sbin/utility1
(now execute the utility)
/sbin/utility1
choose 0 from menu: Partition SD 2 EXT 1 FAT (can set sizes)
enter the first EXT partition size (min. 3-400, I use 1300 - values are in MB)
enter second EXT partition size (min. 2-300, I use 300 - values are in MB)
the rest will be configured for the FAT32 file system
On the first EXT partition you will store the whole /data
On the second EXT partition you will store the /data/data in a loop file
Now we are hopefully ready to reboot, the rest will be managed by the 04data2extV4 script, wich creates the ext2 file systems, converts them to ext4, stets file system option such as journaling where needed, etc and copies everything from nand to ext4.
I hope this works for all. I reached Quadrant score for total system score about 455, without data2ext I had about 400. But I have a Class4 SD card. On class6 I'm sure it will be even faster.
Again, it is risky, so take care.
The boot process can be long, because at the first time it will copy the whole /data directory to the first EXT partition, the data/data directory on the 2nd partition, and will recreate the whole dalvik-cache (remember we wiped!).
Enjoy
Regards,
byr2
PS: in the RAR file you will find an FSTAB file. I removed the /sd-ext mount option from it. If you have trouble, try to replace the fstab file in /etc to this fstab file or remove the /sd-ext mount option from your fstab
Thank you for this.
Just a few questions. The EXT partitions, are they EXT 2, 3 or 4?
Are you using exactly the same script as ownhere? As in, you use exactly his method, aka the following one:
"I would like to share my Data2EXT script, a collection of data2sd(Thanks to sibere) and the advantages of ext4, you can let the phone run at peak efficiency.
I use EXT4 for whole SD 2nd partition, and create a ext2 loopback device with 1/5 size of 2nd partition.
The files in /data/app,/data/.systemapp it not updated frequently. so store them in EXT4.
In /data/data and /data/app-private, a lot of small files and sqlite database, is updated frequently. so store thenm in EXT2 loopback device.
/data/dalvik-cache is stored in phone memory /mnt/asec/mtddata for distributed IO pressure.
/data/misc, /data/system, /data/property is stored in phone memory /mnt/asec/mtddata for system settings restore(or you will lost your timezone/language settings after reboot).
use this script, I can get quandrant score:2000+, IO:4000+, my phone is smooth and quickly."
Are you running this stable? Reboots? All apps show after reboots?
Hi!
The two EXT partition is EXT4 partition. The script I provided is based on ownhere's script, wich is modified only in a few places.
For example on hero I do not have a /system/xbin/mkfs.ext4 like he had, but only a mkfs.ext2, so I have to create the EXT4 partition on a different way. Also the loopback device is set up in a different way than in the original script.
But what you quoted remains so, which means I did not modified any location of storage files, nor did modified filesystem parameters. First EXT4 ha no journaling ,second EXT4 has journaling, ext4 loop device has no journaling.
You can diff the two scripts to see the difference, but an example here:
Original part:
/system/xbin/mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk0p2
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
/system/bin/e2fsck /dev/block/mmcblk0p2
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk0p2
Modified part:
/system/xbin/mkfs.ext2 -b 4096 -m 0 -F -L extdata /dev/block/mmcblk0p2
/system/bin/e2fsck -y -v -f /dev/block/mmcblk0p2
/system/bin/tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
/system/bin/e2fsck -fpDC0 /dev/block/mmcblk0p2
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
/system/bin/e2fsck /dev/block/mmcblk0p2
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk0p2
As you can see I create an ext2 partition, check it, and with tune2fs I convert it to EXT4, check it again, and set the same parameters ownhere has set.
for loopback device I use:
$BUSYBOX losetup /dev/block/loop1 /mnt/asec/extdata/ext4
$BUSYBOX mount -t ext4 -o loop,sync,commit=3,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/loop1 /mnt/asec/tmpdata
the losetup is needed, because for some reason it won't mount as loop. But this way it is working.
Other parts of the script are untouched.
Regards,
byr2
"Are you running this stable? Reboots? All apps show after reboots?"
Till now everything runs OK, no reboot, all widgets, apps, settings were preserved. After reboot also everything OK. Made some phone calls, no problems so far.
Just with Class4 SD card the speed gain is not as huge as expected. The IO performance is slightly better, but not too much. I've read posts on CDMA Hero forum, where they managed to get quadrant score over 700, but I'm sure not with a Class4 SD card
But the funniest thing in settings is: Available internal phone storage: 1,17Gb
Excuse me for the noob question, but what this process basically does is make the entire phone run off of an ext4 partition on the SD card?
No, not the entry phone, just the /data directory is moved to ext4 partition (wich is accessed frequently by the OS, and where applications and application related data are stored). The kernel, firmware, etc. remains on the NAND.
I wonder what one does when flashing a new ROM =/ You have to go through this procedure every single time? What does AmonRA do when you Wipe Data/Factory Reset?
So essentially the differentiations are due to the fact that we lack a /system/xbin/mkfs.ext4 (since we only have an ext2) and you turn the first EXT4 partition into a non journaling one to fill the lack of that, if i understand correctly.
If you flash a new rom, then all this is gone, since if will overwrite the /system/etc/init.d where our data2ext script is located. So you're right, you have to do this every time you flash a new ROM. A solution would be to pack this script into the ROMs, so it would work out of the box without this hack mentioned in the first post.
The data/factory reset wont work I think, because it deletes from the nand, but since our data/settings are not on the nand but the SD, it will have no effect.
the first ext4 partition is non journaling because ownhere write the script so. You can read in his post why he choosed to do so.
The first EXT pratition where /data is stored is a EXT4 part without journaling
The second EXT partition where the loop file is stored is an EXT4 part with journaling
and the LOOP file which contains an EXT4 partition without journaling
from ownhere's post:
"EDIT:2010/12/12 update V4 script:
/data/:ext4, disable journaling
/data/data:ext4 loopfile on ext4 device, enable journaling on ext4 device, disable journaling on ext4 loopfile, for fast and stable sqlite3 access.
really smooth this time. please trying..."
This is the setup here also.
byr2
I see, the script is essentially the same, with your own critical changes to fit the Hero.
Now what i am trying to understand is what happens when you want to flash a new ROM.
Say you place the 04data2extV4 script in the new ROM's /system/etc/init.d and remove the other two scripts if they exit (05mountsd and 10apps2sd). Does this mean the partitions and this whole process won't have to be repeated?
Also when installing a new rom it is recommended you wipe data and system, if AmonRA doesn't wipe, what do we do?
Well, I've not tested to install a new rom, but let think:
- the partitions are preserved on your SD, so repartitioning is not needed.
- but as you mention all data/settings are currently on your SD, so a wipe does nothing with it, and if you simply put the 04data2extV4 script back to init.d I think it will mess things just up... but if you just delete everything off the two EXT partitions I think it will be fine
That's the only limitation i have so far as to not attempting this.
I wonder if i can mod the AmonRA Recovery to delete the content of those 2 partitions instead =/
I'm going to have a look.
Nice work!
By the way, I was thinking. Why not just make an ext partition, add a line for it in fstab and set the mountpoint for it to be /data. What would happen if I tried this?
Byr2.... just wanted to say this is first thing i read today and without coffee all I heard was
Blah blah blah dangerous blah blah blah faster blah blah risk blah blah even faster
Lmao
Once I get my head working it should prove interesting though
Thanks for this experiment
Sent from my HTC Hero using Tapatalk
ok, sitting down at pc now, drinking espresso...
this is starting to sink in
Instant benefit is huge storage space which, coupled with the method used, ought to have a general performance improvement over previous ext-based apps2sd, right? if so then removing ext-based apps2sd and using this script concept instead seems like a good plan if, for example, every rom builder switched to this concept and removed old apps2sd stuff simultaneously. Does that sound right or wrong?
if you have a fast sd card then the speed benefit should be very good, better than using ext-based "apps2sd" since it's the actual data partition on the ext card.
and I too would like to know the answer to the brief question someone already asked - what about just setting a mount point to data on the sd card and doing it that way in simple linux fashion? I'm not bothering to think this through - coffee's still kicking in - I'll leave the intelligence to you folks who are already awake.
IMHO this idea of yours is quite brilliant as a goal (well ok, it's not your idea, but you did it first on the gsm hero . The thing that slows my phone the most is reads and writes to phone memory and to my stock sd card. I can upgrade the sd card but the phone memory writes are still slow. This would improve the speed of the largest file writes when managing my apps and installing from the market which we all know brings our phones to a standstill briefly during installs and so on.
How's the performance when installing apps? does your phone still crawl for a bit at those crucial moments or is it all somewhat less of a dramatic slowdown now?
Hi All!
Well, If you do not change the ROMs frequently, it should not be a problem that ROM developers do not include this script. However till now only one ROM developers have taken care about this opportunity, I think it was Cronos. They have a modified ROM wich supports this kind of functionality.
The speed gain over app2sd comes from storing the whole data partition on a faster SD card than the internal NAND. As my tests show a class4 SD card is slightly faster than the internal NAND (not much, say about 5-10%). A class6 SD card could be much more faster. All application access the data partition to read and write settings/data. Even the Frimware stores things there, so if you have a fast SD card, overall system performance could be great.
Not to mention about stored data space. With app2sd you only store the downloaded apk-s on the EXT. With data2ext you have extra space for the application data/settings/cache wich size is determined by you and your SD card size ! (See screenshot!)
A simple fstab modification could work, however the script does do a lot of things beside copying everything to EXT. It also sets up some symlinks during every boot, so a part of the script is needed always. Also there is 2 EXT partitions, and the /data/data is stored on a 2nd EXT partition in an EXT4 loop file image So it's not that easy to simply mount it via fstab.
byr2
dkelley said:
Byr2.... just wanted to say this is first thing i read today and without coffee all I heard was
Blah blah blah dangerous blah blah blah faster blah blah risk blah blah even faster
Lmao
Click to expand...
Click to collapse
Hahaha. I've read this several times now and still all I get is what you wrote above.
I got this after all
Code:
$mount
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /acct type cgroup (rw,cpuacct)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,cpu)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime)
/dev/block/mtdblock5 on /mnt/asec/mtddata type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,size=0k,mode=000)
All correct?
This is mine:
Code:
rootfs on / type rootfs (ro,noatime)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
none on /acct type cgroup (rw,cpuacct)
tmpfs on /mnt/asec type tmpfs (rw,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,cpu)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev,noatime)
/dev/block/mtdblock5 on /mnt/asec/mtddata type yaffs (rw,nosuid,nodev,relatime)
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
/dev/block/vold/179:1 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0
020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_ut
ime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,size=0k,mode=000)
/dev/block/dm-0 on /mnt/asec/com.qualcomm.qx.neocore-1 type vfat (ro,dirsync,nosuid,nodev,noexec,uid=1000,fmask=0222,dmask=0222,code
page=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
Seems your's almost the same...
The key is this:
Code:
/dev/block/mmcblk0p2 on /data type ext4 (rw,nosuid,nodev,noatime,nodiratime,commit=19,barrier=0,nobh,data=writeback)
/dev/block/mmcblk0p3 on /mnt/asec/extdata type ext4 (rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered)
/dev/block/loop1 on /data/data type ext4 (rw,sync,nosuid,nodev,noatime,nodiratime,commit=3,barrier=1,data=writeback)
How is your phone performing? Was everything OK?
byr2
Everything seems to be ok )
There is no more sticking when new apk installed. Quadrant score around 500.
I have Class 10 sd card (prooflink).
But I have had a little problem - not enough nand space to hold all of my apks, so I've decided to push most of them via adb from my laptop after Hero's reboot.
Quadrant score not so high as I expected, but anyway I'm happy =)
if you push it via ADB after reboot, than it should get to the right place
The quadrant score is affected by 3D and CPU also, but can you feel the "speed" while testing the IO? Does it run fast? How long is the DB read/write, FS read/write?
I'm happy someone else could get this thing working
byr2

[Howto] mount any directories from extSdCard to under /sdcard/

So I found a million threads asking about why they can't ln -s or mount the /mnt/extSdCard to /mnt/sdcard or various forms of that. The motivation here is to allow certain apps that can't get about /sdcard/ to be able to see the additional 64GB of SDHC.
What helped was this realization that the android mount command supports bind and one of a few dozen other threads, mostly this one:
http://forum.xda-developers.com/showthread.php?t=1825494
So it appears there are a half dozen ways to make mounts, from using /dev/block/vold/179:97 to using the vold.fstab which mentions a serial or parallel sdcard scheme, which they chose parallel, to all these init.rc monitoring scripts that have to unmount on USB mode, and crazy stuff and a million Directory Bind apps, and int2SD binder / linker apps. It appears this app might do what I am suggesting but I don't think /emmc/ works anymore and I haven't looked into the .apk.
Ok....
1) ODIN over a root injected stock ROM, or otherwise get root.
2) (A) Get yourself any Terminal program like Terminal Emulator and if you are smart you will also get Hacker's Keyboard.
or
2) (B) From any of the programs that will run scripts, you can just make a script.
3)
Code:
$ su -
# mkdir /mnt/sdcard/external
# mount -o bind /mnt/extSdCard /mnt/sdcard/external
Now you can name it whatever you want but since the home is /sdcard/ it has to be under that.
Or, instead of mounting the whole thing, just mount Movies and Music directory
Code:
# mkdir /mnt/sdcard/Music/extMusic
# mount -o bind /mnt/extSdCard/Music /mnt/sdcard/Music/extMusic
Etc.
Now for those wanting to make a script or app to sell for $1.99... There may be real problems depending on where a backup program chooses to backup and it could be recursive.
And just FYI, this ends up inheriting all the same properties from the extSdCard mount params,
ie. /dev/block/vold/179:97 /mnt/sdcard/Music/extMusic vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1023,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
Any mounted directory all look identical in mount and the vold must map them out.
Anyways you can write a simple script and hopefully you are mindful of any backups you do if you save backups to the external sdcard and you mount the entire thing. The safest way would be to mount one directory to transfer files or only mount the large media.
It also means you could copy everything from /sdcard/Music to the external and then mount /sdcard/Music to be a directory on the external card. You could remove the ext SDHC and copy files that way and have everything in one place and not worry about wiping it out.
However, I have benchmarked the internal SD appears to be faster on bandwidth benchmarks versus an external Class 10/UHS. On the stock rom the internal is also fuse versus fat32 for the external SDHC (or exFAT for a SDXC card). There is also something in the SD2.0 spec about the 2nd SD only one can have a higher clock bandwidth.
Types in step 3 exactly. But nothing happened
Sent from my SGH-T999 using xda app-developers app
fateownzyou3 said:
Types in step 3 exactly. But nothing happened
Click to expand...
Click to collapse
Did you get an error? There is no output of mount unless there is an error.. Did you look in a file browser to see if that folder is now mounted? This only works until reboot, until someone makes an app or script.
Hi,
@joederp thank you very much ! Your tip in so usefull to me with my galaxy note on CM10 ParanoidAndroid ROM.
The only thing I try now to get work is : automaticaly run the script at phone boot. I'm pretty sure I can get it with Tasker, but did not find the trick.
Just use the directory bind app... It works fine on my galaxy tab 2 7.0
Sent from my SGH-T999 using xda premium
Directory bind is a whole different thing that uses CPU and monitors the system and does who knows what.
You can just use any scripting program or I think edit init.rc and add the extra mount commands. copy init.rc to a .bak and edit it.
Thank to all of you !
I found something more appropriate to my needs in this thread : http://forum.xda-developers.com/showthread.php?t=1593615
Anyway thanks

How to put /data on external SD

WORD OF WARNING: if you do this, wiping /data from recovery will not actually wipe data. AND if you install a new ROM, via clean or dirty flash, chances are your large /data partition will go all screwy on you. It did for me. If I flashed anything, it tends to cause boot loops or hangs at the boot animation.
If you are dirty flashing anything, I would first get as much off of the large /data as you can to get it to 2 GB or less, then drop it on top of your 2 GB /data partition, then dirty flash, let everything come back up and get stable then repeat these steps starting at step 2 to blow away your large /data and then mirror your 2 GB /data to your large /data.
The problems I had could be related to xposed, but I am not 100% certain on this. It is my best guess from looking at my logcat (doesn't actually indicate a crash in there, but has a lot of stuff related to xposed).
These steps are more for the non-flashaholics amung us OR people who flash new stuff but roll back to nandroid. Once you pop the larger /data onto any ROM, your nandroid will likely not play nice with it anymore as your larger /data is not restored from a nandroid.
And the normal "warranty is now void" and "if things break, it isn't my fault" disclamer stuff too. But I'm running this right now and liking it (except when I go to jump to KK it may not be happy with me... gonna need to do some testing to nandroids work properly AND so I can flash ROMs without blowing everything up... thinking it is just the dalvik that is unhappy, but I am uncertain at this time)
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
chown system:system /data
restorecon /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the next command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
chown system:system /data - This gives system ownership of /data instead of root as is originally done
restorecon /data - we do this just in case the userdata partition has been reset.
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#!/system/bin/bash" > dataswap
echo "if [ -e \"/dev/block/mmcblk1p2\" ]" >>dataswap
echo "then" >> dataswap
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap
echo "chown system:system /data" >> dataswap
echo "restorecon /data" >> dataswap
echo "fi" >>dataswap
chown root:shell dataswap
chmod 777 dataswap
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
EDIT: cleaned up the instructions a little and added in some recommended steps (the chown and restorecon) and removed the waiting to mount /data as that just makes things unhappy long term.
EDIT: added error handling in case mmcblk1p2 does not exist to the startup script. If it does not exist, it will now NOT swap the partitions. So as a failsafe, if your phone gets stuck at the boot animation, you can power it down, remove the SD card and power it back up to boot with your default /data partition. This should not need to be done, but there is a chance that your SD card could die or your new /data partition get corrupted, this will allow you to recover safely and will likely only require you to re-create your data partition and NOT have to re-do your whole ROM due to something going bad on the big /data.
Dang...found a bug: it looks like if you leave it for a few days or reboot our something(have not narrowed it down yet) some apps stop working... investigating it and should have a solution sometime tonight... sorry to all those who have tried this... if you have not done much, I'd suggest switching back to normal /data until I get the bug sorted out. My best guess is that reboot doesn't unmount the partition cleanly but I'm not positive...
bmg002 said:
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the last command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#/sys/bin/bash" > dataswap.sh
echo "while [ \`mount | grep -c sdcard\` -lt 3 ]" >> dataswap.sh
echo "do" >> dataswap.sh
echo "sleep 10" >> dataswap.sh
echo "done" >> dataswap.sh
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap.sh
chown root:shell dataswap.sh
chmod 777 dataswap.sh
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
Click to expand...
Click to collapse
So found a solution to crashing apps . Load up the play store and update your apps. Worked for me anyways.
Now to fix a potential mounting bug in the op, put any scripts on a different ext4 position such as/system/xbin or/system/etc/init.d.
I'll keep you posted if I find other bugs.
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
Bleh new bug:
When you unplug it from a pc, it gets confused and you get io errors which cause it to crash back to the boot animation and get stuck there... too tired to debug out tonight but I'll poke at it tomorrow... thinking I may need to build a kernel module for this... or a custom kernel
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
So the unplugging issue seems quite intermittent and I am unable to get consistent results with it. So I am not sure if it is a bug or not. I updated the OP to have error handling so you can pull your SD card out to mount the 2 GB /data that your phone normally does instead of your big one in the event that something goes wrong.
Hrm... so my testing and further development with this has taken a temporary pause due to my SD card dying on me. Stupid SD card... haven't even had it a year. Hoping I can find the reciept. But once I get it replaced, I'll be jumping in on this some more. I have a few cool ideas that we can do by moving partitions to external storage...
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
hatememarkz said:
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
Click to expand...
Click to collapse
From my testing it seems to work but puts a heavy load the sd card. And if your sd card fails you will lose some data.
I have not tested this on KitKat yet but that is my plan soon.
Sent from my SM-T310 using xda app-developers app

[Q] Internal/External Memory Swap

So, I have a Sprint Galaxy S3 Running Cyanogenmod 10.2.1, and I'd like to trick it into thinking my 64GB SdCard is the Internal Memory.
So far, by using Script Manager, and this Code:
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:33 /mnt/shell/emulated/0
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:33 /mnt/shell/emulated/0
if busybox mount | busybox grep vold/179:33; then
busybox mount -o bind /data/media /mnt/sdcard1
fi
I put it here: /system/etc/init.d
And tested it here: /data/
Running this makes all my apps stop working, and after a minute can no longer access the settings even.
When I plug it into a computer however, it is reading my Internal storage as the 64GB Card.
Any help is Appreciated!
This is some code I found and edited, so I'm not entirely sure of the Mechanics behind it.
Here are the Credits:
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa.
#With this you can use default internal sd only for app storage
#and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at
#Script Modified for U.S. Galaxy S3s by Zedomax at GalaxyS3Root.com to be compatible when sdcard is not inserted.

Access to /storage/sdcard0 requires root access

Something strange appeared at my SM-605.
I cannot access /storage/sdcard0 without root any more.
Total Commander shows "Insufficient Memory : rootfs lost on reboot" and mounts this partition every time using mount -o remount,rw -t rootfs rootfs /
The same is for /storage/emulated/legacy and /mnt/sdcard
At the same time accessing using /mnt/shell/emulated/0 works just fine.
Re-creating links in /storage does not help.
/etc/vold.fstab never was modified.
What is going on and how to fix it?

Categories

Resources