Format & Use MicroSD W/ ext4? - Galaxy Tab 2 General

Hey guys, for a couple reasons I'd like to be able to format my micro SD card with the ext4 file system.
I can format my card using a computer running Ubuntu, but the card will not mount.
I'm running CM10 on my P3113.
Is there any simple way to do this?
It seems like it'd be best to use vold to mount the sdcard, but that doesn't support ext4 I guess?
Just wondering...

Ext4 support has to come from kernel.

???
Literally every other mounted filesystem on the CM10 ROM I use is ext4...
I'm gonna try mounting via an init.d script.
We'll see if that works...

Solved this one, it was easier than I expected.
You need to format the card, and then mount it at boot via a script.
CM9 and 10 support init.d scripts, so I have a script file at /system/etc/init.d/95sdcardext4
with this contents:
Code:
#!/system/xbin/sh
# Mount SD Card Ext4 Script
mount -rw -t ext4 /dev/block/mmcblk1p1 /storage/sdcard1
This runs very early in the boot up process, and ext4 partitions mount basically instantly, so everything is working as expected so far.
More tests need to be done, but I'm fairly certain I can package this up in a flashable ZIP package.

Brilliant !
ext4 is anyways far better than fat32 except Windows/Mac compatibility.
Awaiting your stable work

It will work on a s5670 running cm10 jb4.1.1?
I just have to create a file with that lines and put it in /system/etc/init.d/95sdcardext4 ?????????
I cannot get link2sd to mount the ext4 partition.
Thx
DivinityCycle said:
Solved this one, it was easier than I expected.
You need to format the card, and then mount it at boot via a script.
CM9 and 10 support init.d scripts, so I have a script file at /system/etc/init.d/95sdcardext4
with this contents:
Code:
#!/system/xbin/sh
# Mount SD Card Ext4 Script
mount -rw -t ext4 /dev/block/mmcblk1p1 /storage/sdcard1
This runs very early in the boot up process, and ext4 partitions mount basically instantly, so everything is working as expected so far.
More tests need to be done, but I'm fairly certain I can package this up in a flashable ZIP package.
Click to expand...
Click to collapse

Sorry about that, I don't have one of these anymore. I had a P3113, but switched to a T869, which is a very similar device but has 4G and some different stuff going on under the hood.
My brief ext4 experiment was honestly not that big of a deal. I ended up going back to FAT32 because the benefits didn't outweigh the annoyances.
The biggest issue I had was I couldn't figure out how to make the file system permissions behave in the same highly permissive way that FAT32 does. I ran into several force closes and other things that resulted from apps not being to read / write stuff on the card that they should have been able to. I know you can CHMOD stuff, and a boot script could chmod everything on the card, but that seems like a bandaid.
Maybe there's a way to make the permissions behave a specific way via the mount parameters? I didn't investigate deeply enough because my life got busy, and during the changeover to the new tab it was just easier to go back to FAT32. Also my new tab has 16GB of internal storage, so I've been much less stressed about storage.

Ok folks.. ...reviving an ancient thread....from good ol days when it 'KISS' was common for Android.
What about android 7+ onward . All this stuff is deprecated. My 128gb is cut into 3 Ext4's.
(I need a journaled FS - that story a lil later )
I can mount easily but problem is apps cant see it and its all got to do with mount space concept.
I am Su'ed via Magisk
Can someone post a step by step guide to mount ext4 on 7+

Related

(Q) A2SD: anyone interested in helping get a2sd to work.

