[Q] SDCard Script - Optimus One, P500, V General

Can someone post the script that mount sdcard at boot?
I created a kernel but it doesn't mount sdcard at boot, it's possibile to create the script in system/etc/init.d that mount sdcard at boot?

Try busybox mount while booted to see if it's possible to mount SD Card with a script. SD card mounts automatically if it's FAT32 and it takes a little vold.fstab configuration for other file systems. You should check franco's or LG's kernel to see how to automount sd card from kernel.

This is taken from CM7, put it in init.d and see.

Turducken said:
This is taken from CM7, put it in init.d and see.
Click to expand...
Click to collapse
Thank you very much but what's that?
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $e2fsk_exitcode;
if [ "$e2fsk_exitcode" -lt 2 ];
then
# mount and set perms
$BB mount -o noatime,nodiratime,barrier=1 -t ext3 $SD_EXT_PART $SD_EXT_DIRECTORY;
if [ "$?" = 0 ];
then
$BB chown 1000:1000 $SD_EXT_DIRECTORY;
$BB chmod 771 $SD_EXT_DIRECTORY;
log -p i -t mountsd "$SD_EXT_DIRECTORY successfully mounted";
else
log -p e -t mountsd "Unable to mount filesystem for $SD_EXT_DIRECTORY!";
fi
else
log -p e -t mountsd "Unable to repair filesystem, disabling apps2sd";
fi
Click to expand...
Click to collapse
EDIT: Mount This script sdcard?
#!/system/bin/sh
mount -o remount,ro -t yaffs2 /dev/block/mmcblk0
Click to expand...
Click to collapse
RE-EDIT: The CM7 script doesn't works, in the second reboot the sd wasn't mount

The CM7 script mounts a2sd apps (apps2sd script). The second one should be like
Code:
mount -o remount,r[b]w[/b] -t [b]fat32[/b] /dev/block/mmcblk0
. As I already said, it's probably a kernel problem, vold mounts sdcards automatically.

Cricco said:
Thank you very much but what's that?
Click to expand...
Click to collapse
That part of the script mounts an ext partition if one exists.
RE-EDIT: The CM7 script doesn't works, in the second reboot the sd wasn't mount
Click to expand...
Click to collapse
As Ianis G. Vasilev said there are various ways to mount the SD card but I suspect the issue is with the kernel you've compiled. Flash francos, if it mounts then your kernel is bad. Run logcat to see what's going on.
**EDIT**
I didn't see Ianis post before I began mine...

so with
mount -o remount,rw -t fat32 /dev/block/mmcblk0
Click to expand...
Click to collapse
the sd will be mount?
EDIT: I need a script that mount sd without write or read permission, infact if i use root explorer and I go to sdcard sometimes the sdcard folder is blank, so the sd didn't mount

Read permissions are needed to see what's on the sd card. For a read-only mount replace rw with ro:
Code:
mount -o remount,r[b]o[/b] -t fat32 /dev/block/mmcblk0
I would advice you to use dmesg(should be enabled in kernel) to see if your phone detects the card and logcat to see if any errors are preventing your card from mounting.

Now i create script
#!/system/bin/sh
mount -o remount,rw -t fat32 /dev/block/mmcblk0
mount -t vfat -o /dev/block/mmcblk0
Click to expand...
Click to collapse
is it correct?

Related

[Q]How to mount directories across SD cards

