Android Batch File to Partition SD Card [11 Jun 2012] - Atrix 4G General

Android Batch File to Partition SD Card
This batch command file invokes the /sbin/parted and /sbin/tune2fs tools hosted by ClockWorkMod (CWM) Recovery 5.0.2.0 to control partitioning of your SD card for a variety of purposes, some of which are listed below.
It is a good idea to review the command line options and parameters of the parted and tune2fs tools: On your phone (for example, via computer-enabled ADB or terminal emulator), get root and enter:
# /sbin/parted --help
# /sbin/tune2fs --help
I decided to make this a separate thread for a number of reasons:
Streamline the process of making room for second ROM in a dual boot configuration (see http://forum.xda-developers.com/showthread.php?t=1651356 ). These commands can theoretically be rolled into a flashable zip to almost fully automate a dual-boot install of fixed ROMs, e.g. CM9 and CM7.
My Dual Boot threads have “sensory overload” written all over them
The amount of material presented here is probably enough to warrant a separate thread
This is an Android-friendly alternative to GParted/MiniTool. For example there is no need to pull SD card, partition and reinsert. Of course, GParted has the pleasant GUI and gives you a chance to review your changes before committing, whereas the Android “parted” tool is highly utilitarian.
Batch commands are quickly and easily modified to create/remove/adjust partitions. The general consensus is that for large files, ext3 R/W speeds are faster than those of FAT32. And ext3[4] is more stable and can handle files exceeding the maximum 4GB allowed by FAT32.
Batch commands are easily modified to perform customizations other than dual boot
Some users may wish to host their entire system on SD card: ROM, music, pictures, movies etc.
Some users may wish to return their SD cards to a traditional single-boot state by running a subset of these batch commands
That said, I strongly advise that you NOT run these commands UNLESS you are comfortable with ALL of the following:
1. /sdcard (FAT32) and ALL subdirectories copied to /emmc/sdcard-backup. Ask yourself: Do I have enough space left on my 10GB emmc partition to host a full backup of /sdcard? AND, will there be enough room on the /sdcard filesystem to restore this backup AFTER downsizing my SD card's FAT32 partition?
2. Any existing ext* partitions of SD card are blown away, for example those generated by a previous dual boot zip install. In other words, you lose /system, /cache and /data from an existing sdcard-based ROM.
3. You MAY lose all data on your (backed-up) FAT32 partition depending on what boundaries were used for resizing.
Note that I do not include a command to push /emmc/sdcard-backup back onto SD card. That is because:
There may not be enough room on /sdcard after a FAT32 downsize, and
There may be a data conflict when flashing a different dual boot configuration as opposed to an updated one. But at least there is a full backup of /sdcard FAT32 --- assuming emmc has enough room to host it.
Presently there is no logic to detect the storage limits of the /emmc and /sdcard filesystems. I will leave that to you.
SO... if for ANY reason you are NOT comfortable with the potential changes outlined above, I recommend that you please STOP HERE and consider researching this topic further until you are comfortable.
For those willing and able to give this a try, I strongly recommend first performing an ADB-assisted run (i.e. with a computer hosting Android SDK Platform Tools) using an SD card with at least 4GB open (to be safe) AND with enough room on emmc to host a FULL backup of your entire /sdcard filesystem (/sdcard and all its subdirectories).
Fully charge your battery! CWM draws a lot of current, even if nothing else is running.
Boot phone to CWM
Connect phone to computer
Launch ADB shell to access phone
# adb shell (can do this on any ADB-enabled machine)
Get root (enter “su” at phone shell command prompt) and copy/paste/enter each and every command (those not prefixed by "echo") in your computer's command window:
Code:
#! /bin/sh
echo "Android batch script to create ext partitions for SD card-based ROM"
echo
echo "First unmount all filesystems of primary (emmc) ROM"
umount /system > /dev/null 2>&1
umount /cache > /dev/null 2>&1
umount /data > /dev/null 2>&1
echo
echo "Mount external (sdcard) and internal (emmc) memory"
mount /sdcard > /dev/null 2>&1
mount /dev/block/mmcblk0p18 /emmc > /dev/null 2>&1
echo
echo "Create sdcard-backup directory on emmc with current date and time"
echo "Recommend delete any unnecessary backups of sdcard at this point"
bkdir="sdcard-backup-`date +%d-%b-%Y-%H%M%S`"
mkdir /emmc/$bkdir > /dev/null 2>&1
echo
echo Backup directory: /emmc/$bkdir
echo
echo "Press ENTER to continue..." ; read
echo
echo "Backing up contents of sdcard FAT32 to emmc"
cp -a /sdcard/* /emmc/$bkdir/
echo
echo Done...
ls -ld /emmc/$bkdir
echo
echo "Unmount internal and external memory"
umount /emmc > /dev/null 2>&1
umount /sdcard > /dev/null 2>&1
echo
echo "Show existing partition map of SD card"
parted /dev/block/mmcblk1 print
echo
echo "Press ENTER to continue..." ; read
echo
echo "Delete any existing ext* partitions and show results"
parted /dev/block/mmcblk1 rm 4 > /dev/null 2>&1
parted /dev/block/mmcblk1 rm 3 > /dev/null 2>&1
parted /dev/block/mmcblk1 rm 2 > /dev/null 2>&1
parted /dev/block/mmcblk1 print
echo
echo "Press ENTER to continue..." ; read
echo
echo "Resize START/STOP values MUST be expressed in MB"
echo "Downsize FAT32 and generate new ext2 partitions"
echo "Resize START/STOP values MUST be expressed in MB!"
echo "This example shows TYPICAL repartitioning of 16GB card..."
parted /dev/block/mmcblk1 resize 1 4.194 10700
parted /dev/block/mmcblk1 mkpartfs primary ext2 10.7GB 11.1GB
parted /dev/block/mmcblk1 mkpartfs primary ext2 11.1GB 11.8GB
parted /dev/block/mmcblk1 mkpartfs primary ext2 11.8GB 13.9GB
echo
echo "Upgrade from ext2 to ext3"
tune2fs -j /dev/block/mmcblk1p2
tune2fs -j /dev/block/mmcblk1p3
tune2fs -j /dev/block/mmcblk1p4
echo
echo "Review changes"
parted /dev/block/mmcblk1 print
echo
echo "Press ENTER to continue..." ; read
echo
echo "Final review. Mount SD card ROM filesystems"
mount /dev/block/mmcblk1p2 /system > /dev/null 2>&1
mount /dev/block/mmcblk1p3 /cache > /dev/null 2>&1
mount /dev/block/mmcblk1p4 /data > /dev/null 2>&1
echo
echo "Show used and available space (in MB) on all mounted filesystems"
df -m
echo
echo "Unmount SD card ROM filesystems"
umount /system
umount /cache
umount /data
echo
echo "Remount emmc ROM /cache (CWM mounts this by default)"
mount /cache > /dev/null 2>&1
echo
echo "Done. Can now (if necessary) wipe /cache and /data for primary ROM and flash dual boot zip"
echo
And now ... here are unedited results of a successful batch run made on 11 Jun 2012 at 1630 PDST
Code:
~ # sh /tmp/part-sdc.sh
Android batch script to create ext partitions for SD card-based ROM
First unmount all filesystems of primary (emmc) ROM
Mount external (sdcard) and internal (emmc) memory
Create sdcard-backup directory on emmc with current date and time
Recommend delete any unnecessary backups of sdcard at this point
Backup directory: /emmc/sdcard-backup-11-Jun-2012-233034
Press ENTER to continue...
Backing up contents of sdcard FAT32 to emmc
Done...
drwxrwxrwx 16 root root 8192 Jun 11 23:36 /emmc/sdcard-backup-11-Jun-2012-233034
Unmount internal and external memory
Show existing partition map of SD card
Model: SD SU16G (sd/mmc)
Disk /dev/block/mmcblk1: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 10.7GB 10.7GB primary fat32 lba
2 10.7GB 11.1GB 395MB primary ext2
3 11.1GB 11.8GB 707MB primary ext2
4 11.8GB 13.9GB 2097MB primary ext2
Press ENTER to continue...
Delete any existing ext* partitions and show results
Model: SD SU16G (sd/mmc)
Disk /dev/block/mmcblk1: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 10.7GB 10.7GB primary fat32 lba
Press ENTER to continue...
Resize START/STOP values MUST be expressed in MB
Downsize FAT32 and generate new ext2 partitions
Resize START/STOP values MUST be expressed in MB!
This example shows TYPICAL repartitioning of 16GB card...
Information: You may need to update /etc/fstab.
Information: You may need to update /etc/fstab.
Information: You may need to update /etc/fstab.
Information: You may need to update /etc/fstab.
Upgrade from ext2 to ext3
tune2fs 1.41.6 (30-May-2009)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
tune2fs 1.41.6 (30-May-2009)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
tune2fs 1.41.6 (30-May-2009)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
Review changes
Model: SD SU16G (sd/mmc)
Disk /dev/block/mmcblk1: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 10.7GB 10.7GB primary fat32 lba
2 10.7GB 11.1GB 395MB primary ext3
3 11.1GB 11.8GB 707MB primary ext3
4 11.8GB 13.9GB 2097MB primary ext3
Press ENTER to continue...
Final review. Mount SD card ROM filesystems
Show used and available space (in MB) on all mounted filesystems
Filesystem 1M-blocks Used Available Use% Mounted on
tmpfs 408 0 408 0% /dev
/dev/block/mmcblk1p2 353 8 326 2% /system
/dev/block/mmcblk1p3 632 16 582 3% /cache
/dev/block/mmcblk1p4 1874 32 1742 2% /data
Unmount SD card ROM filesystems
Remount emmc ROM /cache (CWM mounts this by default)
Done. Can now (if necessary) wipe /cache and /data for primary ROM and flash dual boot zip
~ #
All you brave testers out there, please let me know if you see anything amiss. Thanks!
Disclaimer
Standard disclaimers apply. In short, I am not responsible for any harm you or your phone may incur by using any or all of this material.
Enjoy.
References
http://androidos.in/2009/11/manually-partition-sd-card-for-android/
http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html
http://linux.die.net/man/8/tune2fs

Successfully Installed Dual Boot After Running Batch SD Card Partitioner
Shortly after running Android Batch SD Card Partitioner, I successfully flashed Dual Boot Zip v1.4: http://forum.xda-developers.com/showthread.php?t=1651356 featuing AOKP+Aroma_37a (emmc) and CM7 RC3 (sdcard)

don't know if that is the correct place
Hello,
Thanks for your patch, I am facing an issue with my Atrix (Orange UK), I have scrued up my internal storage, here I have posted once a Question but got no reply from nobody (POST).
Am I right to ask here, or is it wrong place too
Thanks and Thumbs up for the nice work
Ammar

Arwany said:
Hello,
Thanks for your patch, I am facing an issue with my Atrix (Orange UK), I have scrued up my internal storage, here I have posted once a Question but got no reply from nobody (POST).
Am I right to ask here, or is it wrong place too
Thanks and Thumbs up for the nice work
Ammar
Click to expand...
Click to collapse
Hello Ammar,
Please see my answer here: http://forum.xda-developers.com/showthread.php?p=27311205#post27311205
I hope this helps
sendust7

Related

Creating Android's very own SDCard filesystem

If I were to create a 1.5gb fakesd.img ext2 file
done once, on computer
dd if=/dev/zero of=fakesd.img bs=1048576 count=1536
mke2fs -F fakesd.img
--------
done in rootfs-init
losetup /dev/block/loop2 /sdcard/fakesd.img
mount -t ext2 -o noatime,nodiratime /dev/block/loop2 /fakesd
change " symlink /mnt/sdcard /sdcard/ " in rootfs-init.rc
symlink /mnt/sdcard /fakesd/
probably want to avoid changing the external path from /mnt/sdcard/ to anything.. for compatibility sake..
I have my windows stuff on my card. I want android to index as little as possible yet still be able to access my sd card at /sdcard.. Will this work?
I have a feeling that someone is just going to tell me to partition card. I don't feel like it right now..
Partition the card Just kidding, but I like your thinking.
Trying to test it out post boot.. My router has more command line functionality, thanks Google.

[fix new sdcard] little Solution (Partitioning)

hi
I have two 8GB class4 memory card but when I'm just a partition're doing very bad work
Android is reset
apps are broken
High and low speed is
And ...
But when a 2GB partition, I just work very well
Benchmarking partition is much better!
no more problem in android!
So I decided two partitions 2 and 6 GB and the second partition so I just do mount
Method:
1- Memory partitioning (first partition 2gb fat32)
2- copy android in first partition & run it
3- in android terminal type:
Code:
ls /dev/block/m*
or adb
Code:
adb shell ls /dev/block/m*
result like this:
Code:
/dev/block/mmcblk0
/dev/block/mmcblk0p1
/dev/block/mmcblk0p2
/dev/block/mmcblk0p3
Partition testing can be yours for the mount
1- make a folder (not in /sdcard & /mnt/sdcard)
Code:
mkdir /mnt/sd2
now test (for fat32): (just change mmcblk0p2)
Code:
mount -t vfat -o fmask=0000,dmask=0000,rw,flush,noatime,nodiratime /dev/block/mmcblk0p2 /mnt/sd2
(for ext2)
Code:
mount -t ext2 -o noatime,nodiratime /dev/block/mmcblk0p2 /mnt/sd2
Now the partition should be on the /mnt/sd2 mounted
and you can mount in boot
backup /init
open init and past mount cammand below this line :
Code:
PATH=/sbin:/system/sbin:/system/bin:/bin:/system/xbin:/system/xbin/bb:/data/local/bin
now we have auto mount partition
but we have one problem! we should link /mnt/sd2 > /mnt/sdcard
Who s the solution?
interesting idea. will try out.

[HOW-TO] Make Ext4 from Recovery Without Losing FAT32 Data

I've seen a lot of threads detailing how to create an Ext4 partition using Gparted but if you don't want to download the image and would rather do it all on your phone, here's how:
This entire procedure should take less than 5min so you can go back to messing with your phone in other ways.
REQUIRES:
CLOCKWORK MOD RECOVERY
ADB
FINGERS
I am not responsible for any damage done to your phone doing this process. =.=
1. Download the zip file provided.
2. Extract the zip file to the same folder you have ADB in. (You should now have a folder named ext4 in the same folder you have ADB)
3. Reboot the phone into MAGDLR. Then select the option to boot into the recovery.
4. Make sure that /system/ is mounted using the option to mount partition in Clockwork Recovery.
5. Open a command (cmd) prompt and cd into your folder with ADB.
6. Run these commands in the command prompt. (Commands are in BOLD)
adb push ext4 /system/etc/
adb shell
parted /dev/block/mmcblk0
print (make note of the total size of your partition here)
resize 1 0 xxxx (where xxxx is the size you want for your FAT32 partition. It should equal total size of your partition that you gleaned from print minus 1024 for the ext4 partition you're about to set up)
mkpartfs primary ext2 xxxx yyyy (where xxxx is where your previous partition ended and yyyy is the total size of your sdcard)
.... (Let it do its thing. Shouldn't take more than a minute)
print (Make sure that everything is correct: You have a fat32 partition running from 0 to xxxx and an ext2 partition running from xxxx to the total size of your partition)
quit
Now to utilize the two files we previously pushed to /system/etc/
chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/e2fsck
/system/etc/tune2fs -j /dev/block/mmcblk0p2 <- You now have ext3
/system/etc/tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2 (Note: CAsE SEnSitiVE)
/system/etc/e2fsck -fpDC0 /dev/block/mmcblk0p2 (Note: CAsE SEnSitiVE) <- You now have ext4
7. You can check that it's truly ext4 by:
parted /dev/block/mmcblk0
print (It should now read that you have a FAT32 and an ext4 partition.)
quit
You're all done! Now you have a 1GB ext4 partition for all your data and apps. If you know what you're doing, these same steps can be modified so that you have two ext4 partitions if you'd like. You can also alter the size of your ext4 partition to something smaller if you don't have that many apps to install or have a smaller SDcard (512MB should be sufficient in most cases, 1GB is slightly overkill IMO)
i will try with my HD2. I need more space to install app on sd not on phone. Thanks so much
Hi, I follow your instruction but when I get a "Permision deined" error when I type in the following commond
/system/etc/tune2fs -j /dev/block/mmcblk0p2
Can you please help?
Many many thanks!!
justj said:
Hi, I follow your instruction but when I get a "Permision deined" error when I type in the following commond
/system/etc/tune2fs -j /dev/block/mmcblk0p2
Can you please help?
Many many thanks!!
Click to expand...
Click to collapse
Crap. I forgot a step. You have to type
chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/e2fsck
prior to using those files. That should fix the permission denied error.
I've edited the OP to reflect the changes, thanks for pointing that out.
Thanks man
Thanks Bro I have successfully make ext4 and I am enjoying my new Rom
Using HTC Desire runnymede 5.0
Amazing. I will keep it for future reference, although I partitioned my SD with CWM recovery and Gparted.
What kind of partition is made when using CWM? I made a 1GB partition on my card that way, and it works great. But I've heard good things about having it as ext4. How does this guide reflect the fact that I already have an SD-EXT on my card that's not necessarily ext4?
Thanks!
please help
please help me i cant get it to work... its same with /system mounted and unmounted...not even one 3rd app is working for me on my win 7 64x when i want to create ext4 this is my last hope. card is brand new 8gb ultra speed its working fine so cant be problem there. it seems like chmod 777 will delete that file..
Code:
C:\Users\OgziR\Desktop\adt-bundle-windows-x86_64-20130522\sdk\platform-tools>adb
push ext4 /system/etc/
push: ext4/tune2fs -> /system/etc/tune2fs
push: ext4/e2fsck -> /system/etc/e2fsck
2 files pushed. 0 files skipped.
1573 KB/s (603400 bytes in 0.374s)
C:\Users\OgziR\Desktop\adt-bundle-windows-x86_64-20130522\sdk\platform-tools>adb
shell
~ # /system/etc/tune2fs -j /dev/block/mmcblk0p2
/system/etc/tune2fs -j /dev/block/mmcblk0p2
/sbin/sh: /system/etc/tune2fs: Permission denied
~ # chmod 777 /system/etc/tune2fs
chmod 777 /system/etc/tune2fs
~ # /system/etc/tune2fs -j /dev/block/mmcblk0p2
/system/etc/tune2fs -j /dev/block/mmcblk0p2
/sbin/sh: /system/etc/tune2fs: not found
~ #
Hye... I have 2 question...
My phone is a HTC HD2 running an NexusHD2.ICS.CM9.HWA.V2.3 ROM... The cmd prompt cant seem so fine my device. Do have any advice on this???
Secondly, what do i do with the ext4.zip file??? I mean, do it extract it, or put in same folder with ADB??
Btw, i am Super Noob on this, so i apologize if my question offends anyone... 1000 apologizes...
OK, first of all, do you have adb installed correctly? If cmd prompt can't find your device that is the most likely problem.
As for what to do with ext4.zip, you need to extract it to your adb folder.
Sent from my Vivid 4G using xda app-developers app

[HACK] Grow your data partition

>>> Please note that Vashiru reworked this guide for reliability and alternate values, so I recommend you check his various posts in this thread starting with this one. <<<
Click to expand...
Click to collapse
THE PROBLEM
As many of us have noticed, it is fairly easy to get an "Out of space" message when installing apps on our phones because, for some weird reason, Oppo decided that the storage part of the device should linger in the dark ages, when /userdata and /sdcard were separate partitions and you only had 2GB of data storage, even if your phone was a 32GB model.
Now, imagine that you are running KitKat and would like to try ART. This may be a bad idea as, if your data partition is more than 30% full, you will find that while converting your apps to this new format, Android will run out of space.
At OppoForums, a few bright people started looking into the issue and, of course, there is a way to improve the situation.
WARNING!
If you follow the steps below correctly, you should not run in any trouble. If you do not, however, you may end up spending much more time fixing your phone.
FIRST, THE THANKS SECTION
Anders tinkered with his device’s partition table until he got to where he had grown the /userdata partition to something useable. Yes, it’s some people’s definition of “play”
Jousa11 is the first person trying to put a guide together explaining the steps to reproduce Anders’ work. WARNING: I did no get to see said guide as Jousa quickly deleted it due to the risks involved. So, take that in account!
Rockman for providing the last resort rescue tools in case you brick your phone
Lucky for providing the WiFi fix
Please let me know if you are not on this list and I forgot to give you credit!
YOU WILL NEED
The hardware:
An Oppo Find5 phone(!)
A computer (Windows/Linux/Mac) with adb installed and working
A USB cable
On your computer:
adb
[Optional] fastboot
On your phone (SDCard):
parted + mke2fs + tune2fs
mmcblk0p21_persist_ext4.img
openrecovery-twrp-2.6.3.0-find5-TP-patch.img
[Optional] gdisk
You will use parted to work on your partition table; mke2fs and tune2fs to create ext4 filesystems on some of these partitions (parted does not know how to create ext4 partitions)
mmcblk0p21_persist_ext4.img is an image that you need to restore your /persist partition and avoid issues such as non-working WiFi.
openrecovery-twrp-2.6.3.0-find5-TP-patch.img is a patched recovery image. I know: you already have a recovery image if you are going through these steps. However, we are going to wipe it so you want to install this guy before rebooting. Note that if you forget, you can always flash it later using fastboot.
On your computer:
adb to access your phone recovery, push files to SDCard, reboot...
[Optional] fastboot. You will only need fastboot if you mess up your recovery partition.
WHAT IF SOMETHING GOES AWFULLY WRONG?
You may “brick” your phone. Apparently it’s near impossible to hard brick your Find5, though. See below.
First, Anders recommends making a backup of your partition table. I didn’t because I felt that if I messed something up, it would be a partitions’ content rather than the partition table but that’s not the wisest approach.
Furthermore, if you are really worried about what stilly error your fat fingers will cause (I know I should be!) you can also backup your partitions.
Backing up your partition table:
On your phone:
Code:
gdisk -b /sdcard/gpt.bin /dev/block/mmcblk0
Backing up a single partition:
On your phone:
Code:
dd if=/dev/block/mmcblk0p<partition id> of=/sdcard/backup-<partition id>.bin
On your computer:
Code:
adb pull /sdcard/gpt.bin
adb pull /sdcard/backup-<partition id>.bin
LAST RESORT
OK. So, you've bricked your phone. Now what?
First, you will need Windows. So if you're on a Mac or Linux and have no access to a Windows machine/VM, er..don't brick your phone.
- Download drivers and tools
- Download and follow the instructions
READY ? LET'S GET STARTED
>>>>>>>>>>>> First, Download The Files <<<<<<<<<<<<
Then...
On your computer:
UPDATE As dixxa pointed out, mke2fs and tune2fs may already be present on your device. It was not the case for me but you should check first; it seems like a good idea to use existing binaries.
Code:
adb reboot recovery
adb push parted /sbin
adb push mke2fs /sbin
adb push tune2fs /sbin
On your phone:
Code:
chmod 755 /sbin/parted /sbin/mke2fs /sbin/tune2fs
umount /cache
umount /sdcard
umount /emmc
umount /data
parted /dev/block/mmcblk0
You are now in the parted shell.
CAREFUL! Do not delete any partition below 20 or you will enter "Big Oops" territory. I recommend typing carefully and, yes, staying away from copy/paste operations that may swallow a character like, say, the '2' in '20'
Note that the size value I am using here is '4GB' for /userdata (rather than 2GB). I guess you could make /userdata bigger than 4GB, in which case you would have to recompute all the offsets in the commands below(!)
Code:
# rm sdcard
rm 29
# 28 thru 23 are reserved
rm 28
rm 27
rm 26
rm 25
# rm recovery
rm 24
# rm misc
rm 23
# rm cache
rm 22
# rm persist
rm 21
# rm data/emmc
rm 20
# now, re-create partitions but data is bigger
mkpart primary 1325 5421
name 20 userdata
mkpart primary 5421 5430
name 21 persist
mkpart primary 5430 5967
name 22 cache
mkpart primary 5967 5968
name 23 misc
mkpart primary 5968 5979
name 24 recovery
mkpart primary 5979 6012
name 25 reserve1
mkpart primary 6012 6019
name 26 reserve2
mkpart primary 6019 6028
name 27 reserve3
mkpart primary 6028 6062
name 28 reserve4
mkpart primary 6062MB 100%
name 29 sdcard
# exit parted shell
q
Let's create a file system on the partitions that require one. Note that I am formatting the SDCard using VFAT as, yes, EXT4 is a better FS, but it is also incompatible with Oppo's ROM and some apps may not require the proper permissions etc.
Code:
# Notes:
# -m 0: no reserved blocks
# -c 0: no max mount count
# -C -1: no mount count
# -i -1: max_int interval between checks
mke2fs -t ext4 -m 0 -L userdata /dev/block/mmcblk0p20
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p20
mke2fs -t ext4 -m 0 -L persist /dev/block/mmcblk0p21
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p21
mke2fs -t ext4 -m 0 -L cache /dev/block/mmcblk0p22
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p22
# Hey look it’s an ext4 SDCard!
mke2fs -t ext4 -m 0 -L sdcard /dev/block/mmcblk0p29
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p29
# Actually to avoid errors like unable to write to root of sdcard:
mkdosfs -n sdcard -F 32 /dev/block/mmcblk0p29
mount -t vfat /dev/block/mmcblk0p29 /sdcard
At this point, we have clobbered the /persist partition and this could cause issues as mentioned earlier. Let's restore it.
Code:
# Restore /persist partition
mount -t ext4 /dev/block/mmcblk0p29 /sdcard
# On computer
adb push mmcblk0p21_persist_ext4.img /sdcard/
# On phone
dd if=mmcblk0p21_persist_ext4.img of=/dev/block/mmcblk0p21
IMPORTANT! Flash your recovery partition now. If you wait until after rebooting, you will need to use fastboot instead.
Code:
# Recovery partition: on computer
adb push openrecovery-twrp-2.6.3.0-find5-TP-patch.img /sdcard/
# On phone
dd if=openrecovery-twrp-2.6.3.0-find5-TP-patch.img of=/dev/block/mmcblk0p24
Admire your work
Code:
parted /dev/block/mmcblk0 print
Reboot into your new recovery and install your favorite ROM
FAQ
Q: Is this dangerous?
A: Yes. Yes, it is.
Q: Any tip?
A: Yes. Follow these instructions carefully and if something wrong happens, unless you know what you are doing, leave your device alone and come here to ask for help.
Q: Can I hold you responsible for any damage to my phone/etc?
A: As usual, the answer is 'No'
Q: I found an error in your write-up!
A: Please let me know immediately.
-Chris.
You should probably use the latest TWRP 2.6.3.1 found here: http://techerrata.com/file/twrp2/find5/openrecovery-twrp-2.6.3.1-find5.img
Looks good to me. Just be very carefully doing this.
Sent from my Find 5 using xda app-developers app
gdisk -b /sdcard/gpt.bin /dev/block/mmcblk0
those commands need to be typed in recovery even that one ?
Yes although I imagine this particular command should also work when booting system.
Sent from my Find 5 using Tapatalk
This thread is fine the only problem here is with those 2 binaries: mke2fs and tune2fs
You don't need to push them or chmod them since they are already in the recovery
Except that that thread is perfect.
Since we're at toying with partition, can't we merge the partitions in some way ?
Just wondering is there any way to build a script to do this in an automated way thus avoiding user errors and typos?
There is a thread on the oppo forums
http://www.oppoforums.com/threads/guide-resizing-internal-storage-on-find-5-32gb.8361/
Hello everyone,
is the guide for the 32 or 16 gb model?
I have 16 gb Oppo find 5.
Thanks.
PS: what "on your phone" is supposed to mean"?
Click to expand...
Click to collapse
If you don't know what does that mean don't do it you'll screw your phone.
hi
Please would you make something like this for oppo find 7a x9006?
thanks
Anyone willing to recompute all the offsets dor just one 16gb partition?
Scribed henceforth from thy G pad.
Hi all, I am trying to do this mod and I am half way through it with a problem
I am stuck on the new file system, I cannot use mke2fs or tune2fs, i get
Code:
mke2fs: not found
like it doesn't even exist, but it does I can see it. I get the same error for tune2fs. but parted and gdisk work fine.
Yes I did push them and chmod 755 them.. and I have tried running it from the /sbin directory.
Help!
Hello!
I'm getting the same error over and over again creating /dev/block/mmcblk0p21 to /dev/block/mmcblk0p22:
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p21
"Bad magic number in super-block while trying to open /dev/block/mmcblk0p21"
"Couldn't find valid filesystem superblock"
So i can't create a file system on the created partitions. I have been looking everywhere for an answer. Somebody have an idea?
U should just wait. Andrew dodd found a way to make find7a have unified partition and he claims he can make it work on find5 as well. Let's give him a bit to figure it out tho.
Scribed henceforth from thy G pad.
Gdisk not working...
Ok guys sort of a noob here... Firstly, totally appreciate what you guys are doing here... I wants it bad, thass why i'm here.
So far... I have i have done...
"adb reboot recovery"
"adb push gdisk /sbin"
I figured that's how you are supposed to install it ... hope i'm not wrong, but i guess it pushed through fine
But after rebooting to system in TWRP , i opened terminal emulator and when i use the command
"gdisk -b /sdcard/gpt.bin /dev/block/mmcblk0"
I get ...
"/system/bin/sh: gdisk: not found"
now i'm too scared to proceed without backing up the partition tables... so please help...
edit - FYI , i'm running the last build of Asylum Carbon... should i just go back to latest oopo stable stock rom and then root my device again and then try all this again... would that help... ???
Directly from Andrew Dodds g+ " IT HAS BEGUN.
The first phase of Find 7a/7s LVM testing is here.* See linked post for details.* (Sorry to disappoint, but the first phase is "make sure we don't break existing configurations")
Once this phase is complete, the remaining list is:
Fix up the remaining TWRP issues (make RECOVERY_SDCARD_ON_DATA runtime instead of compile-time)
Make user-friendly conversion processes
Once things are solid on Find 7, I'll work on Find 5 and N1."
Stay thirsty my friends. Good things ahead
Sent from my A0001 using Tapatalk
Does this work for the 16gb model?
Can someone help please?
I'm trying to do this, but after enter in parted [parted /dev/block/mmcblk0] when i try to do "rm 29", i get "can't remove 29: no such file or directory
I'm doing the "on your phone" commands in TWRP command line., is that correct?
I'm running stable colorOS 1.0.9i
Finally I finish the process.
My notes:
Goal:
Keep my current system intact (stable colorOS 1.0.9i , because i have no patience to format, install a new ROM and reinstall/recofigure everything
So I backup everything on phone with TWRP and I push sdcard content (wich include the system backup i made) with ADB
1 - If I push mke2fs and tune2fs IT WILL NOT WORK. I flash the last find 5 recovery (openrecovery-twrp-2.8.1.0-find5.img) and I dont push or chmod anyting, parted, mke2fs, tune2fs are all already in the recover and that's the only way I could run mke2fs and tune2fs
edit: 1.5 - The phone commands had to be enter via ADB shell. In TWRP command line, after you enter in parted it will not accept commands.
2 - To "rm 29", i had to "umount /dev/block/mmcblk0", otherwise "rm 29" fail due to partition in use
3 - after this instruction:
mount -t vfat /dev/block/mmcblk0p29 /sdcard
(the last one on the 4 block of code)
We have this:
# Restore /persist partition
mount -t ext4 /dev/block/mmcblk0p29 /sdcard
This instruction was the only one that give me a error, so I move to the next ones.
The error was that the partition was busy, what makes senses because in the last instruction we mount the same partition on the same folder but with different file system!!??
So I move to the next instruction. I have no idea if it's a instructions mistake but it looks like, because it says "# Restore /persist partition" but the command has nothing to do with /persist
4 - FINISH
5 - Reboot in recovery. Push sdcard backup to /sdcard. restore system backup with TWRP restore
Voila, my phone exactly as before but with 3,76GB for APPS. Finally!!! The "running out of space" message on a flagship quad-core 2GB RAM phone!!!!!!?????? Was driving me CRAZYYYYY
Thanks Fickx for the up to date information, I just did my re-partition successfully, here's what I did:
- Use Rashr update the recovery to twrp-2.8.1.0
- reboot into recovery
- connect to PC (Make sure adb works, "adb devices")
- on PC:
> adb shell
> umount /cache
> umount /sdcard
> umount /emmc
> umount /data
> umount /dev/block/mmcblk0p29
> parted /dev/block/mmcblk0
> rm 29
>...
> rm 20
> mkpart primary 1325 5421
> name 20 userdata
> ...
> name 29 sdcard
> q
> mke2fs ...
> ...
> mount -t -vfat /dev/block/mmcblk0p29 /sdcard
Open another PC command terminal
> adb push mmcblk0p21_persist_ext4.img /sdcard/
> adb push openrecovery-twrp-2.8.1.0-find5.img /sdcard/
Back to original terminal in "adb shell".
> dd if=/sdcard/mmcblk0p21_persist_ext4.img of=/dev/block/mmcblk0p21
> dd if=/sdcard/openrecovery-twrp-2.8.1.0-find5.img of=/dev/block/mmcblk0p24
> exit
> adb reboot recovery
Flash the rom.

[How-To] [Link2SD] Solve "mount: No such file or directory" error on stock ROM

[How-To] [Link2SD] Solve "mount: No such file or directory" error on stock ROM
I rooted my Galaxy S3 Mini (GT-i8190) (following seedrom193's tutorial), but I'm still on the stock Android ROM.
I was trying to use Link2SD with a correctly partitioned SD card (10GB primary FAT32 + 4GB primary ext2), but got the following error, which showed every time I tried to recreate mount scripts:
"Mount script cannot be created. mount: No such file or directory"
Also, on every reboot, I would get a "Mount warning" from Link2SD, requiring me to "quick reboot" my phone. After that (second) reboot, Link2SD would work correctly, but shortcuts on my home screen to linked apps were missing.
After much googling I figured that maybe the problem was caused by my (stock) ROM not having init.d support. So I used this method to add init.d:
http://forum.xda-developers.com/showthread.php?t=1933849
Init.d worked properly, but I still got the same error in Link2SD. Then, I used Root Explorer to look at my file system (any other root browser would work too I guess) and found the cause. Here's the contents of /data/data/com.buak.Link2SD/files/init-link2sd.sh, which I *guess* is a copy of the script Link2SD is trying to get to run at boot:
Code:
set +e
echo "$(date) mounting..." > $LOG
sleep 4
mount -t ext2 -o rw [COLOR="Red"][B]/dev/block/vold/179:98[/B][/COLOR] /data/sdext2 1>>$LOG 2>>$LOG
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
Apparently, the device node /dev/block/vold/179:98 does not exist, because Android's vold mounting system doesn't automatically mount the second partition of the SD card. This causes the "mount: No such file or directory" error on the first mount command. However, the second mount command (from /dev/block/mmcblk1p2) should work. For some reason, this error seems to keep Link2SD from installing the boot script.
So, I decided to create an init.d script of my own. Using Root Explorer, I created and edited a file named "11link2sd" in /system/etc/init.d/ and inserted the following text:
Code:
#!/system/bin/sh
sleep 4
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2
This solved the problem for me, and I can now use Link2SD without needing the extra quick reboot. I figured I'd share my solution in case anybody else had the same problem. I do suggest that anybody who tries to do the same thing first check the init-link2sd.sh file for that /dev/block/mmcblk1p2 bit, to make sure it''s the same.
Link2SD 2nd Partition getting full
Hi,
I saw that you are using Link2SD and seems to have a good understanding of the subject. I am new to using Android!
Maybe you could help. I think I properly installed Link2SD and that it is working correctly (I don't know of any way to check that).
When I go into the menu and ask for storage, I get the following: it is in french, but "libres" means "free".
Interne (85% Libres)
/data
Total: 4,37 Go Utilisés: 658 Mo Libres: 3,73 Go
Carte SD (85% Libres)
/storage/emulated/legacy
Total: 4,37 Go Utilisés: 658 Mo Libres: 3,73 Go
Externe SD (98% Libres)
/storage/external_SD
Total: 27,42 Go Utilisés: 516 Mo Libres: 26,92 Go
Carte SD 2nde Partition (9% Libres)
/data/sdext2
Total: 2,34 Go Utilisés: 2,12 Go Libres: 230 Mo
Système (23% Libres)
/system
Total: 1,67 Go Utilisés: 1,28 Go Libres: 407 Mo
Cache (98% Libres)
/cache
Total: 787 Mo Utilisés: 12,58 Mo Libres: 774 Mo
As you can see the 2nd partition is almost full.
Is it possible to remove the SD card, resize the 2nd partition and put it back in the phone without loosing everything?
I am not sure if that can be done with link2sd installed.
Thanks for your help.
Jacques
Hello Jacques,
Your Link2SD seems to be working just fine. Here's how I can tell:
jacques_xda said:
Carte SD (85% Libres)
/storage/emulated/legacy
Total: 4,37 Go Utilisés: 658 Mo Libres: 3,73 Go
Click to expand...
Click to collapse
This is your internal memory, and plenty of it is now empty, probably thanks to Link2SD.
jacques_xda said:
Carte SD 2nde Partition (9% Libres)
/data/sdext2
Total: 2,34 Go Utilisés: 2,12 Go Libres: 230 Mo
Click to expand...
Click to collapse
This is the second partition which you created and which is indeed almost full. Unless you intentionally put other files there (which I assume you didn't, or you'd have known about it ), this partition was filled by Link2SD, with over 2 Gb of data. So Link2SD is working as it should, freeing your internal memory by moving stuff to that second partition.
Now, as for your second question:
jacques_xda said:
Is it possible to remove the SD card, resize the 2nd partition and put it back in the phone without loosing everything?
I am not sure if that can be done with link2sd installed.
Click to expand...
Click to collapse
Yes, but I recommend taking a backup of your SD card first, just to be safe. If your power fails or your card reader is disconnected during re-partitioning, you might lose data.
Assuming you're using Windows, you will need to make sure that MiniTool Partition Wizard is installed first (link can be found here). Also, you will need to have a way to back up the second SD card partition (which I assume contains an ext file system) over to Windows. You can copy over the files using Ext2Fsd, DiskInternals Linux Reader or Ext2explore, or find some program for creating an image of an ext partition in windows.
Then, take these steps:
1. Turn off your phone (and do not turn it on again!)
2. Take your SD card out of your phone and connect it to your computer using a card reader
3. To make a backup, copy everything on both partitions of your SD card to your computer
4. Use Partition Wizard to shrink the first partition on your SD card, and use the resulting unallocated space to expand the second partition (don't forget to press the "Apply" button!)
5. Safe-remove your SD card and put it back in your phone
6. Turn your phone on again
This should enlarge your extra partition without causing any problems with Link2SD. If you really want to be safe, you could use Link2SD to unlink all of your apps before step 1, and re-link them after step 6. Based on the information you provided, you should have just enough internal memory to do so.
Bonne chance!
link2SD resize ext partition
Warre101 said:
Hello Jacques,
Your Link2SD seems to be working just fine. Here's how I can tell:
This is your internal memory, and plenty of it is now empty, probably thanks to Link2SD.
This is the second partition which you created and which is indeed almost full. Unless you intentionally put other files there (which I assume you didn't, or you'd have known about it ), this partition was filled by Link2SD, with over 2 Gb of data. So Link2SD is working as it should, freeing your internal memory by moving stuff to that second partition.
Now, as for your second question:
Yes, but I recommend taking a backup of your SD card first, just to be safe. If your power fails or your card reader is disconnected during re-partitioning, you might lose data.
Assuming you're using Windows, you will need to make sure that MiniTool Partition Wizard is installed first (link can be found here). Also, you will need to have a way to back up the second SD card partition (which I assume contains an ext file system) over to Windows. You can copy over the files using Ext2Fsd, DiskInternals Linux Reader or Ext2explore, or find some program for creating an image of an ext partition in windows.
Then, take these steps:
1. Turn off your phone (and do not turn it on again!)
2. Take your SD card out of your phone and connect it to your computer using a card reader
3. To make a backup, copy everything on both partitions of your SD card to your computer
4. Use Partition Wizard to shrink the first partition on your SD card, and use the resulting unallocated space to expand the second partition (don't forget to press the "Apply" button!)
5. Safe-remove your SD card and put it back in your phone
6. Turn your phone on again
This should enlarge your extra partition without causing any problems with Link2SD. If you really want to be safe, you could use Link2SD to unlink all of your apps before step 1, and re-link them after step 6. Based on the information you provided, you should have just enough internal memory to do so.
Bonne chance!
Click to expand...
Click to collapse
Hi,
Thanks for your response. I have a question: do I need to unmount the SD card before closing the phone and pulling it out?
If the answer is yes, when I put it back and open the phone, will it mount automatically?
Jacques
Hello Jacques,
I think it will re-mount automatically, but don't have any similar experience with my own phone. With my own device, the micro-SD expansion slot is underneath the battery, so I have no choice but to turn off the phone before removing the SD. By consequence, the OS offers no option to unmount the SD card (that I know of at least).
However, once you turn your phone on again, your SD card should be mounted automatically. Have you rebooted (or turned your phone off and then on again) since using Link2SD? If yes, then it's probably fine. I would recommend that you don't unmount your SD card while the phone is running and apps are still linked; your linked apps would probably stop working.
Warre101 said:
Hello Jacques,
I think it will re-mount automatically, but don't have any similar experience with my own phone. With my own device, the micro-SD expansion slot is underneath the battery, so I have no choice but to turn off the phone before removing the SD. By consequence, the OS offers no option to unmount the SD card (that I know of at least).
However, once you turn your phone on again, your SD card should be mounted automatically. Have you rebooted (or turned your phone off and then on again) since using Link2SD? If yes, then it's probably fine. I would recommend that you don't unmount your SD card while the phone is running and apps are still linked; your linked apps would probably stop working.
Click to expand...
Click to collapse
Hi,
I closed the phone and took off the SD card without any problem.
I made an image of the content with ext2explore.
I then use MiniTool Partiton to try to extend the ext4 partition. The problem is there: MiniTool Partition cannot handle the job!
On the SD card, I have one FAT32 Partition and one ext4 linux patition. MiniTool can resize the FAT32 partition, leaving an unallocated space between the FAT32 and the ext4 partition, but it cannot resize the ext4 partition to take advantage of the unallocated space! I can move the ext4 partition closer to the FAT32, leaving the unallocated space at the end; that is all I can do with MiniTool.
Of course I could delete the ext4 partition and create a new one, using all the unallocated space. But then , will I be able to load the ext4 image I created before in that new partition, since it is not the same size? When ext2explore create an image, does it make a clone of the partition (content, size, etc...) there is no explanation or help on that product!
I will try with Gparted to see what it does and try to simply copy the content of the ext4 partition instead of creating an image.
Thank again for helping.
Jacques
Hello Jacques,
That's odd. I did almost exactly the same thing you described here (except for using ext2 rather than ext4) and was able to resize my ext2 partition using Partition Wizard. I first shrunk the FAT32 partition, then moved and resized the ext2 to use all the unallocated space. Have you tried first pressing apply after you shrink the fat32 and move the ext4? In any case, GParted should also work.
I can't help you with ext2explore as I have no direct experience with that program. You might be able to get some help in other parts of this forum.
If you want to try deleting that ext4 partition and creating a new one, you may be able to do this by first unlinking your apps back to your internal memory in Link2SD (as I suggested in an earlier post), re-partitioning and then re-linking with Link2SD.
Warre101 said:
Hello Jacques,
That's odd. I did almost exactly the same thing you described here (except for using ext2 rather than ext4) and was able to resize my ext2 partition using Partition Wizard. I first shrunk the FAT32 partition, then moved and resized the ext2 to use all the unallocated space. Have you tried first pressing apply after you shrink the fat32 and move the ext4? In any case, GParted should also work.
I can't help you with ext2explore as I have no direct experience with that program. You might be able to get some help in other parts of this forum.
If you want to try deleting that ext4 partition and creating a new one, you may be able to do this by first unlinking your apps back to your internal memory in Link2SD (as I suggested in an earlier post), re-partitioning and then re-linking with Link2SD.
Click to expand...
Click to collapse
Hi,
It is realy odd! I created that ext partition with the same tool! Now I can move it, but not resize it....I will try with Gparted with my old computer running Linux (Ubuntu)...later on, expecting it will work fine.
Thanks again,
Jacques
I rooted my moto e 2nd gen 4g phone and made partition on my 16gb sd card using ext4 FAT32. After partioning sd card then i inserted it in my phone to use link2sd but when i try to recreate mount script an error pop up every time showing " mount script cannot be created. No such file or directory" please help me. If any solution you know.
ankit gaur said:
I rooted my moto e 2nd gen 4g phone and made partition on my 16gb sd card using ext4 FAT32. After partioning sd card then i inserted it in my phone to use link2sd but when i try to recreate mount script an error pop up every time showing " mount script cannot be created. No such file or directory" please help me. If any solution you know.
Click to expand...
Click to collapse
Hi,
Try to mount with ext2 instead of ext4. I had the same problem trying to mount with ext2; I then try with ext4 and it worked|
Regards,
Jacques
ankit gaur said:
I rooted my moto e 2nd gen 4g phone and made partition on my 16gb sd card using ext4 FAT32. After partioning sd card then i inserted it in my phone to use link2sd but when i try to recreate mount script an error pop up every time showing " mount script cannot be created. No such file or directory" please help me. If any solution you know.
Click to expand...
Click to collapse
jacques_xda said:
Hi,
Try to mount with ext2 instead of ext4. I had the same problem trying to mount with ext2; I then try with ext4 and it worked|
Regards,
Jacques
Click to expand...
Click to collapse
That looks exactly like the problem I had. I suggest you first try Jacques' idea (changing ext2 into ext4 or vice versa) and if that doesn't work, use the method I put in the very first post. Let us know if you have any problems with that...
Been trying to get link2sd to work for awhile now
My init-link2sd.sh file looks a bit different though. For me, it looks like:
set +e
echo "$(date) mounting..." >$LOG
sleep4
mount-t vfat-o
rw,uid=1000,gid=1000,unmask=133,dmask=0002 /
dev/block/vold/179:34/data/sdext2 1>>$LOG 2>>
$LOG
mount -t vfat-o
rw,uid=1000,gid=1000,unmask=133,dmask=0002 /
dev/block/mmcblk1p2 /data/ sdext2 1>>$LOG 2>>
$LOG
Mount >> $LOG
echo "$(date) mount finished" >> $LOG
chmod 773 /data/dalvik-cache
Whenever I try to use Link2SD, it gies me the "mount: No such file or directory error," would you be able to help me?
A couple of things stand out to me; I'll go through the script you posted step by step:
FinalFreeze said:
set +e
echo "$(date) mounting..." >$LOG
sleep4
Click to expand...
Click to collapse
A space is missing between "sleep" and "4". Was it lost in copy-pasting?
FinalFreeze said:
mount-t vfat-o
rw,uid=1000,gid=1000,unmask=133,dmask=0002 /
dev/block/vold/179:34/data/sdext2 1>>$LOG 2>>
$LOG
Click to expand...
Click to collapse
I expected this to be on a single line like this:
Code:
mount-t [B]vfat[/B]-o rw,uid=1000,gid=1000,unmask=133,dmask=0002 /dev/block/vold/179:34/data/sdext2 1>>$LOG 2>>$LOG
Is it like that in your file?
Anyway, I notice the second argument in the mount command is "vfat". If you use the "recreate mount scripts" in Link2SD, which option do you use for the file system? Does it correspond to the way your SD card is partitioned? I used EXT2.
FinalFreeze said:
mount -t vfat-o
rw,uid=1000,gid=1000,unmask=133,dmask=0002 /
dev/block/mmcblk1p2 /data/ sdext2 1>>$LOG 2>>
$LOG
Click to expand...
Click to collapse
This is the information you would need to follow the tutorial that I posted. You could try putting the following in an init.d script:
Code:
#!/system/bin/sh
sleep 4
mount -t [B]ext2[/B] -o rw,uid=1000,gid=1000,unmask=133,dmask=0002 /dev/block/mmcblk1p2 /data/sdext2
Note that I'm assuming here that your SD card uses an EXT2 partition, as shown in bold.
FinalFreeze said:
Mount >> $LOG
echo "$(date) mount finished" >> $LOG
chmod 773 /data/dalvik-cache
Click to expand...
Click to collapse
The last line (starting with chmod) is something I haven't seen before. If you create your own init.d script, you may need to add the same line.
Warre101 said:
I rooted my Galaxy S3 Mini (GT-i8190) (following seedrom193's tutorial), but I'm still on the stock Android ROM.
I was trying to use Link2SD with a correctly partitioned SD card (10GB primary FAT32 + 4GB primary ext2), but got the following error, which showed every time I tried to recreate mount scripts:
"Mount script cannot be created. mount: No such file or directory"
Also, on every reboot, I would get a "Mount warning" from Link2SD, requiring me to "quick reboot" my phone. After that (second) reboot, Link2SD would work correctly, but shortcuts on my home screen to linked apps were missing.
After much googling I figured that maybe the problem was caused by my (stock) ROM not having init.d support. So I used this method to add init.d:
http://forum.xda-developers.com/showthread.php?t=1933849
Init.d worked properly, but I still got the same error in Link2SD. Then, I used Root Explorer to look at my file system (any other root browser would work too I guess) and found the cause. Here's the contents of /data/data/com.buak.Link2SD/files/init-link2sd.sh, which I *guess* is a copy of the script Link2SD is trying to get to run at boot:
Code:
set +e
echo "$(date) mounting..." > $LOG
sleep 4
mount -t ext2 -o rw [COLOR="Red"][B]/dev/block/vold/179:98[/B][/COLOR] /data/sdext2 1>>$LOG 2>>$LOG
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
Apparently, the device node /dev/block/vold/179:98 does not exist, because Android's vold mounting system doesn't automatically mount the second partition of the SD card. This causes the "mount: No such file or directory" error on the first mount command. However, the second mount command (from /dev/block/mmcblk1p2) should work. For some reason, this error seems to keep Link2SD from installing the boot script.
So, I decided to create an init.d script of my own. Using Root Explorer, I created and edited a file named "11link2sd" in /system/etc/init.d/ and inserted the following text:
Code:
#!/system/bin/sh
sleep 4
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2
This solved the problem for me, and I can now use Link2SD without needing the extra quick reboot. I figured I'd share my solution in case anybody else had the same problem. I do suggest that anybody who tries to do the same thing first check the init-link2sd.sh file for that /dev/block/mmcblk1p2 bit, to make sure it''s the same.
Click to expand...
Click to collapse
Mount script error
Mount Script cannot be created
Moun Invalid arguement
I've been at this every day for a week i inserted the txt file with ur script rebooted and nothing same old bs script error. PLEASE tell me som1 knows A REAL WORKING FIX.
I've tried fat32/ext2 fat32/ext4 fat32/fat32 The mount DOES NOT EXIST. i have int.d support How do I create the mount? Not just a file directory?
Hi, I have tried the script, but at restart seems not to run because no mount is done, so no partition.
I use CM13. Any ideas? Thank you.
mikeroku said:
Hi, I have tried the script, but at restart seems not to run because no mount is done, so no partition.
I use CM13. Any ideas? Thank you.
Click to expand...
Click to collapse
That's difficult to tell based on the information you provided. Can you look for this file:
Code:
/data/data/com.buak.Link2SD/files/init-link2sd.sh
and post the contents please?
Hey...my problem is mounting the second partition...I've been literally trying since yesterday....no luck using the mini tool to format any of the ext's and lost a lot of time trying different fixes....typing in "cannot mount 2nd partition" on google leaves me with so many results that don't have actual fixes...any help?
Stabbey said:
Mount script error
Mount Script cannot be created
Moun Invalid arguement
Click to expand...
Click to collapse
psantos1091 said:
Hey...my problem is mounting the second partition...I've been literally trying since yesterday....no luck using the mini tool to format any of the ext's and lost a lot of time trying different fixes....typing in "cannot mount 2nd partition" on google leaves me with so many results that don't have actual fixes...any help?
Click to expand...
Click to collapse
Hey guys,
Some time ago my phone started having the exact same problem that Stabbey describes: mounting the second partition no longer works, manually mounting the second partition results in the "Invalid argument" error when running this command in a terminal emulator:
Code:
mount -t ext2 -o rw /dev/block/mmcblk1p2 /data/sdext2
This started happening after I installed an update for busybox and some other apps and then rebooted. Something might have changed in the mount applet of busybox with that update, and that might have broken the mount command. Right now I don't know for sure if this is the case; I haven't figured out how to roll back the busybox update yet. In any case, if I can't manually mount, it certainly won't work on startup with init.d, so I'm stuck for now.
I'm sorry I can't give any of you a solution right now. If anyone else wants to take a crack at it, my problems started after installing busybox 1.25.1, so a version *before* that might work.
大神你好:
这是个非常厉害的好办法!您帮我解决了这个疑难杂症!让我手机重新获得新生,而且问题分析得非常准确。
致敬!
机油
Hi Warre101
thank you so much for your solution!
However, I still have a small issue:
When I created a file in the init.d folder, I ended with a .txt file while the others in that folder have no extension. I wrote the code you mentioned. Then with Universal init.d app, I executed the file, and it worked -> the partition get mounted. But, when I reboot my phone, it is not done automatically: I have the error message on Link2sd, then I have to come back to Universal init.d, execute the script, and come back to Link2sd to see it is mounted. Do you have an idea to have it done automatically?
the init-link2sd.sh file is like this (when the partition in mounted) :
Code:
set +e
echo "$(date)mounting..." > $LOG
sleep 2
mount -t ext4 -o rw /dev/block/vold/public:179_130 /data/sdext2 1>>$LOG 2>>$LOG
mount -t ext4 -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
chmod 773 /data/dalvik-cache
The partition I created using minitool is in ext4
The 11link2sd.txt file is:
Code:
#!/system/bin/sh
sleep 2
mount -t ext4 -o rw /dev/block/mmcblk1p2 /data/sdext2
Then in /data I got a new file link2sd-boot-receiver-mount.log:
Code:
Tue Oct 24 09:47:50 CEST 2017 mounting...
mount: No such file or directory
rootfs / rootfs ro,seclabel 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
none /sys/fs/cgroup tmpfs rw,seclabel,relatime,mode=750,gid=1000 0 0
tmpfs /mnt tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
pstore /sys/fs/pstore pstore rw,seclabel,relatime 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,resuid=10010,data=ordered 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect1 /protect_f ext4 rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/protect2 /protect_s ext4 rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered 0 0
/dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/nvdata /nvdata ext4 rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered 0 0
adb /dev/usb-ffs/adb functionfs rw,relatime 0 0
tmpfs /storage tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
/dev/block/loop1 /su ext4 rw,seclabel,noatime,data=ordered 0 0
/dev/fuse /mnt/runtime/default/emulated fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /storage/emulated fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/read/emulated fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/write/emulated fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/block/vold/public:179,129 /mnt/media_rw/319C-76D0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/fuse /mnt/runtime/default/319C-76D0 fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /storage/319C-76D0 fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/read/319C-76D0 fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /mnt/runtime/write/319C-76D0 fuse rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/block/mmcblk1p2 /data/sdext2 ext4 rw,seclabel,relatime,data=ordered 0 0
Tue Oct 24 09:47:50 CEST 2017 mount finished
I used MiXplorer that I found on thi forum as a file explorer and to create the script file.
I am on Android 6.0, stock ROM but not original (eg when I bought the phone the stock ROM was on Android 5, then I discovered they changed to Android 6 so I downloaded the new stock ROM from the official website and flashed it).
Thank you for your help !

Categories

Resources