I was just curious if anyone would be interested in making a step in the right direction dog such a new device. I have worked with a2sd on several other android phones(most of which already had froyo ported). I also have some experience in porting Roms to other devices. If anyone else that has already bought a flipside, and at least a pretty decent understanding on how the OS works and how to stuff like that. Also... it would be a huge plus if someone has experience in building Roms, as well as dumping them from our devices.
I'm planning on starting off with a clean and fast ROM for our phones... and hopefully with a2sd built in as well, or at least installable.
If you are interested then send me a PM and we can get to work... the sooner the better!
Looking at /proc/filesystems it seems that the stock kernel only has support for yaffs2 and vfat. The stock image doesn't include any .ko files so I'm assuming all of the needed functionality is compiled into the kernel with no support for external module loading.
Using Busybox 1.18 from the Market I can loop mount vfat images without any problem (I had partitioned my SD card under Linux but it seems that init and motobox are hard-coded to load mmcblk0p1 at /sdcard and then it kept unmounting /sdcard randomly when I had extra partitions after it... so loop-mounting is safer without breaking things).
The problem is of course permissions since vfat doesn't support ugo-style permissions. We can't loop mount yaffs2 images since the emulated block device is not NAND flash... and that's also the reason we can't just dd a yaffs2 filesystem into a partition on the SD card.
I'm going to experiment with init.rc a bit and see if I break anything by forcing it to mount /sdcard immediately after /system (because that's where it should be mounting /data). I don't want to run the risk of loop mounting a file from /sdcard onto /data only to have it forcibly unmounted when vold gets enumerated and remounts /sdcard.
It's really unfortunate that there's so little space on the internal memory of this device... /cache is ~140 Mb, /system is ~180 Mb, and /data is ~160 Mb, so even if we were to lean out /system and swap it around with the others, we only get 20 Mb more on /data... that's way too much work for such little gain.
OT - Why is there so much hatred against this device? It's more than fast enough to play Quake 3 and I'd trade all the screen real estate in the world for a hardware keyboard... oh, and the phone actually fits in my pocket (unlike my friend's Droid X which is so huge and unwieldy...). Anyway, I just think it's odd.
Update: It seems that the device checks that boot and recovery images are signed with a Motorola digital certificate at runtime... I can flash the partitions just fine, but it just boot-loops with "Error CC00 DBAD" and then eventually drops back to the bootloader. Unfortunately this means that I can't test any changes to mount points in init.rc at this time. Since I don't have any means to recover the device from a bad bootloader flash, this will have to be the end of the road for me at this time. Some other brave soul will have to experiment with replacing mbmloader or lbl to allow loading custom images signed with test certificates from the SDK.
EDIT: I should mention that I had to use sbf_flash to upload images since fastboot won't work until we have an unlocked bootloader on the device. I wish I had read up on and-developers.com before discovering all of this stuff the hard way. Oh well. Even the ramloader from the SBF image is signed with a Motorola digital certificate so I'm not sure that using sbf_flash (I haven't tried RDSlite, don't have Windows) is the way forward either. I don't think we can just dd the new images for the bootloader either since not all of the MTD partitions are exposed to the OS. This is going to be harder than I expected.
Init.rc executes /system/etc/install-recovery.sh as a privileged user. Lucky for us, this is at the end of the init script once everything is up and running and AT&T/Motorola have removed the file so we don't have to alter anything of value. I've tested it and adding install-recovery.sh will run commands as root. This is our way in.
Hopefully we can get apps stored on the SD card soon.
EDIT: The contents of this post are now deprecated and remain here for historical purposes only! Please see the posts below for the "proper" scripts.
So after playing with it some more, mounting a vfat filesystem on /data simply doesn't work because permissions and ownership can't be set. Even setting the most relaxed permissions possible I found bizarre side effects like apps won't install from the Market and wifi can't be toggled on/off. I found an ext2.ko compiled for the Milestone stock rom (I've attached it here for convenience, but I found it on android-hilfe.de) works just fine though, so now we can use a proper filesystem.
Right now I'm mounting a 512 MB ext2 filesystem onto /data and everything works great. The biggest problem I'm having though is that switching to USB Mass Storage mode forcibly unmounts my filesystem so that obviously causes problems, but I don't really see a way around this since UMS mode offers up the entire MMC device so there's no way to just pick one partition to expose...
I'm going to test more things to make sure nothing has broken before I post a full write up on this, but if you know what you're doing, it shouldn't be hard to figure it out on your own. I know most of the Apps2SD projects are using an application to manage data then setting up a separate partition on the SD card, but it usually relies on some custom recovery image and the goal for me is to do this against a stock rom. I'm also using a loop-mounted filesystem because it makes it easier to migrate to a new SD card without having to worry about partitions and what-not.
EDIT: Here's a quick-n-dirty version for those of you who would like to try it. This will show the proof of concept and let you see if it works for you without breaking anything major. All changes to /data will be undone on the next reboot. If you know what you're doing, then I would recommend making the changes permanent by mounting /data in install-recovery.sh. This is assuming you have rooted your phone (I used z4root) and have Busybox installed (I used 1.18 from the Market) and at least 512 MB free on your SD card.
Code:
adb push ext2.ko /sdcard
adb shell
su -
/system/bin/busybox mount -o rw,remount /system
/system/bin/busybox cp /sdcard/ext2.ko /system/lib/modules
/system/bin/busybox chown 0.0 /system/lib/modules/ext2.ko
/system/bin/busybox chmod 0644 /system/lib/modules/ext2.ko
/system/bin/busybox mount -o ro,remount /system
/system/bin/busybox insmod /system/lib/modules/ext2.ko
/system/bin/busybox dd if=/dev/zero of=/sdcard/userdata.ext2 bs=1M count=512
/system/bin/busybox losetup /dev/block/loop0 /sdcard/userdata.ext2
/system/bin/busybox mkfs.ext2 /dev/block/loop0
/system/bin/busybox mount -o rw,remount /
/system/bin/busybox mkdir /userdata
/system/bin/busybox mount /dev/block/loop0 /userdata
/system/bin/busybox chown 1000.1000 /userdata
/system/bin/busybox chmod 0771 /userdata
cd /data
/system/bin/busybox cp -r -f -H -p . /userdata
cd /
/system/bin/busybox umount /userdata
/system/bin/busybox rmdir /userdata
/system/bin/busybox mount -o ro,remount /
/system/bin/busybox umount -l /data
/system/bin/busybox mount /dev/block/loop0 /data -o rw,sync,nosuid,nodev,noatime,nodiratime
If you've done everything right, "lsmod" and "cat /proc/filesystems" will show "ext2", "mount" will show /dev/block/loop0 on /data, and "df" will show more space available on /data. You should also see the extra space in Settings -> SD card & phone storage -> Internal phone storage.
My install-recovery.sh currently looks like this:
Code:
#!/system/bin/sh
if [ -e /system/lib/modules/ext2.ko ] && [ "`/system/bin/busybox lsmod | /system/bin/busybox grep -c ext2`" -eq "0" ]
then
/system/bin/busybox insmod /system/lib/modules/ext2.ko
fi
# wait 30 seconds, /sdcard is being re-mounted by vold...
/system/bin/busybox sleep 30
if [ -s /sdcard/userdata.ext2 ] && [ "`/system/bin/busybox cat /proc/filesystems | /system/bin/busybox grep -c ext2`" -eq "1" ]
then
/system/bin/busybox losetup -d /dev/block/loop0
/system/bin/busybox losetup /dev/block/loop0 /sdcard/userdata.ext2
/system/bin/busybox umount -l /data
/system/bin/busybox mount /dev/block/loop0 /data -o rw,sync,nosuid,nodev,noatime,nodiratime
fi
You don't have to use this as-is, but it's at least a starting point.
UPDATE: Seems like we need a Busybox with a proper tune2fs utility as the one in the Market is pretty useless (only changes volume labels...). You'll want to run "tune2fs -c 0 -i 0 /dev/block/loop0" to disable mandatory fsck'ing, otherwise the kernel will reject the mount after a few times because it's dirty. Something funky is happening because any apps that I install once the image is mounted will not show up after reboot, but the files are there and they continue to take space. Maybe I'm breaking something with the lazy umount?
At the risk of sounding like I'm only talking to myself, I'll post another update...
I found that most of my troubles were stemming from waiting so long to remount /data, so I caved and put an ext2 partition on my SD card so that I don't have to wait 30 seconds before mounting over /data.
Oddly enough, mounting a native ext2 partition for /data from the SD card was actually MUCH slower than the loop mounted image. I should note that I'm not mounting the partition with the 'sync' option. I could get away with that on the loop device since it's just doing it in memory anyway and changes are only being written on the default commit interval for the host filesystem. Anyway, I'm using a 4 GB class 10 SD card, but it's still much slower than the internal flash. Just to confirm my results, I tried with a native ext2 partition on a 2 GB class 2 SD card... the phone took nearly 5 minutes finish booting to a responsive home screen!
But, at least I can mount /data right away when I'm using a physical partition... So I've done the best of both worlds by creating a ext2 partition on my SD card and then loop mounting an ext2 image onto /data. The result: I'm running my entire /data on a class 2 SD card and it's much faster than a native partition on a class 10! In fact, the difference in boot time compared to internal storage is only a few seconds! Now that I'm mounting /data right away I no longer have problems with missing apps or data after reboots. The only drawback is that you have to waste a bit of space to do it this way since the filesystem reserves 10% for itself, you need a 560 MB partition to hold a 512 MB image (in my case I'm actually running a 384 MB image since I don't really need that much space anyway). Personally, I don't mind since I'm running it off of a cheapo class 2 device and having everything in a single image file makes it super simple to migrate to a different SD card if I want to.
I'll keep running this setup for a couple days now to make sure that there's nothing else broken, but for right now I've got it setup just how I want it: no extra application to manage which apps are where and no random force closing from applications running off of SD card that weren't meant to be. Oh yeah, and I don't have to worry about dalvik-cache cannabilizing my internal storage either.
If anyone else is following along, I'd like to hear your experiences with this too. I'll post the final write-up once I'm certain that nothing else is broken.
I'm definitely following along appreciatively, but will have to wait for the step by step to give it a try.
Sent from my Liberty using Tapatalk
Well, here is the much-awaited write-up...
First, acknowledgements. This would not have been at all possible without the ext2 module provided by user Fnordi on android-hilfe.de. Unfortunately I can't read German so I have no idea if he actually compiled it for the Milestone or somebody else did, but I grabbed the file from his post about loading Debian Linux on the Milestone, so kudos to him and whomever else was involved. I also wouldn't have been able to write this up so neatly without the sdparted script by 51dusty. I had to make a few alterations because we're not running on CyanogenMod Recovery, but it's still mostly his work nonetheless. The parted and tune2fs binaries are from j_r0dd's Recovery image for the Motorola Backflip. Also, cheers to the folks on android-dls.com wiki, even though the information is mostly targeted at the G1 and ADP, it was still very good reading.
WARNING WARNING WARNING
I have not yet devised a way to migrate the SD card data back to internal storage! Once you've migrated /data to the SD card, anything new from that point forward will stay on the SD card. Additionally, I will not be providing support for anyone who deviates from the process outlined here. If you're clever enough to do it some other way, then you're clever enough to get out of trouble on your own. Do this at your own risk, I am not responsible for any harm or loss of data that may occur as a result of following this procedure. You have been warned!
WARNING WARNING WARNING
Requirements: Android SDK installed with working ADB, root access on your Motorola Flipside and Busybox 1.18 installed from the Market. There is plenty of information available on the forum on how to do these things so please don't post here asking how to root the phone. The assumption is that you know how to gain root access and that you're comfortable with ADB. If you're struggling with doing any of these things, then you should reconsider if you want to attempt this at all.
1. Backup your SD card and format it so that it's completely clean and has only a single, empty, FAT32 partition on it.
2. Grab the attached ZIP file and extract the files directly into the SD card (no sub-folders). Make sure these are the only files on there, everything else will be erased!
3. Set your phone's USB connection to "Charge Only".
4. Connect via ADB using "adb shell".
5. Now run the following:
Code:
su -
cp /sdcard/setup.sh /data/local
/data/local/setup.sh
6. The script will now setup a 512MB partition on your SD card with a 448MB image for /data. All of the other data on your SD card will be lost!
7. After the script is finished, restore any files that you backed up before to the FAT32 partition of your SD card.
8. Set your phone's USB connection to "Charge Only" and never change it again!
9. You should now have a lot more space for apps!
Please note that the phone will feel a little sluggish for a little bit after boot, but soon it will have everything buffered in memory and it will feel very smooth again.
Enjoy!
EDIT: I should mention, if you want to undo the changes, either shut down the phone and remove the SD card or delete /system/etc/install-recovery.sh. Either way, the phone will revert back to internal storage automatically on the next boot.
EDIT 2: I noticed that the Market install of Busybox doesn't link any existing commands, only new ones. I've been using the 1.18 binary from the Market but I had used my own script to link everything properly (mostly to replace "sh" since no tab completion was killing me!). I've now included the install script in the zip. So install the Busybox 1.18 from the Market, then run my install-busybox.sh, then reboot and follow the instructions above. Sorry for the mix-up!
Alright, just making sure. You're last Edit:, you said that we have to run your "install busy-box.sh". To run it, is it in the script in your post above, or is there some other way? I'm pretty new to runnin' all these scripts since I'm on a Captivate which is far easier than this (I'm doin' this for my girlfriends Flipside).
Just in general, what are the steps you run your install busy-box?
Thanks ahead of time.
thank!!!!!!!
can anybody help me do this because when i do it at the bottom it says failed
You leave it on "Charge Only" because otherwise it will unmount the /data image and cause it to crash.
This was stated previously in my posts. Please read carefully next time.
ErebusRaze said:
Just in general, what are the steps you run your install busy-box?
Click to expand...
Click to collapse
1. Install Android SDK on your computer.
2. Hook up via ADB and install z4root.
3. Run z4root on your phone. It will root the phone and reboot.
4. Install Busybox from the Market.
5. Copy the contents of the zip file to your SD card.
6. Log in as root via ADB ("adb shell" then "su -").
7. busybox mount -o rw,remount /system
8. cp /sdcard/install-busybox.sh /data/local
9. busybox sh /data/local/install-busybox.sh
10. reboot
11. Log in as root via ADB ("adb shell" then "su -").
12. ls -la /
If everything is done properly, the last step should result in an expanded directory listing in a color terminal. You can now proceed with the rest of the tutorial.
ok after i reboot i got look at my phone storage and it is still the same it didnt increase or anything
the method you've presented here sounds interesting, but i'd really hate to lose the memory card access function of my phone (i use it quite often...very often in fact). so i have a question or two:
would it be possible to get a bigger sdcard(say a 4GB or 8GB sdcard), and dd my current sdcard's partition to the new card, and then create another partition on the rest of the new card and have this method utilize that new partition in the manner described here? would the entire sdcard still get unmounted if i set the phone to memory card access?
<edit>: never mind...it seems this question would be answered by: "The script will now setup a 512MB partition on your SD card with a 448MB image for /data".....so apparently yes the sdcard would still be unmounted :/
igetsosickofregistering said:
the method you've presented here sounds interesting, but i'd really hate to lose the memory card access function of my phone (i use it quite often...very often in fact). so i have a question or two:
would it be possible to get a bigger sdcard(say a 4GB or 8GB sdcard), and dd my current sdcard's partition to the new card, and then create another partition on the rest of the new card and have this method utilize that new partition in the manner described here? would the entire sdcard still get unmounted if i set the phone to memory card access?
<edit>: never mind...it seems this question would be answered by: "The script will now setup a 512MB partition on your SD card with a 448MB image for /data".....so apparently yes the sdcard would still be unmounted :/
Click to expand...
Click to collapse
why would you even bother?...
search: link2sd
nuff said
I backed up my sdcard and copied the files over. I have busybox and it is rooted.
I accessed superuser and copied the files over per the write-up.
When I ran setup.sh, it gave me the following error:
----
busybox found.
Usage: mount [-r] [-w] [-o options] [-t type] device directory
grep: not found
:bad numbergrep: not found
:bad numbermodule insertion failed, aborting!
rm failed for /system/lib/modules/ext2.ko, Read-only file system
Usage: mount [-r] [-w] [-o options] [-t type] device directory
----
I understand that it is a read only error, but not sure how to edit the script (or if I even need to) to get it to work. It looks like the first line of the script remounts the system properties to -rw, but it still failed to write.

Use ext[2,3,4] on the microSD

Given that /system and a few other partitions are ext4 already, I know kernel support is built it. I'm guessing I'd need to root the device and edit the script that mounts/unmounts the microSD card. Anyone else know an easier way to do it? Apparently noone who manufactures tablets needs files over 4GB...Idiots.
I may give this a try today to see if I can figure out an easy way to do it. Although, I really need TrueCrypt support since most of my external drives are truecrypt containers. :-(
I suppose with root access it'd be a simple matter of mount -t ext4 /dev/block/whateversdcards /mnt/sdcard
I've still yet to root my device to test it though.
Did you ever give this a try?
It would be even cooler if we could convert the internal sdcard to ext4. It seems to be FAT32 as well. Then we could do a symlink under sdcard to the micro.

External card as ext2?

Can I have external card mounted as ext2? I have files names not supported by fat and sync'ed with dropbox
Yes, you can but afaik there is no easy way to do this.
I formatted my sdcard to ext2 (because I wanted to put large file (image for wikipedia offline) on my sdcard).
I formatted the beginning (~30MB) of my sdcard to fat32 so that the Nook detect the sdcard and does not trigger an error and the remaining part to ext2.
Then I used a script that mount manually the ext2 partition to /sdcard on boot.
This generally works but I have sometimes a few bug in some applications, especially when I connect and disconnect my Nook to my computer...
The best solution would be to find a way so that Android can automount a ext2 partition by itself but I don't know how to do it.
Instead of using the whole card I partitioned the first 4gb as fat16 (msdos) and then set the rest to ext3. When the fat16 space runs out I'll look into making some sort of script to try to mount the second partition. At the moment with the card acts like a normal 4gb card.
is it possible to repartition the nook to be able to use the space that b&n reserves for its contents? I heard that the space for our files is just 250 mb.
user4242 said:
is it possible to repartition the nook to be able to use the space that b&n reserves for its contents? I heard that the space for our files is just 250 mb.
Click to expand...
Click to collapse
yes of course. If you're used to linux repartitioning and the dd command then it's a breeze. If you're a Windows user who've never done partitioning or disk imaging then you can easily mess up.
I'll assume the former.
It's just a case of:
boot with a noogie.img that you've written to a sdcard (root of card, not partition 1)
then plug it in
now you can see all the nook partitions like it's an external USB drive and fdisk, cfdisk, partitionmagic or whatever you want
Obviously you're gonna want to backup first because if you mess up the only way to restore would be asking one of us off this forum to break the distribution laws and send you a 2gb (or whatever it is) image.
All the details on this forum
Has someone tried editing /system/etc/vold.conf to get a ext-formated SD-Card mounted?
mali100 said:
Has someone tried editing /system/etc/vold.conf to get a ext-formated SD-Card mounted?
Click to expand...
Click to collapse
I checked, I had modified it adding a line "partition 2" in the section "volume_sdcard2" so that Android does not show the message "SD card blank or has unsupported filesystem".
But I couldn't make it mount a ext2 sdcard itself. (if you know how to do it without using another script, I'm interested)
Time to resurrect this thread.
FAT is ugly. File timestamps are in local time (whatever that means, summer? winter?).
The Nook vfat implementation has problems with caching in and out directory info on vfat
and intermittently changes all the modify timestamps by 1, 4 or 5 hours.
This can play havoc if you are trying to keep things synchronized by filetime.
I've decided to have my SD card be ext3
Our volume demon, /system/bin/vold (which is ancient) uses /system/etc/vold.conf to configure automounting.
It presumes that all volumes are vfat.
It seems from a brief look inside that it does handle ext2 and ext3 somehow.
There is also the question of getting it to automount USB drives.
The easiest solution to ext3 on the SD card is to make it non-removable.
First, delete the second section out of vold.conf that relates to the SD card.
Then edit init.rc:
Code:
mkdir /sdcard 0777 system system
...
mount ext3 /dev/block/mmcblk1p1 /sdcard nosuid nodev noatime nodiratime uid=1000,gid=1015,fmask=117,dmask=007
chown system sdcard_rw /sdcard
chmod 0770 /sdcard
If you feel like having 12 partitions on your SD card you can.
That leaves vold only handling the mounting of /media
This exists so that you can serve /media as USB Mass Storage.
You could have /media be a fixed mount by doing what you just did to the SD card.
The only hiccup there would be the Adobe Digital Editions wants to see /media as UMS.
Note: To edit init.rc, download bootutil from the signature, extract, edit and replace init.rc in uRamdisk.
Make sure that you have a backup and a recovery!
Note: All of the above changes to init.rc are wrong.
I can get it to mount in a shell, but not in init.rc
Whoops.
Oops, this thread has been forgotten.
Yes, auto-mounting ext3 SDcards has been solved.
See: http://forum.xda-developers.com/showthread.php?t=2184495

Mount EXT4 MicroSD Card

I've given up on reformatting the internal memory as EXT4 (my last post). However now, I want to mount an external SD card that is EXT4 (or any file format that has UNIX permissions). I can't get my device to mount the card, it says the filesystem is unsupported. Now, that's bull**** since Android has built in support for EXT. After searching threads here on XDA and Google, and even purchasing EzyMount as recommended, I can't get it to mount. I've tried BusyBox and mount commands (as root), with various errors such as "mount operation not supported on transport endpoint". I'm at my wit's end by now, trying to get some filesystem which has support for symlinks and UNIX permissions... any ideas?
kcattakcaz said:
I've given up on reformatting the internal memory as EXT4 (my last post). However now, I want to mount an external SD card that is EXT4 (or any file format that has UNIX permissions). I can't get my device to mount the card, it says the filesystem is unsupported. Now, that's bull**** since Android has built in support for EXT. After searching threads here on XDA and Google, and even purchasing EzyMount as recommended, I can't get it to mount. I've tried BusyBox and mount commands (as root), with various errors such as "mount operation not supported on transport endpoint". I'm at my wit's end by now, trying to get some filesystem which has support for symlinks and UNIX permissions... any ideas?
Click to expand...
Click to collapse
you fully rooted with custom kernel or only with rdlv etc?
First you gotta figure out how to mount this damn thing, gotta be possible.
Then you need to get this done on bootup, either in init.rc or init.d or smth.
You probably just use wrong commands? But I could be wrong, didnt try that yet but would also be interested. Having the file permissions also on SD would be nice, but it could cause trouble with mtp maybe?
zroice said:
you fully rooted with custom kernel or only with rdlv etc?
First you gotta figure out how to mount this damn thing, gotta be possible.
Then you need to get this done on bootup, either in init.rc or init.d or smth.
You probably just use wrong commands? But I could be wrong, didnt try that yet but would also be interested. Having the file permissions also on SD would be nice, but it could cause trouble with mtp maybe?
Click to expand...
Click to collapse
I am rooted, but stock ROM and kernel. MTP is for connecting to a computer? If it is, I don't need that. I have tried
mount -rw -t ext4 /dev/block/mmcblk1p1 /storage/extStorageCard
and variants switching the flags and options.
Interesting... I just typed that command in to make sure I didn't make any typos.... and my phone crashed and rebooted. I typed it again to see if it would cause another crash and it appears to have mounted the card! Whwn I type "df" at the prompt it now shows a 28.6 GB filesystem at that location, which has to be my sd card.
Why, how, I don't know. It works, it's all I can say.

Link2SD on Amazon Fire TV

Problem statement
The Amazon Fire TV has a limited memory sotrage of less than 5GB.
FolderMount allows for moving App data/obb to a USB device. Remaining components of the App, which sometimes are the larger part of the app, can't be transfered using
These remaining components can be 100s of MB and even above 1GB (Sine Mora is 292MB, Walking Dead is 1.14GB)
Solution
Link2SD allows for moving these components to an external SD card in the phone world. Below I'll describe how to do this on the Amazon Fire TV with a USB device.
This post heavily relies on tweaking a post by sashavasko. Major kudos to him. Up to finding his post I was not successful in mounting in a way that Link2SD could see the mount. This was due to a change in Android 4.2+ where one App's mounting isn't seen by others.
Below is a step by step guide for running this. I've posted a script for automating this here : http://forum.xda-developers.com/showpost.php?p=54601505&postcount=33
Requirements: Root, Mouse, Terminal Application
Step 0 - Preparations : Format a USB device to the Ext4 File system and install Link2SD
Ext4
Link2SD refers to parititoning your SDcard to both Ext4 and FAT, this is not required on our USB device. All we need is an Ext4 partiton we can mount for Link2SD.
I had a high end USB device I used for FolderMount. For testing, I got a 16GB Lexar Jump Drive, which got decent reviews. $8 at Staples ( even less with the right coupon. Other sizes are also cheap). Both went into my Powered USB hub.
You can also partition a single FAT32 USB device to two partitons - FAT32 and Ext4. I have verified both options. Please note that for this second option, if you already have files on your FAT32 USB device, you'd have to first copy them to a backup, as the partitioning trashes your data. You will then need to restore the backed up files to the FAT partition.
Format/Partition your USB device to Ext4 using free MiniTool Partition Wizard Home Edition on your Desktop/Laptop. Below is a nice post on this (Refer only to step 1), you can find others. Please note that this refers to an SDCard. We will be doing this on a USB device.
http://forum.xda-developers.com/showpost.php?p=37405779&postcount=1
In partitioning, please verify the partitions are created as Primary. Also, not sure is this is required, but I didn't name my partitions.
There are also linux commands to do this - I didn't investigate these.
Stick the Ext4 partitoned USB device into your Amazon Fire TV and power it up. We will need the device in for Step 2.
Link2SD
Download Link2SD from the Google Play store, or sideload it
Make the directory Link2SD requires
Code:
su
mkdir /data/sdext2
exit
Step 1 - Fix adb localhost
Follow step 1 in sashavasko's post
http://forum.xda-developers.com/showpost.php?p=45102645&postcount=1
Note1:
You will need a terminal app for this
Note2:
This step should only be run once. Running multiple times can mess the /data/misc/adb/adb_keys file as the key values will concatenate with sashavasko's method. This will cause mounting at boot not to work. If you did this or not sure if you've done this, just erase the duplicate keys from the /data/misc/adb/adb_keys file (the end of a single key is "[email protected] ). Or, better yet, if you aren't seeing any other different keys there - simply su and copy /sdcard/.android/adbkey.pub onto this file.
Step 2 - Install scripts
Follow step 2 in sashavasko's post
http://forum.xda-developers.com/showpost.php?p=45102645&postcount=1
Note 1
Look for your Ext4 partitoned device after running:
Code:
adb shell cat /proc/partitions
You should find the Ext4 device under /device/block starting with sd.
For example: My first USB device is sda1, the Ext4 partitoned one was sdb1 (sdb2 when the Lexar drive was partitoned to FAT32 and Ext4).
You should be able to recognize the devices according to their partition sizes.
Note 2
The msd2.sh file should be changed to be:
Code:
#!/system/bin/sh
mount -t ext4 [COLOR="Purple"]/dev/block/[/COLOR][COLOR="Red"]sdb1[/COLOR][COLOR="purple"] /data/sdext2 [/COLOR]&& sleep 5 && /system/bin/vold
where the sdb1 device should be replaced by the device you located in Note 1.
Step 3 - Test the script and grant su permissions
Run this (no su command required, no path to the sd.sh file is required)
Code:
sd.sh
Verify you aren't seeing any errors. You will be granting SU permissions.
Run Link2SD. Go to the menu at the top right. Select "Storage Info" - Verify Link2SD recognizes the Ext4 partiton in the third line (under SD Card 2nd Part. ).
Step 4 - Auto Mount at initialization
For this I'm using the /system/etc/install-recovery.sh script which you should already have. This script loads at boot and calls /system/etc/install-recovery-2.sh (a non existent file).
Create a file at /sdcard/install-recovery-2.sh which contains
Code:
#!/system/bin/sh
/system/xbin/sd.sh
Now move the file to its place:
Code:
su
mount -o rw,remount /system
cp /sdcard/install-recovery-2.sh /system/etc/
chmod 755 /system/etc/install-recovery-2.sh
mount -o ro,remount /system
exit
Now Reboot (Long press remote Select + Play)
Step 5 - Link2SD ready to go
Open Link2SD to verify (as you verified before) that after boot Link2SD sees the Ext4 partiton.
Start moving files using Link2SD :
Select an App
Go to "Create Link" - You will be asked which file types to move. Check them all (not the paid option if you haven't paid).
Link2SD will show "Creating Link...", then an advert (in the non payed version) and then: Application files linked and moved to SD card
Note the expected storage change in the Amazon Fire TV's "About" menu option will be seen after Rebooting.
"Remove Link" works properly
"Move to SD card" is not relevant
Final Words
Don't use this to move system apps, or system-like apps
Responsibly for running this is solely on you. I am only describing what works for me.
Works great thanks
I'd love to see a standalone app for installing this.
Sent from my SM-N900V using XDA Premium 4 mobile app
The msd2.sh file mentioned in Step2/Note2 is used to create a fake external SD Ext4 partition for Link2SD.
You can also use it to create a fake external SD FAT partition at /storage/sdcard1 for FolderMount.
FolderMount automatically recognizes this partition and suggests this as the initial path for its destination path suggestion.
In my case - sda1 is the FAT partition (For me - a USB stick fully formatted to FAT32), and sdb1 is the ext4 formatted USB stick. The same should work with a single partitioned USB stick (but different sd* device names - see original post).
The updated msd2.sh file looks like:
Code:
#!/system/bin/sh
[COLOR="DarkGreen"]mount -t vfat /dev/block/[COLOR="Red"]sda1[/COLOR] /storage/sdcard1[/COLOR] && mount -t ext4 [COLOR="Magenta"]/dev/block/[/COLOR][COLOR="Red"]sdb1[/COLOR] [COLOR="Magenta"]/data/sdext2[/COLOR] && sleep 5 && /system/bin/vold
SaltyCookie_OnLoan2FM_SVE said:
The msd2.sh file mentioned in Step2/Note2 is used to create a fake external SD Ext4 partition for Link2SD.
You can also use it to create a fake external SD FAT partition at /storage/sdcard1 for FolderMount.
FolderMount automatically recognizes this partition and suggests this as the initial path for its destination path suggestion.
In my case - sda1 is the FAT partition (For me - a USB stick fully formatted to FAT32), and sdb1 is the ext4 formatted USB stick. The same should work with a single partitioned USB stick (but different sd* device names - see original post).
The updated msd2.sh file looks like:
Code:
#!/system/bin/sh
[COLOR="DarkGreen"]mount -t vfat /dev/block/[COLOR="Red"]sda1[/COLOR] /storage/sdcard1[/COLOR] && mount -t ext4 [COLOR="Magenta"]/dev/block/[/COLOR][COLOR="Red"]sdb1[/COLOR] [COLOR="Magenta"]/data/sdext2[/COLOR] && sleep 5 && /system/bin/vold
Click to expand...
Click to collapse
The one annoying thing about this is during boot it will read the entire partition. This in turn in my case makes booting the Fire TV really slow. Lets hope I dont have to reboot much because it now takes around 2-3 minutes to boot up.
MadFlava said:
I'd love to see a standalone app for installing this.
Sent from my SM-N900V using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I 2nd this. This is as close as we're gonna get to downloading Apps, ets., straight to an attached external drive but I know enough about this stuff to be somewhat intimidated by the initial instructions. Not that they're not clear, it just looks like I'd have too many avenues to brick my box.
Still...very good work OP. Thanks again.
MarkBP said:
I 2nd this. This is as close as we're gonna get to downloading Apps, ets., straight to an attached external drive but I know enough about this stuff to be somewhat intimidated by the initial instructions. Not that they're not clear, it just looks like I'd have too many avenues to brick my box.
Still...very good work OP. Thanks again.
Click to expand...
Click to collapse
Come on guys, this is XDA developers
OK, I have this brewing. Should post it by tomorrow.
awesome. how easy is it to reverse this entire process? I'd really like to know the risks before I take the plunge
I think the process can be greatly simplified. On my computer I created install-recovery-2.sh with the two lines below:
#!/system/bin/sh
mount -t vfat /dev/block/sda1 /storage/sdcard1 && mount -t ext4 /dev/block/sda2 /data/sdext2 && /system/bin/vold
Then I connected via adb to the fireTV from my computer.
Then an adb push of install-recovery-2.sh to /sdcard and then did an adb shell to the fireTV from my computer and su once there.
Copied from install-recovery-2.sh from /sdcard to /system/etc
Did a chmod 755 on the file to make it executable and then rebooted and all seems to be working well with partitions recognized.
tselling said:
I think the process can be greatly simplified. On my computer I created install-recovery-2.sh with the two lines below:
#!/system/bin/sh
mount -t vfat /dev/block/sda1 /storage/sdcard1 && mount -t ext4 /dev/block/sda2 /data/sdext2 && /system/bin/vold
Then I connected via adb to the fireTV from my computer.
Then an adb push of install-recovery-2.sh to /sdcard and then did an adb shell to the fireTV from my computer and su once there.
Copied from install-recovery-2.sh from /sdcard to /system/etc
Did a chmod 755 on the file to make it executable and then rebooted and all seems to be working well with partitions recognized.
Click to expand...
Click to collapse
Just tried this, didn't work for me (mount not detected).
- tselling, is Link2sd working with this ?
- If someone is working succesfully with Link2sd using tselling's method please report back. This is indeed a shorter route.
failed for me for tselling method
SaltyCookie_OnLoan2FM_SVE said:
Just tried this, didn't work for me (mount not detected).
- tselling, is Link2sd working with this ?
- If someone is working succesfully with Link2sd using tselling's method please report back. This is indeed a shorter route.
Click to expand...
Click to collapse
Link2sd found ok and I linked sevzero without problems. Should note that I use sda1 and sda2 for fat32 in first primary partition and ext4 on second primary pzrtition of same usb flash drive. Any other setup would need to have different script to match your drive setup.
Sent from my SAMSUNG-SGH-I497 using Tapatalk
why does this need more than 1 partition to work anyways? Is it just because the app requires it for some weird reason?
edit: also which partition needs to be the bigger one? do the sizes matter? and does stickmount need to be disabled for this to work?
desc
meadtj said:
why does this need more than 1 partition to work anyways? Is it just because the app requires it for some weird reason?
edit: also which partition needs to be the bigger one? do the sizes matter? and does stickmount need to be disabled for this to work?
Click to expand...
Click to collapse
why does this need more than 1 partition to work anyways? - Link2sd description in play store:
What you need for linking apps:
● root permission.
● a second partition on your SD card.
You should have two partitions on SD card and both should be primary.
The first FAT partition is your standard SD card storage. The second partition is used for application files and can be ext2, ext3, ext4, f2fs or FAT.
You need to use a non-FAT file system (ext2, ext3, ext4 or f2fs) on your second partition in order to link app's private data files. Because the FAT file system (FAT16, FAT32 or exFAT) does not support UNIX file ownership or permissions and will cause a security breakdown of app's private files.
Link2SD Plus can move app's private data files if you have a non-FAT partition
Click to expand...
Click to collapse
So we may be able to use FAT (haven't tried it) but we will lose some moving capabilities.
From my testing - FolderMount does work with the ext4 partiton, so I need two partitions (or 2 usb sticks).
also which partition needs to be the bigger one? - No restriction. Allocate as per your decision and experience with storage costs of apps.
do the sizes matter? - Don't believe her. It does.
Sorry. Uncalled for. Apologies. Not personal. I just had to.
and does stickmount need to be disabled for this to work? - No, it doesn't
983
tselling said:
Link2sd found ok and I linked sevzero without problems. Should note that I use sda1 and sda2 for fat32 in first primary partition and ext4 on second primary pzrtition of same usb flash drive. Any other setup would need to have different script to match your drive setup.
Click to expand...
Click to collapse
Ok, let's try and minimize this. Could it be due to tselling using a single partitioned USB drive, while I'm using two drives ?
I need a report back from someone with a single USB drive who tried tselling's simpler approach. If it failed - Maybe tselling added something along that he wasn't aware of. If it passed - Maybe that's a requirement for the simpler approach.
In other news, the script to automate this is take slightly more than I thought, due to unix-android differences (I come from a unix background). That, and the fact that we may have a simpler solution is delaying me. Oh, also had to stay late at work yesterday, Oooh and the dog ate my laptop.
What about Foldermount?
What about FolderMount for Data and OBB files? Can I still use it with Link2SD on same card?
SaltyCookie_OnLoan2FM_SVE said:
Ok, let's try and minimize this. Could it be due to tselling using a single partitioned USB drive, while I'm using two drives ?
I need a report back from someone with a single USB drive who tried tselling's simpler approach. If it failed - Maybe tselling added something along that he wasn't aware of. If it passed - Maybe that's a requirement for the simpler approach.
In other news, the script to automate this is take slightly more than I thought, due to unix-android differences (I come from a unix background). That, and the fact that we may have a simpler solution is delaying me. Oh, also had to stay late at work yesterday, Oooh and the dog ate my laptop.
Click to expand...
Click to collapse
I think it has to do with the mount points. I have the ext4 partition mounted to /data/ext2 where I think link2sd looks. I think that you could use an entire usb stick with one partition as ext4 mounted to /data/ext2 but your script would change
FROM
##############################################################################################
#!/system/bin/sh
mount -t vfat /dev/block/sda1 /storage/sdcard1 && mount -t ext4 /dev/block/sda2 /data/sdext2 && /system/bin/vold
#############################################################################################
TO
###################################################
#!/system/bin/sh
mount -t ext4 /dev/block/sda1 /data/sdext2 && /system/bin/vold
###################################################
However, I have not tried this. I may try this later today since I have a second fireTV and usb stick arriving today.
also, I am planning to use foldermount with the first fat32 partition I created, but I haven't gotten that far as I want to use the Pro version but need the play store loaded first.
OOPS, I did forget one part "mkdir /data/sdext2" (otherwise the mount fails).
tselling said:
I think it has to do with the mount points. I have the ext4 partition mounted to /data/ext2 where I think link2sd looks. I think that you could use an entire usb stick with one partition as ext4 mounted to /data/ext2 but your script would change
FROM
##############################################################################################
#!/system/bin/sh
mount -t vfat /dev/block/sda1 /storage/sdcard1 && mount -t ext4 /dev/block/sda2 /data/sdext2 && /system/bin/vold
#############################################################################################
TO
###################################################
#!/system/bin/sh
mount -t ext4 /dev/block/sda1 /data/sdext2 && /system/bin/vold
###################################################
However, I have not tried this. I may try this later today since I have a second fireTV and usb stick arriving today.
also, I am planning to use foldermount with the first fat32 partition I created, but I haven't gotten that far as I want to use the Pro version but need the play store loaded first.
Click to expand...
Click to collapse
tselling said:
OOPS, I did forget one part "mkdir /data/ext2" (otherwise the mount fails).
Click to expand...
Click to collapse
i did that too but still didnt work, maybe bc i have 3 partitions. Fat then Ext2 then NTFS
meadtj said:
i did that too but still didnt work, maybe bc i have 3 partitions. Fat then Ext2 then NTFS
Click to expand...
Click to collapse
Sorry, the directory is /data/sdext2
Your mount command is:
mount -t ext4 /dev/block/sda2 /data/sdext2 && /system/bin/vold
Also I am not 100% sure that ext2 filesystem works. ext4 works for sure.

Categories

Resources