Okay, this is what I want to do. Under Linux, it would be done via /etc/fstab, but Android has changed some things up.
Certain apps store files and other things on the internal SD card of the RAZR. For example, the Amazon MP3 Cloud player stores all downloaded music files to /sdcard/amazonmp3. There is no way to change this. However, I store all my music on my external SD card. So, what I want to do is create a mount point on the internal sdcard for the /sdcard/amazonmp3 directory that points to a directory on my external sd card (/sdcard-ext/amazonmp3).
That way, when I download music, it will still attempt to save it to /sdcard/amazonmp3 which really is a mount point that points to /sdcard-ext/amazonmp3.
Now, there is an app called FoldersPlug which does this. However, it's not doing it across reboots and it's a little buggy in how it works. I'd rather just fix the /etc/vold.fstab file (if that's possible) to mount my directories for me, but I don't completely understand all the needs to be set up in it.
If I have the following directories set up:
/sdcard/amazonmp3 (this will be empty)
/sdcard-ext/amazonmp3 (this will contain all the files and folder structures that would normally be in /sdcard/amazonmp3)
I want it so that the /sdcard-ext/amazonmp3 directory is mounted to the /sdcard/amazonmp3 directory.
Here is what I see when I run the "mount" command to look at the current mount points that are mounted:
Code:
/dev/block/vold/179:97 /mnt/sdcard/amazonmp3 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:97 /mnt/sdcard/DCIM vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:97 /mnt/sdcard/Pictures vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:97 /mnt/sdcard/Android/data/com.iconology.comics.app vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
These are the mount points that FoldersPlug set up and what I want to do instead is define them in the /etc/vold.fstab file but I don't know how they should be entered into the /etc/vold.fstab file.
Any help would be greatly appreciated!
Thanks!
I may be wrong, but I don't believe Android Vold can mount loopback (bind). You'll have to create a partition on the SD card instead, feeding it to Vold. Then try something similar to;
dev_mount /dev/block/mmcblk0p2 /mnt/sdcard/amazonmp3 /devices/platform/msm_sdcc.2/mmc_host/mmc1
Or if you forget about Vold, and use an ordinary mount;
# mount -o bind /sdcard-ext/amazonmp3 /sdcard/amazonmp3
In this case (bind loopback mount), you don't need it to be a partition.
Maybe the easies way is you just forget about the internal sdcard, replacing /mnt/cdcard with The real McCoy instead.
Cool. Thanks for the help. I see that this would have to be done using busybox, which is cool since I have that installed.
I tested what you stated and yup, that mounts them. So, I guess I'll fool around a little more with the scripts in /etc/init.d and see if I can't get it to work. I might have to do a sleep or something in the script to give the system time to mount the sdcards, but hopefully, this will work.
Thanks again for the tip!
UPDATE:
Well, here's my script but it doesn't seem to work. I have it first check to see if the number of lines returned from doing directory listing on the /sdcard and /sdcard-ext directories are 0. If so, it sleeps for 10 seconds and then tries it again, waiting for the sdcards to be mounted.
Once they are mounted, then I go and mount my directories. However, it doesn't seem to work. I have the script in the /etc/init.d directory and the permissions are set for execution (0777) like the other two scripts in there (98tweaks and S99SuperCharger).
If I go and run the script myself, it works and mounts the directories.
Here is the script. Any other ideas?
Code:
#!/system/xbin/sh
# Check if the SDCARDs are mounted yet.
result="`ls /sdcard/ | wc -l`"
while [ "$result" -eq 0 ]
do
sleep 10
result="`ls /sdcard/ | wc -l`"
done
result="`ls /sdcard-ext/ | wc -l`"
while [ "$result" -eq 0 ]
do
sleep 10
result="`ls /sdcard-ext/ | wc -l`"
done
# The cards are mounted. Now mount the directories
busybox mount --bind /sdcard-ext/DCIM /sdcard/DCIM
busybox mount --bind /sdcard-ext/amazonmp3 /sdcard/amazonmp3
busybox mount --bind /sdcard-ext/Pictures /sdcard/Pictures
busybox mount --bind /sdcard-ext/Android/data/com.iconology.comics.app /sdcard/Android/data/com.iconology.comics.app
Okay. Got it to work finally. I just decided to set it up using ScriptManager instead to run on boot.
Not sure why it wasn't working with the init.d process.
you rock!
iBolski said:
Cool. Thanks for the help. I see that this would have to be done using busybox, which is cool since I have that installed.
I tested what you stated and yup, that mounts them. So, I guess I'll fool around a little more with the scripts in /etc/init.d and see if I can't get it to work. I might have to do a sleep or something in the script to give the system time to mount the sdcards, but hopefully, this will work.
Thanks again for the tip!
UPDATE:
Well, here's my script but it doesn't seem to work. I have it first check to see if the number of lines returned from doing directory listing on the /sdcard and /sdcard-ext directories are 0. If so, it sleeps for 10 seconds and then tries it again, waiting for the sdcards to be mounted.
Once they are mounted, then I go and mount my directories. However, it doesn't seem to work. I have the script in the /etc/init.d directory and the permissions are set for execution (0777) like the other two scripts in there (98tweaks and S99SuperCharger).
If I go and run the script myself, it works and mounts the directories.
Here is the script. Any other ideas?
Code:
#!/system/xbin/sh
# Check if the SDCARDs are mounted yet.
result="`ls /sdcard/ | wc -l`"
while [ "$result" -eq 0 ]
do
sleep 10
result="`ls /sdcard/ | wc -l`"
done
result="`ls /sdcard-ext/ | wc -l`"
while [ "$result" -eq 0 ]
do
sleep 10
result="`ls /sdcard-ext/ | wc -l`"
done
# The cards are mounted. Now mount the directories
busybox mount --bind /sdcard-ext/DCIM /sdcard/DCIM
busybox mount --bind /sdcard-ext/amazonmp3 /sdcard/amazonmp3
busybox mount --bind /sdcard-ext/Pictures /sdcard/Pictures
busybox mount --bind /sdcard-ext/Android/data/com.iconology.comics.app /sdcard/Android/data/com.iconology.comics.app
Click to expand...
Click to collapse
Dude...a little renaming of dirs and i was running. thanx:good:
iBolski said:
Okay. Got it to work finally. I just decided to set it up using ScriptManager instead to run on boot.
Not sure why it wasn't working with the init.d process.
Click to expand...
Click to collapse
Works perfectly
Thanks for your work.
I have a question. Is it possible to create a folder in /mnt/sdcard (for example /mnt/sdcard/myfolder) with a script or automaticly after boot?
What i want is to mount the external SD to this folder (/mnt/sdcard/myfolder) but first you have to create the folder "mysdcard".
But i hope it works with a script only like:
Code:
#!/system/xbin/sh
# The cards are mounted. Now mount the directories
mkdir /mysdcard
busybox mount --bind /sdcard-ext /sdcard/mysdcard
sorry for my english
xoxys said:
Thanks for your work.
I have a question. Is it possible to create a folder in /mnt/sdcard (for example /mnt/sdcard/myfolder) with a script or automaticly after boot?
What i want is to mount the external SD to this folder (/mnt/sdcard/myfolder) but first you have to create the folder "mysdcard".
But i hope it works with a script only like:
Code:
#!/system/xbin/sh
# The cards are mounted. Now mount the directories
mkdir /mysdcard
busybox mount --bind /sdcard-ext /sdcard/mysdcard
sorry for my english
Click to expand...
Click to collapse
sorry my english bad...
if i don't have /etc/init.d directory... can i execute this command in another way?
thanks...
nb:
* modified with debuggerd is not work, my jelly-bean not execute debuggerd on boot
* add script install-recovery.sh on /system/etc is not work too....

