[Q] Moving files on start up - Android Q&A, Help & Troubleshooting

OK I admit this is somewhat of a n00b question, to a person who knows how Droids works with storage anyway.
The original issue I have is I changed from a phone with no internal memory to one with internal + micro SD. Without too much hacking/modding/customization outside of built in settings or simple file path edits, I want to keep as much of my stuff on the micro SD rather than internal mem incase the phone goes kaput suddenly (like my ol' Droid 3). Unfortunately a few apps here and there point to the internal "sdcard" and can not be changed to the external.
In the end, I was quite happy to simply have a little script that ran on start up (i.e. regularly enough) that moved files from particular folders from to the external sd card. By no means is it the most fancy solution but initially something I could script up myself and be simplistic in the sense that it was just simple file operations and used existing stuff (e.g. no ext apps).
However it's not working and from my logging of things it looks like because at the time userinit.sh runs not all storage has yet been mounted (file/folder not found)?
Here is my simple script cut down to just one path example.
Code:
#!/system/bin/sh
ULOG=/data/local/test.log
date >> $ULOG
cp -R /mnt/sdcard/Pictures /mnt/external_sd 2>> $ULOG
if [ "$?" -eq "0" ]
rm -R /mnt/sdcard/Pictures/* 2>> $ULOG
fi
(and I tried /storage/sdcard0 and /storage/sdcard1 instead of /mnt's with no difference, FWIW)

Related

[Q] How to use swapon?

I have already tried Siyah and Perseus kernel.
What I'm trying to do is create 2 small swap files one in internal sd and the other on the external sd. (Yes just a small memory bump will do)
On windows I did these:
Code:
fsutil file createnew C:\swap1 128000000
fsutil file createnew C:\swap2 128000000
Copied swap1 to /storage/sdcard0
Copied swap2 to /storage/extSdCard
btw /storage/extSdCard is exFat
then on Terminal Emulator.
Code:
su
mkswap /storage/sdcard0/swap1
mkswap /storage/extSdCard/swap2
swapon /storage/sdcard0/swap1
*This is where I get the error "swapon: /storage/sdcard0/swap1: Invalid argument"
(1) Swapper2 app doesnt work for me.
(2) I don't want to use hardswap or swap partition on my external SD.
*NTFS is unstable with uTorrent using Paragon NTFS/HFS+ (i'm getting corrupted files.)
*exFat is unstable when used with more than one partition like exfat/swap or exfat/swap/ext4. (still getting corrupted files.)
I've also tried using losetup, but when I do this:
Code:
# losetup -f
/dev/loop0
# losetup /dev/loop0 /storage/sdcard0/swap1
losetup: /dev/loop0: No such file or directory
I think the loop module is not loaded in the kernel, how do i load it? and where can i find the module?
R: [Q] How to use swapon?
autumnwillow said:
I have already tried Siyah and Perseus kernel.
What I'm trying to do is create 2 small swap files one in internal sd and the other on the external sd. (Yes just a small memory bump will do)
On windows I did these:
Code:
fsutil file createnew C:\swap1 128000000
fsutil file createnew C:\swap2 128000000
Copied swap1 to /storage/sdcard0
Copied swap2 to /storage/extSdCard
btw /storage/extSdCard is exFat
then on Terminal Emulator.
Code:
su
mkswap /storage/sdcard0/swap1
mkswap /storage/extSdCard/swap2
swapon /storage/sdcard0/swap1
*This is where I get the error "swapon: /storage/sdcard0/swap1: Invalid argument"
(1) Swapper2 app doesnt work for me.
(2) I don't want to use hardswap or swap partition on my external SD.
*NTFS is unstable with uTorrent using Paragon NTFS/HFS+ (i'm getting corrupted files.)
*exFat is unstable when used with more than one partition like exfat/swap or exfat/swap/ext4. (still getting corrupted files.)
I've also tried using losetup, but when I do this:
Code:
# losetup -f
/dev/loop0
# losetup /dev/loop0 /storage/sdcard0/swap1
losetup: /dev/loop0: No such file or directory
I think the loop module is not loaded in the kernel, how do i load it? and where can i find the module?
Click to expand...
Click to collapse
Why not use my multitasking mod?
From universe with my gs3
autumnwillow said:
I have already tried Siyah and Perseus kernel.
What I'm trying to do is create 2 small swap files one in internal sd and the other on the external sd. (Yes just a small memory bump will do)
...
Click to expand...
Click to collapse
IMHO swap on internal eMMC is one of the worst ideas ever. There is however somewhere a thread about how you can make one on SD.
xclub_101 said:
IMHO swap on internal eMMC is one of the worst ideas ever. There is however somewhere a thread about how you can make one on SD.
Click to expand...
Click to collapse
It's the same result I think for both SD and MMC. Using them as swap will shorten its life. But I'm okay with that. I plan to upgrade in the near future anyway.
What I'm not okay with is my poweramp music player pauses from playing flac files (choppy, not from notifications). Contacts/Phone/Messaging being too slow to load. Other apps also reloading too much. Not much of multitasking.
Currently i use zram with Yank's kernel. And believe me the 250mb zram is being consumed well.
The idea was to create 2 small swap files (larger) and setting priorities to them. 1 for the faster internal sd and 2 for external sd. Using swapon -p 1/2 swapfile
Why large files? Lesser rewrites. More sd life.

[PIT] SGH-S959G: Merge /data and /storage/sdcard0 (/data/media mod)

HOW TO:
Merge "Internal Storage" (/storage/sdcard0) and "Data" (/data) partitions.
WHY:
1) Eliminate "not enough storage" limitation on installed apps. Install as many as you want.
2) Increase potential Internal Storage space (adding unused space from the /cache /preload /data and /emmc partitions together into one mega partition).
3) True full device encryption for /data and /storage/sdcard0 (if you desire).
OVERVIEW OF HOW IT WORKS:
1) Use Odin to flash a modified PIT file to repartition your device. /data is sized to 14+ GB, /cache, /preload, and /emmc are all downsized to 10MB each and are unused.
2) Use my script to modify your ROM to store your "Internal Storage" files on the /data/media/0 folder. This script will hijack your "su" and "sdcard" binaries to work properly.
3) Use my custom TWRP recovery for all of your recovery needs (supports encryption).
4) Encrypt your device if you like.
DIFFICULTY:
Medium
REQUIRED SKILLS:
1) Know how to use ADB
2) Know how to use Odin
3) Know how to fully backup your device and restore it after a factory reset.
SUPPORTED DEVICES:
SGH-S959G ONLY
"COULD BE" SUPPORTED DEVICES:
***DO NOT USE THIS METHOD FOR ANYTHING OTHER THAN SGH-S959G OR YOU WILL RISK HARD-BRICKING IT.
***IF YOU WANT TO TRY IT OUT THEN YOU MUST POST TO THIS FORUM FIRST AND WE WILL DISCUSS
***GETTING YOUR DEVICE SUPPORTED
***Possibly SGH-I777
***Possibly SGH-I9100
***Maybe Others
SUPPORTED ROMS:
CyanogenMOD 12+ (and probably derivative ROMs)
*Risk of soft brick if trying on another ROM (but no higher risk of hard brick).
RISKS: There is a very small risk of hard-brick when flashing a PIT file to your device. To minimize your risk:
1) Don't try to flash during a thunderstorm.
2) Don't try to flash to an unsupported device.
3) Don't try to flash if your USB cable / port / charging port is damaged/faulty. YOU MUST HAVE A RELIABLE USB PORT
4) Don't try to flash with your battery at 0%.
5) Don't try to flash with a computer that likes to crash a lot.
6) Don't unplug or restart your device or computer in the middle of a flash (it takes 10 seconds, be patient, geez).
STEPS TO INSTALL:
Step #1:
Make 2 backups of everything on your phone. All partitions, sdcard, micro-SD, etc...
MOVE THESE BACKUPS TO YOUR COMPUTER, THEY WILL BE ERASED FROM YOUR PHONE.
Make sure you know how to fully restore a completely wiped phone (without a preinstalled recovery) using the computer backups, starting only from the phone's BOOTLOADER/Download/Odin mode.
If you don't know how to do this, you must stop here.
PROCEEDING WITH THIS TUTORIAL WILL PERMANENTLY WIPE MOST PARTITIONS ON YOUR PHONE, THAT INCLUDES: /cache /modem /system /data /emmc /preload
Did you back up your /efs?
BACK UP YOUR /efs!!!
Step #2: Download all attached files.
Step #3: Verify that you have an uncorrupted version of both PIT files. To do this, use the md5 tool (attached) in the windows command line:
> md5 Original_SGH-S959G.pit
Output should read:
7237EC02379B497C6028236B5BBC0C91 Original_SGH-S959G.pit
> md5 MEGADATA_SGH-S959G.pit
Output should read:
9036368F41FAD9FAA266D08398EA2A33 MEGADATA_SGH-S959G.pit
If the MD5 sums don't match, STOP HERE.
DO NOT FLASH A .PIT FILE IF THE MD5 SUM IS WRONG.
Step #5: Install recovery ...
SGH-S959G_TWRP_v2.8.7.0_datamedia.zip
Step #6: Flash PIT
Did you do Step 3? Do it again, don't be lazy.
Open Odin (attached), click the PIT button. Select MEGADATA_SGH-S959G.pit
Re-Partition, Auto Reboot and F. Reset Time should be checked. The PIT filename should appear next to the PIT button.
NOTHING ELSE SHOULD BE CHECKED.
Boot your phone into bootloader/download mode and connect it. The first ID:COM field should turn yellow and have text that looks like 0:[COM5]. In the message field you will see something like <ID:0/005> Added!
Review the risks of what you're about to do above.
Hold your breath, press the start button.
Flashing takes about 10 seconds. Once it's done your phone will reboot. You can close Odin at this point.
Step #7: Format partitions.
Boot into recovery.
Format EMMC: adb shell make_ext4fs mmcblk0p11
Format PRELOAD: adb shell make_ext4fs mmcblk0p12
Wipe CACHE using recovery interface (from advanced wipe screen).
Format DATA using recovery interface (special button present on wipe screen) .
Wipe INTERNAL STORAGE using recovery interface (from advanced wipe screen).
Step #8: Restore partitions.
Reboot into recovery (you must do this again after you format, and the recovery must be datamedia version if you are installing, regular version if you are uninstalling - did you follow step #5?).
... restore your /modem /system /data and /emmc partitions. /cache and /preload should not be restored.
Step #9: Modify Android ...
(I tested on a fully booted android system, but probably works from recovery too.)
Run these commands (obviously correcting the "C:datamedia_installer" path).
*********************************
** If installing from recovery **
*********************************
** mount /data **
** mount /system **
*********************************
adb root
adb push "C:datamedia_installer" /data/local/datamedia_installer
adb shell chmod 700 /data/local/datamedia_installer
To Install: adb shell /data/local/datamedia_installer install
Note: If you ever flash a new ROM in the future it will likely disable this mod. You'll have to do the Step #9 command(s) again.
To Uninstall: adb shell /data/local/datamedia_installer uninstall
Reboot.
Step #10: Adjust /data/media permissions ...
adb root
adb shell chown -R media_rw /data/media/0
adb shell chgrp -R media_rw /data/media/0
adb shell find /data/media/0 -type d -exec chmod 775 {} +
adb shell find /data/media/0 -type f -exec chmod 664 {} +
adb shell chcon -R ubject_r:media_rw_data_file:s0 /data/media/0
Congratulations, if you made it this far you're golden.
STEPS TO UNINSTALL:
Step #1: Install recovery ...
SGH-S959G_TWRP_v2.8.7.0.zip
Step #2: MD5 Verify and then Flash PIT ... (see Step #6 above)
Original_SGH-S959G.pit
Step #3: Format Partitions ... (see Step #7 above)
Step #4: Restore partitions ... (see Step #8 above)
Make sure you are using regular version, not datamedia version.
**You can optionally skip the /emmc restore at this point, and instead finish Step #5 below, then restore to /storage/sdcard0 while Android is running (not in recovery). This should (theoretically) setup the right permissions so you can skip step #6 below.
Step #5: Modify Android ... (see Step #9 above)
Only difference is the first argument for datamedia_installer script (use "uninstall")
Step #6: Adjust /mnt/media_rw/sdcard0 permissions ...
Not sure exactly what the permissions need to be, never had to do this. Let me know if you are trying to do this and I can help you troubleshoot.
**See my note in uninstall Step #4 if you are having trouble here.
XDA:DevDB Information
[PIT] SGH-S959G: Merge /data and /storage/sdcard0 (/data/media mod), Tool/Utility for the AT&T Samsung Galaxy S II SGH-I777
Contributors
dimoochka, Lanchon (thanks for the idea!)
Version Information
Status: Stable
Created 2015-10-07
Last Updated 2015-10-07
great work!
for those wanting to peek at the script without downloading 17MB...
Code:
if [ $1 ] && [ $1 == "install" ]
then
if [ -e /system/bin/sdcard_bin ]
then
echo "Already installed."
else
mount -o remount,rw /system
cp /system/xbin/su /data/local/su_bin_backup
cp /system/bin/sdcard /data/local/sdcard_bin_backup
chmod 700 /data/local/su_bin_backup /data/local/sdcard_bin_backup
cp /system/bin/sh /system/bin/sdcard_sh
mv /system/bin/sdcard /system/bin/sdcard_bin
mv /system/xbin/su /system/xbin/su_bin
echo "#!/system/bin/sdcard_sh" > /system/bin/sdcard
echo "" >> /system/bin/sdcard
echo "while true; do" >> /system/bin/sdcard
echo " sleep 10000" >> /system/bin/sdcard
echo "done" >> /system/bin/sdcard
echo "if [ \$7 ] && [ \$7 == \"/storage/sdcard0\" ]" >> /system/bin/sdcard
echo "then" >> /system/bin/sdcard
echo "fi" >> /system/bin/sdcard
echo "#!/system/bin/sh" > /system/xbin/su
echo "" >> /system/xbin/su
echo "if [ \$1 ] && [ \$1 == \"--daemon\" ]" >> /system/xbin/su
echo "then" >> /system/xbin/su
echo " /system/xbin/sdcardd&" >> /system/xbin/su
echo "fi" >> /system/xbin/su
echo "/system/xbin/su_bin \"\[email protected]\"" >> /system/xbin/su
echo "#!/system/bin/sh" > /system/xbin/sdcardd
echo "" >> /system/xbin/sdcardd
echo "while [ \"\$mprop\" != running ]; do" >> /system/xbin/sdcardd
echo " sleep 1" >> /system/xbin/sdcardd
echo " mprop=\`getprop init.svc.fuse_sdcard0\`" >> /system/xbin/sdcardd
echo "done" >> /system/xbin/sdcardd
echo " setenforce 0" >> /system/xbin/sdcardd
echo " runcon u:r:init:s0 /system/bin/sh -c \"
setenforce 1;
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/usbdisk0 /storage/usbdisk0&
\"&
" >> /system/xbin/sdcardd
chmod 755 /system/xbin/su /system/xbin/sdcardd
chmod -R 755 /system/bin/sdcard /system/bin/sdcard_sh
chown -R root /system/bin/sdcard /system/bin/sdcard_sh
chgrp -R shell /system/bin/sdcard /system/bin/sdcard_sh
chcon u:object_r:su_exec:s0 /system/xbin/su
chcon u:object_r:su_exec:s0 /system/xbin/sdcardd
chcon u:object_r:sdcardd_exec:s0 /system/bin/sdcard
chcon u:object_r:sdcardd_exec:s0 /system/bin/sdcard_sh
mount -o remount,ro /system
echo "Successfully installed (you can ignore any device busy errors and should not see any other errors)."
fi
fi
if [ $1 ] && [ $1 == "uninstall" ]
then
if [ -e /system/bin/sdcard_bin ]
then
mount -o remount,rw /system
mv -f /system/bin/sdcard_bin /system/bin/sdcard
mv -f /system/xbin/su_bin /system/xbin/su
rm /system/bin/sdcard_sh
rm /system/xbin/sdcardd
mount -o remount,ro /system
echo "Successfully installed (you can ignore any device busy errors and should not see any other errors)."
else
echo "Not installed."
fi
fi
This looks interesting to me, I have the 4 GB pit mod on my S959G and I have been wondering if one could take the internal SD card space and put it to /data. You made my day with this but has anyone had luck in doing this mod and using xposed modules to make the external SD card the card apps, music, pictures, downloads, and etc folders as a fake internal SD card or is that what modding the android system does so that ROMs see the external SD card as the only expandable memory directory?
Sent from my CM 10 Toshiba Thrive using XDA Free mobile app
cidlover said:
This looks interesting to me, I have the 4 GB pit mod on my S959G and I have been wondering if one could take the internal SD card space and put it to /data. You made my day with this but has anyone had luck in doing this mod and using xposed modules to make the external SD card the card apps, music, pictures, downloads, and etc folders as a fake internal SD card or is that what modding the android system does so that ROMs see the external SD card as the only expandable memory directory?
Sent from my CM 10 Toshiba Thrive using XDA Free mobile app
Click to expand...
Click to collapse
In a nutshell, this is what my mod does:
/data points to mmcblk0p10 (I think off the top of my head)
/storage/sdcard0 points to /mnt/media_rw/sdcard0 which points to mmcblk0p11 (I think off the top of my head)
By installing my PIT, you severely shrink mmcblk0p11 and expand mmcblk0p10 to monster size.
My script then changes the location that /storage/sdcard0 points to (to /data/media/0 which is located on mmcblk0p10).
Android puts everything (pictures, downloads, etc.) by default onto /storage/sdcard0 -> so these files get redirected to the partition which has all the space (/data/media/0 or mmcblk0p10).
So, to answer your question, an Xposed mod to redirect all of that stuff to /storage/sdcard1 (external SD) instead may or may not work depending on the method it uses. If it tells the system that the default directory to use is /storage/sdcard1 via some environment variable or method then there should be no interaction (which is probably the way that the mod works; that's the simplest method). If it does some unmounting/mounting of directories then that may interfere with my script depending on the timing with which the Xposed mod activates.
If you decide to try to get Xposed to do this and it doesn't work - let me know what mod you're using. I can fix my script to accommodate it.
Alternatively, you don't even need Xposed. Instead you can just edit the script at this point (in notepad):
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
First line: change /storage/sdcard0 to /storage/sdcard1
Second line: change storage/sdcard1 to /storage/sdcard0
*don't add/remove any whitespace or new lines (or really change anything other than the 0 and 1) or you may break the script
This will swap the folders so that /storage/sdcard0 points to external SD and /storage/sdcard1 points to /data/media/0.
Why do you want to do this anyway? 14+ gigs of /data not enough for your carefully curated porn collection?
dimoochka said:
In a nutshell, this is what my mod does:
/data points to mmcblk0p10 (I think off the top of my head)
/storage/sdcard0 points to /mnt/media_rw/sdcard0 which points to mmcblk0p11 (I think off the top of my head)
By installing my PIT, you severely shrink mmcblk0p11 and expand mmcblk0p10 to monster size.
My script then changes the location that /storage/sdcard0 points to (to /data/media/0 which is located on mmcblk0p10).
Android puts everything (pictures, downloads, etc.) by default onto /storage/sdcard0 -> so these files get redirected to the partition which has all the space (/data/media/0 or mmcblk0p10).
So, to answer your question, an Xposed mod to redirect all of that stuff to /storage/sdcard1 (external SD) instead may or may not work depending on the method it uses. If it tells the system that the default directory to use is /storage/sdcard1 via some environment variable or method then there should be no interaction (which is probably the way that the mod works; that's the simplest method). If it does some unmounting/mounting of directories then that may interfere with my script depending on the timing with which the Xposed mod activates.
If you decide to try to get Xposed to do this and it doesn't work - let me know what mod you're using. I can fix my script to accommodate it.
Alternatively, you don't even need Xposed. Instead you can just edit the script at this point (in notepad):
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
First line: change /storage/sdcard0 to /storage/sdcard1
Second line: change storage/sdcard1 to /storage/sdcard0
*don't add/remove any whitespace or new lines (or really change anything other than the 0 and 1) or you may break the script
This will swap the folders so that /storage/sdcard0 points to external SD and /storage/sdcard1 points to /data/media/0.
Why do you want to do this anyway? 14+ gigs of /data not enough for your carefully curated porn collection?
Click to expand...
Click to collapse
Lol, no, I wanted to see if we turn, in theory, our Galaxy S2 phones into a phone with no Internal Memory and the only expandable memory is a external sd card to expand it, i just was thinking a few xposed modules can help after doing this mod.
cidlover said:
Lol, no, I wanted to see if we turn, in theory, our Galaxy S2 phones into a phone with no Internal Memory and the only expandable memory is a external sd card to expand it, i just was thinking a few xposed modules can help after doing this mod.
Click to expand...
Click to collapse
Just to clarify, the behavior of the device after this mod is identical. If installed properly, this mod does not create any new problems that need fixing. It still behaves exactly the same as if an internal storage partition exists.
dimoochka said:
Just to clarify, the behavior of the device after this mod is identical. If installed properly, this mod does not create any new problems that need fixing. It still behaves exactly the same as if an internal storage partition exists.
Click to expand...
Click to collapse
Sorry to bring this up again, but how is sd card data handled? Like .obb files in the Android folder on the internal SD card after this mod. And has anyone tried this mod yet?
cidlover said:
Sorry to bring this up again, but how is sd card data handled? Like .obb files in the Android folder on the internal SD card after this mod. And has anyone tried this mod yet?
Click to expand...
Click to collapse
Real simple. Instead of files being placed into /storage/sdcard0 they are redirected to /data/media/0. At the end of the day that is the primary difference.
The /data/media/obb folder remains empty (I have no idea what this is used for normally).
I've been using this mod for 2 months, it's worked great. I think me and you are probably the only two people interested in doing it :laugh:
dimoochka said:
The /data/media/obb folder remains empty (I have no idea what this is used for normally).
Click to expand...
Click to collapse
http://blog.notfaqs.com/2013/05/android-obb-files-location.html
http://developer.android.com/google/play/expansion-files.html
/system 1gb
I would like to get some help modifying the /system partition to be 1 gb is there any help i can get?

Viewing Internal Storage of [generic phone] as Mass Storage to recover deleted file?

I have this cheap generic [Alcatel Idol 2 Mini] phone, I want to recover a [simple TXT, HTML, XML] file from a generic [Tomdroid] app its Internal Storage I accidentally deleted, with Windows software Recuva.
Windows only shows Internal Storage when I connect the device as Media Device (MTP), and I even see my deleted file there, I just cannot copy-paste it to Windows desktop. When I connect the device as SD Card, the SD Card shows up as Mass Storage under Windows, but only the SD Card, Internal Storage remains hidden then.
Recuva is a good tool to recover deleted files. How to get back my file?
I understand my only option maybe to root the phone. Hopefully, there is a simpler solution. If I have to root, I don't get it: won't Internal Storage be screwed up anyways by the rooting process, overwriting my file I want to recover in the process?
You can mount your data partition on custom recovery over adb shell.
type this codes on terminal to mount your data(included sdcard) as mass storage.
Code:
adb shell
cd /sys/devices/virtual/android_usb/android0
(sleep 5 && echo 0 > enable && echo "adb,mass_storage" > functions && echo "/dev/block/mmcblk0px" > f_mass_storage/lun/file && echo 1 > enable)&
(replace mmcblkpx to your your device's spesific userdata partition code.)
@asderdd, thank you for your help!
Let's put this first: What should I see as a result of these adb commands, if the hack is successful? What I want to accomplish is the Recuva Windows program to see the Internal Storage of my phone for a file recovery.
[Meta: I'm not sure where I was supposed to ask this kind of question in the first place, if I don't own one of the more popular, more expensive phones, whose topics has most of the traffic and discussion on the site.]
Okay, I installed the '15 seconds ADB Installer' and the phone's drivers to my Windows box.
1st step, success:
c:\adb>adb shell
[email protected]_3G:/ $
2nd step, success:
[email protected]_3G:/ $ cd /sys/devices/virtual/android_usb/android0
[email protected]_3G:/sys/devices/virtual/android_usb/android0 $
> replace mmcblkpx to your your device's spesific userdata partition code.
I have /dev/block/platform and /dev/block/vold, let's thy these.
1st, /dev/block/platform:
orage" > functions && echo "/dev/block/platform" > f_mass_storage/lun/file && *
[1] 8775
[email protected]_3G:/sys/devices/virtual/android_usb/android0 $ /system/bin/sh: can't create enable: Permission denied
[1] + Done (1) ( sleep 5 && echo 0 >enable && echo "adb,ma [email protected]_3G:/sys/devices/virtual/android_usb/android0 $
No success.
2nd, /dev/block/vold:
orage" > functions && echo "/dev/block/vold" > f_mass_storage/lun/file && echo*
[1] 8798
[email protected]_3G:/sys/devices/virtual/android_usb/android0 $ /system/bin/sh: can't create enable: Permission denied
[1] + Done (1) ( sleep 5 && echo 0 >enable && echo "adb,ma
[email protected]_3G:/sys/devices/virtual/android_usb/android0 $
No success. What to do next? Thank you!
i think alcatel nowadays have they called "emulated storage" meaning, the internal storage is actually save in a shared folder in data partition. you should try to look a file recovery software for android on the web instead
.
I tried Dr.Fone, which is said to be the best in this category of software tools. It still doesn't show me all files like Recuva, just files in categories, like photos, music.
In file explorer, I see the following:
'emulated' - This is empty
'sdcard0' - Internal Storage for Windows
'sdcard1' - my real SD card
Can you help me with this?
I also asked moderation if I could change this topic from this Q&A format to a normal topic. I realized it wasn't a good idea.
Please help! I'm almost (?) there.
Maybe it's the program, maybe it doesn't let you copy it because you maybe aren't using full/pro/paid version. Sorry, can't help you tho, not specialized...
Maybe it's the program, maybe it doesn't let you copy it because you maybe aren't using full/pro/paid version. Sorry, can't help you tho, not specialized...
Huh? Please specify? What program do you refer to? Are you talking about the full/pro/paid version of which program? I lost the line.
Sorry, this Q&A format hasn't turned out to be much of help. This topic redirects here.

/sdcard and /storage/sdcard0 symlinks being broken at boot.

Hi I am a newbie here and I hope I posted on the correct forum.
I am having a problem with my Spreadtrum SC7731 phone. It's internal storage symlink which is /sdcard /storage/sdcard0 is being broken at boot(I think). This started when I flashed supersu through twrp to root the phone. This happens after booting and then a notification will pop up and say "SD card removed, please insert a new one". After that prompt, Apps will then lose access to the Internal Storage and when you check the /storage directory, there is a sdcard0 folder inside it but it is not linked to /storage/emulated/0 which makes this directory virtually useless. I have figured out a work around myself by deleting the directories created at boot and recreating the symlinks with a small script I created:
Code:
su
rm -R /sdcard
rm -R /storage/sdcard0
ln -s /storage/emulated/0 /sdcard
ln -s /storage/emulated/0 /storage/sdcard0
after running this script, apps will have access to the internal storage and the /sdcard in the root directory is again accessible. But sometimes, it will lose its symlinks again so I have to run the script if it happens.
Again this happens after booting, then a notification will appear that the sdcard has been removed. after that happens, I checked the symlinks and its broken.
I don't really know what is the root cause but the work around is quite a hassle for me. I am looking for like a permanent solution to fix this. I don't have an External SD Card and I am not planning on buying one since the Internal Storage is Enough for me as I do not game on this phone.
bump
Bump
help pls

Wanting to automatically move files off of internal storage

I have found myself repeatedly moving the downloads and photos folders to my external SD card, so I decided to try and make a small script or binary that can automate this task without consuming much space. I tried a plethora of "compilers" that run in android, and only Termux with clang could create a file transfer binary, but it can only write to one folder in the external storage, in its app data.
So, I'm asking, is there any way to automate moving folders into the external storage that won't require a large app?
@psychoreactor
Take note that you can't move directories/files if FS of source location and target location is different: hence you have to use copy instead
A small shell script like this example
Code:
#!/system/bin/sh
cp -ar /sdcard/Photos /ext-sdcard/Photos /
rm -rf /sdcard/Photos
mkdir -p /sdcard/Photos
cp -ar /sdcard/Downloads /ext-sdcard/Downloads/
rm -rf /sdcard/Downloads
mkdir -p /sdcard/Downloads
does the job
You run such a script at pre-set time by means of Android's crond service, preferredly when Android boots + 20 seconds
IMHO a far better method ( what doesn't impact internal SD-card's lifespan ) is to format the external SD-card as EXT4 ( this is particularly important, as the file system used on the external SD-card is usually FAT or FAT32 ), create there folders Photos & Downloads, delete original folders, then symlink original folders to these new folders: This way all photos & downloads automatically land on external SD-card.
Code:
ln -s /ext-sdcard/Photos /sdcard/Photos
ln -s /ext-sdcard/Downloads /sdcard/Downloads

Categories

Resources