[Q] Titanium Backup problem mount ext2

Titanium Backup i do not see my ext 2 split card.
FAT32
ext2
If you use Link2SD see ext2.
Titanium Backup can not be displayed.
Does anyone have a solution?
Try removing and re-inserting your SD Card. Or maybe wiping cache and Dalvik Cache in Recovery. It may help.
OK.
I need to know what script I have it mounted in sdext2
Titanium but it requires to ,,sd,, and then must use this command:
ln -s /data/sdext2 /data/sd
What do I need to connect the SD card data/sd
Only insert script in init.d ?
And what ?
Code:
We created:
#!/system/bin/sh
#mount sd for a2sd
mount -t ext2 -o rw /dev/block/vold/179:2 /data/sd
mount -t ext2 -o rw /dev/block/mmcblk0p2 /data/sd

[Q] [SOLVED] Is there kernel loop support for our device ?

Hi,
As the title says, Is there Kernel loop support for our LG Optimus L9 ?
I'm trying to mount a loop file created on debian on the device, but I get the error
ioctl LOOP_SET_FD failed: Device or resource busy
Click to expand...
Click to collapse
.
This is what I did --
Loop file created on debian and formatted with ext4.
On Optimus L9 with CM10.1, in terminal emulator,
$su
#losetup /dev/block/loop0 /storage/sdcar1/file
#mount -o remount,rw /system
#mkdir /system/temp
#mount -rw -o loop -t ext4 /dev/block/loop0 /system/temp/
ioctl LOOP_SET_FD failed: Device or resource busy
#
Click to expand...
Click to collapse
Is our kernel having loop support. If yes, am I doing anything wrong? The file gets successfully mounted in Debian.
EDIT:
using "busybox mount" solved the issue.
Tried adding busybox to the mount command and voila it worked.
#busybox mount -rw -o loop -t ext4 /dev/block/loop0 /system/temp/
Click to expand...
Click to collapse
You just taught me something new, thanks.
Can you upload your img, I would really like to check this out, or can you direct me to a thread so I can learn some more.
Sent from my LGMS769 using xda app-developers app
kuma82 said:
You just taught me something new, thanks.
Can you upload your img, I would really like to check this out, or can you direct me to a thread so I can learn some more.
Sent from my LGMS769 using xda app-developers app
Click to expand...
Click to collapse
The one I created is over 100MB. I had a html tutorial containing 12,000 files. I don't want to put those files on sdcard and mess it up. So, I used this block device.
I have created a sample "temp.img" file with a size of 500KB. It contains a single text file. I'm attaching it and you can check it out.
Below is the way i created and mounted it.
Code:
# "temp.img" md5 b97642fed817fa3f1a0cc6dc64b6c40d
# remount rootfs rw.
mount -o remount,rw /
# create mount point.
mkdir /mnt/temp
# chmod mountpoint.
chmod 777 /mnt/temp
# create block file.
dd if=/dev/zero of=/storage/sdcard0/temp.img bs=1024 count=500
# this creates 500 KB file. I can't seem
# to get bs=1M argument working on android.
# so bs1024 x count = target file size (=count times in KB).
# query free loop device. (will be /dev/block/loopx)
losetup -f
#attach block file with free loop.
losetup /dev/block/loop0 /storage/sdcard0/temp.img
#create file system.
mke2fs -T ext2 /dev/block/loop0
# And finally mount it
busybox mount -o loop -t ext2 -rw /dev/block/loop0 /mnt/temp
# For unmounting
busybox umount /mnt/temp
And it isn't encrypted. I don't need encryption, and i can't even seem to figure out how to encrypt it.

i need help to Ext2internalse on Cyanogenmod

i need help i dont know how transpose this mod for cyanogenmod (PAC-rom)
code:
#!/system/bin/sh
SU
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:61 /storage/sdcard0
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:61 /storage/sdcard0
if busybox mount | busybox grep vold/179:61; then
busybox mount -o bind /data/media /storage/external_SD
chmod -R 0777 /storage/external_SD
fi
Help me please :laugh:
raukas said:
i need help i dont know how transpose this mod for cyanogenmod (PAC-rom)
code:
#!/system/bin/sh
SU
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:61 /storage/sdcard0
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:61 /storage/sdcard0
if busybox mount | busybox grep vold/179:61; then
busybox mount -o bind /data/media /storage/external_SD
chmod -R 0777 /storage/external_SD
fi
Help me please :laugh:
Click to expand...
Click to collapse
AFAIK, this mod will not work with CM10.1 / 10.2.
There is no easy means to switch between emulated storage and external sdcard since JB(4.2.2).
The only way to disable internal sd emulation is to recompile the rom with this commit included.
(correct me if im wrong)
nfs1mw said:
AFAIK, this mod will not work with CM10.1 / 10.2.
There is no easy means to switch between emulated storage and external sdcard since JB(4.2.2).
The only way to disable internal sd emulation is to recompile the rom with this commit included.
(correct me if im wrong)
Click to expand...
Click to collapse
You are correct. OP use mateo1111 PAC (if p760-p768) or any of the p769 ports.
They have the fake internal SD removed.
Sent from my LGMS769 using XDA Premium 4 mobile app

[CM11][4.4]SD Switch KitKat

Hallo, I want to know how I can switch the SD cards from external to internal in CM11?
I didn't find vold.fstab.
Thanks
SWTR said:
Hallo, I want to know how I can switch the SD cards from external to internal in CM11?
I didn't find vold.fstab.
Thanks
Click to expand...
Click to collapse
Since 10.2 I've done it by uncommenting the #persist in the Vold section toward the end of the build.prop but it isn't working for me in cm11. At least on my Moto Bionic that works. I still can't find a way but if you find out how I'd love to know.
Sent from my Bionic
bump also looking for solution
Use script manager to execute this script at boot..
For GalaxySL = i9003
#!/system/bin/sh
umount /mnt/media_rw/sdcard0
umount /mnt/media_rw/sdcard1
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:49 /mnt/media_rw/sdcard0
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:1 /mnt/media_rw/sdcard1
Can't be installed inside "init.d" folder.. Suggest to use /data..
Replace the id = 179:49 and 179.1 according to your device internal and external id.You can check them by executing the command:
mount | grep sdcard0
and
mount | grep sdcard1
to swap change the id.. change the sdcard0 id to sdcard1..
It ain't working
adx3660 said:
Use script manager to execute this script at boot..
For GalaxySL = i9003
#!/system/bin/sh
umount /mnt/media_rw/sdcard0
umount /mnt/media_rw/sdcard1
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:49 /mnt/media_rw/sdcard0
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:1 /mnt/media_rw/sdcard1
Can't be installed inside "init.d" folder.. Suggest to use /data..
Replace the id = 179:49 and 179.1 according to your device internal and external id.You can check them by executing the command:
mount | grep sdcard0
and
mount | grep sdcard1
to swap change the id.. change the sdcard0 id to sdcard1..
Click to expand...
Click to collapse
Installed the Script manager,wrote the scripts but while executing it says no unmount command found....
vivin007 said:
Installed the Script manager,wrote the scripts but while executing it says no unmount command found....
Click to expand...
Click to collapse
What phone?
Samsung Galaxy Tab P1000
adx3660 said:
What phone?
Click to expand...
Click to collapse
P1000 Installed with Cm11 terecheng 25-12-2013.....
External to Internal sdcard app also is a no go.....its only a partial success
vivin007 said:
P1000 Installed with Cm11 terecheng 25-12-2013.....
External to Internal sdcard app also is a no go.....its only a partial success
Click to expand...
Click to collapse
I am sorry @vivin007 I don't have that device.. but I suggest you to double check the code that u typed in and try to ask in your device section the code and how to mount and unmount sd.. I am really2 sorry..
Up!
Sorry, but also looking for a better solution than linking!
I am currently trying this http://forum.xda-developers.com/showpost.php?p=48876834&postcount=472
so far so good but havent tested it much, i think games run slower..
No Problem dude
adx3660 said:
I am sorry @vivin007 I don't have that device.. but I suggest you to double check the code that u typed in and try to ask in your device section the code and how to mount and unmount sd.. I am really2 sorry..
Click to expand...
Click to collapse
Ha ha ha ....No Problem dude...You did a great Job helping me!
BTW Wish you a Happy New Year....
Will find a Solution....
vivin007 said:
Ha ha ha ....No Problem dude...You did a great Job helping me!
BTW Wish you a Happy New Year....
Will find a Solution....
Click to expand...
Click to collapse
Happy New Year too.. don't forget to share if u find a solution,,
Found it for P1/L/N Tab
adx3660 said:
Happy New Year too.. don't forget to share if u find a solution,,
Click to expand...
Click to collapse
Got Sd switched @adx3660 dude for P1/L/N Tab after Requesting such a feature with the Terenceng dev in his CM11 Roms, he was kind enough to build it for me.
He has asked me to test it, I am going to do it Now.
Folder mount
Gesendet von meinem Xperia SP
adx3660 said:
Use script manager to execute this script at boot..
For GalaxySL = i9003
#!/system/bin/sh
umount /mnt/media_rw/sdcard0
umount /mnt/media_rw/sdcard1
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:49 /mnt/media_rw/sdcard0
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:1 /mnt/media_rw/sdcard1
Can't be installed inside "init.d" folder.. Suggest to use /data..
Replace the id = 179:49 and 179.1 according to your device internal and external id.You can check them by executing the command:
mount | grep sdcard0
and
mount | grep sdcard1
to swap change the id.. change the sdcard0 id to sdcard1..
Click to expand...
Click to collapse
Thanks, this worked on my galaxy ace plus! But having unmount before mount threw some error like device is busy or something, works if I just have the mount command.
adx3660 said:
Use script manager to execute this script at boot..
For GalaxySL = i9003
#!/system/bin/sh
umount /mnt/media_rw/sdcard0
umount /mnt/media_rw/sdcard1
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:49 /mnt/media_rw/sdcard0
mount -t vfat -o uid=1023,gid=1023 /dev/block/vold/179:1 /mnt/media_rw/sdcard1
Can't be installed inside "init.d" folder.. Suggest to use /data..
Replace the id = 179:49 and 179.1 according to your device internal and external id.You can check them by executing the command:
mount | grep sdcard0
and
mount | grep sdcard1
to swap change the id.. change the sdcard0 id to sdcard1..
Click to expand...
Click to collapse
Cant execute those commands with terminal?
TecknoFreak said:
Cant execute those commands with terminal?
Click to expand...
Click to collapse
Why not give it a test.. :good:
p/s: I am not responsible for anything happen while / when you using this script..
Guys Im a newbie here but Ive been looking for a way to swap my Galaxy Tab 2 7'0's (running CM11 ) external sd with the internal memory. ive tried several scripts and guides but I just cant seem to find a solution. Is there a memory swap mod made for it or can anyone help me with that.
Hi can u help me? how to swap memory with 2.5 build.. i have some trouble with that.. (newbie here )

Categories

Resources