Unable to mount loopback - G1 Android Development

I created a zeroed file with dd and attempted to mount it with:
mount -o loop /sdcard/test.img /data/test
and
losetup /dev/block/loop0 /sdcard/test.img
However, no loopback devices are displayed when I invoke mount. Can anyone clue me in? Feel like i'm missing something basic. By the way, I am running these commands from Saurik's busybox with the losetup /dev/block/loop fix.
p.s. I'd ask on the G1 hackers mailing list, but it's gone a bit bonkers in the past few days.

I'm not sure, but doesn't the image file you're trying to mount have to contain an actual file system?

Yea, I subsequently created a filesystem for it with mke2fs (which is mysteriously missing from busybox for android?). Still no go. Same when I tried to mount other partition-in-a-files like the module.cramfs or recovery.img
If I try to losetup the loop device then mount that, it returns error:
mount: mounting /dev/block/loop0 on /data/test failed: No such device
If I try to mount directly with -o loop, it returns:
mount: cannot setup loop device: No such file or directory
And yet Saurik seems to have been able to loop mount fine. Perhaps it is because I am testing on the qemu instead of hardware?

That might be it. You might try busybox's mount also.
But yeah, It definitely does work on the phone at least.

I've been trying to figure out how to load debian on the emulator, but I can't get the ext2 image mounted. I had to recompile the kernel first so support loadable modules, but even after that, it would not work (can't remember the specific error). Has anyone gotten an ext2 file system mounted on the emulator successfully?
The reason I'm doing this is so I can do native compiles, without actually having to do it on the phone. It has advantages in that I can crank up the clock speed and the RAM.

So I was able to mount loopback just fine on the actual hardware, but i'm having trouble getting it to run from the init.rc file. This is what i'm typing at the shell (it works):
(after insmod ext2.ko)
mount -o loop,noatime,nodiratime,nosuid,nodev -t ext2 /sdcard/loopy/app.img /data/app
It works fine and i'm able to install and run apks from the sdcard (/dev/block/loop2 on /data/app type ext2). Of course this is no good unless it can be mounted before the launcher starts (or it won't see any of our apks). The syntax for init mounting is different from sh, so I tried this (this is in /data/init.rc btw):
on userdata
#mount loopback file from sdcard
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mount ext2 /sdcard/loopy/app.img /data/app noatime nodiratime nosuid nodev loop
I know the script is being run since the ext2.ko module is getting installed. But the mount command isn't being executed. Can anyone shine a light on this? I'm not very familiar with the init daemon.

jashsu said:
So I was able to mount loopback just fine on the actual hardware, but i'm having trouble getting it to run from the init.rc file. This is what i'm typing at the shell (it works):
(after insmod ext2.ko)
mount -o loop,noatime,nodiratime,nosuid,nodev -t ext2 /sdcard/loopy/app.img /data/app
It works fine and i'm able to install and run apks from the sdcard (/dev/block/loop2 on /data/app type ext2). Of course this is no good unless it can be mounted before the launcher starts (or it won't see any of our apks). The syntax for init mounting is different from sh, so I tried this (this is in /data/init.rc btw):
on userdata
#mount loopback file from sdcard
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mount ext2 /sdcard/loopy/app.img /data/app noatime nodiratime nosuid nodev loop
I know the script is being run since the ext2.ko module is getting installed. But the mount command isn't being executed. Can anyone shine a light on this? I'm not very familiar with the init daemon.
Click to expand...
Click to collapse
Try
mount ext2 [email protected]/sdcard/loop/app.img /data/app noatime nodiratime nosuid nodev

JesusFreke said:
Try
mount ext2 [email protected]/sdcard/loop/app.img /data/app noatime nodiratime nosuid nodev
Click to expand...
Click to collapse
Tried that one earlier too. No love.

jashsu said:
Tried that one earlier too. No love.
Click to expand...
Click to collapse
I betcha the sdcard hasn't been mounted yet.
Is there anything in dmesg that looks relevant? Or maybe logcat?

Try temporarily moving the image file to /data, and see if you can get it to mount. That should verify that it has something to do with it being on the sdcard

JesusFreke said:
I betcha the sdcard hasn't been mounted yet.
Is there anything in dmesg that looks relevant? Or maybe logcat?
Click to expand...
Click to collapse
Agh! You're right. The mount daemon runs at line 192, in the services section. Long after the /data/init.rc is parsed.
service mountd /system/bin/mountd
socket mountd stream 0660 root mount
Any way around this short of manually mounting the sdcard in the /data/init.rc?
Edit: dmesg bingo:
<3>[ 1.920368] init: unable to mount [email protected]/sdcard/loopy/app.img to /data/app
as ext2
<6>[ 1.921498] yaffs: dev is 32505860 name is "mtdblock4"
<6>[ 1.922016] yaffs: passed flags ""
<4>[ 1.922322] yaffs: Attempting MTD mount on 31.4, "mtdblock4"
<4>[ 1.927204] yaffs: restored from checkpoint
<4>[ 1.927845] yaffs_read_super: isCheckpointed 1
<3>[ 1.960002] init: unable to mount /system/xbin.cramfs to /system/xbin as c
ramfs
<3>[ 1.965221] init: service 'console' requires console
<4>[ 2.161895] mmc_sd_init_card: Delay 250 ms
<4>[ 2.522535] mmc1: host does not support reading read-only switch. assuming
write-enable.
<6>[ 2.523359] mmc1: new SDHC card at address cd4e
On a side note, it looks like the mount action for xbin.cramfs in the main init.rc is failing because it's redundant with an earlier mount in /system/init.rc. I'm guessing this is a vestige of development on cramfs loopback mounting (mentioned here by Saurik).
6) at Jesus Freke's suggestion, setup /system/xbin (and later /system/modules) to mount from a compressed image
Click to expand...
Click to collapse

Yeah, I had left in an extra mount for xbin.cramfs in the base init.rc. I believe that's fixed in v1.3. I'll check again and make sure

So I gather the reason for wanting to mount a loopback device is to be able to create an ext2 fs as a file on the sdcard fat fs instead of creating 2 separate parittions on the sdcard , one for fat and one for ext2?
If this can be done, this would be a much better solution for getting apps to run on the sdcard than the previous hack which requires creating an ext2 partition on the sdcard.

Yeah that was what I was looking into. However as noted above, the I couldn't mount the image on the sdcard because the point at which /data/init.rc gets parsed occurs before the sdcard service starts up. The partition method doesn't have this problem because it creates a node for paritition #2 in the init.rc

jashsu said:
Yeah that was what I was looking into. However as noted above, the I couldn't mount the image on the sdcard because the point at which /data/init.rc gets parsed occurs before the sdcard service starts up. The partition method doesn't have this problem because it creates a node for paritition #2 in the init.rc
Click to expand...
Click to collapse
so u can't mount the sdcard in /data/init.rc?

dwang said:
so u can't mount the sdcard in /data/init.rc?
Click to expand...
Click to collapse
Not sure, I didn't try mounting partition #1. You could give it a shot by using mknod in /data/init.rc like the parted sdcard method. The sdcard service might not like that the card has already been mounted though.
There are two major reasons I abandoned this concept. The first is I didn't want to figure out how to get permission to mount /sdcard (since / is ro). The second is that making the sdcard available as a usb mass storage device makes it exclusively unaccessible from Android. I suppose that might not be so bad if you are only offloading /data/app, as long as you don't try to execute any new apps while your mass storage connection is going. It's non-ideal.

jashsu said:
Not sure, I didn't try mounting partition #1. You could give it a shot by using mknod in /data/init.rc like the parted sdcard method. The sdcard service might not like that the card has already been mounted though.
There are two major reasons I abandoned this concept. The first is I didn't want to figure out how to get permission to mount /sdcard (since / is ro). The second is that making the sdcard available as a usb mass storage device makes it exclusively unaccessible from Android. I suppose that might not be so bad if you are only offloading /data/app, as long as you don't try to execute any new apps while your mass storage connection is going. It's non-ideal.
Click to expand...
Click to collapse
I don't think the 2nd reason is that big of a deal. If google is planning on implementing the file based method for apps on the sdcard, they could just block access to apps when the sdcard is mounted to a pc. Its a lot better than the alternative of having to create a 2nd ext2 partition on the sdcard. Of course google should have really solved this issue before the g1 came out.
Anyways, I don't see /data/init.rc on my jf rc 1.2 g1. I only see /init.rc and /system/init.rc. Is /data/init.rc something that you created just for the purpose of mounting the file.

dwang said:
I don't think the 2nd reason is that big of a deal. If google is planning on implementing the file based method for apps on the sdcard, they could just block access to apps when the sdcard is mounted to a pc. Its a lot better than the alternative of having to create a 2nd ext2 partition on the sdcard. Of course google should have really solved this issue before the g1 came out.
Anyways, I don't see /data/init.rc on my jf rc 1.2 g1. I only see /init.rc and /system/init.rc. Is /data/init.rc something that you created just for the purpose of mounting the file.
Click to expand...
Click to collapse
Yeah it's referenced in /init.rc Easier to use since unlike /system/init.rc, it's not in a ro folder. You could use /system/init.rc too. Either way really.

jashsu said:
Yeah it's referenced in /init.rc Easier to use since unlike /system/init.rc, it's not in a ro folder. You could use /system/init.rc too. Either way really.
Click to expand...
Click to collapse
Ok.. I'll probably just stick with partitioning the sdcard into fat and ext2. Its working well for me and there really isn't a whole lot of advantages having the ext2 as a file on the fat partition.
I have 41 apps installed on the sdcard now (including some huge games like bonzai blast and brain genius deluxe) and I still have 59 megs of free internal storage. I think everybody that has a rooted g1 should put apps to the sdcard.

Related

modified: Installing & Run application on sdcard

WARNING: Proceed at your own risk, this may damage your phone and/or make it unstable. This is for advanced users only and should only be attempted by those who understand the risks of the following changes
Original post: http://www.androidin.net/thread-1099-1-1.html
AS usual, this is for those WITH ROOT ONLY
Preparation:
1. Installed JF RC30 V1.2 (only if you are using JF RC30 1.2 , this is not compatible with RC8)
2. Make a NANDROID backup (you may get everything back to normal if the phone screw up)
3. A MICRO-SD card with 2 partitions divided : (1) a fat-32 partition, (2) a ext2, you need a linux/mac to format the sdcard with ext2 partition
* the fat 32 will be mounted as sdcard and the ext2 will be mounted as /sd for application data, make your own decision for the size*
4. insert the sdcard with 2 partition on the phone
5. set the phone to aeroplane mode for safe
Procedure:
1. adb pull /system/etc/mountd.conf /*somewhere you may want to back it up*
2. rm -f /system/etc/mountd.conf
3. using the modified mountd.conf, adb push /*the path of modified mount.conf */mount.conf /system/etc/mountd.conf
4. adb pull /system/init.rc /*somewhere you may want to back it up*
5. rm -f /system/init.rc
6. using the modified init.rc, adb push /*the path of modified init.rc*/init.rc /system/init.rc
7. reboot
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
Now, the phone will install and run everyone on /sd, still mounting /sdcard as usual. It is possible that to mount or unmount /sdcard by usb without everything screwed up. Beware that your sdcard will be used as part of system, removing the sdcard may freeze the phone. If the phone get freeze because of removing the sdcard, plug the sdcard again and soft reset.
It is also possible that copy the application data to another card. If you want to change the sdcard, switch the phone off, mounting the sdcard to computer directory, copy the /sd partition to another sdcard with ext2 partition
Back to normal:
1. rm -f /system/etc/mountd.conf
2. adb push /*the backup of mountd.conf* /system/etc/mountd.conf
3. rm -f /system/init.rc
4. adb push /*the backup of init.rc* /system/init.rc
5. busybox cp -a /sd/ /data/app
6. rm -r /sd/
Change of mountd.conf:
changing /dev/block/mmcblk0 to /dev/block/mmcblk0p1
change of init.rc:
adding
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mknod /dev/mmcblk0p2 b 179 2 1000
mount ext2 /dev/mmcblk0p2 /sd noatime nodiratime
Any chance of this being simplified into the actual commands necessary for this!?
I'm a semi-noob at *nix stuff... I can format my SD card into 2 partitions, but I'm lost at step 4... What do we need to edit??
Changed step 4...just adb pull the mount.conf for editing..open the file in text editor..find "mmcblk0" and change it "mmcblk0p1" ..save the .conf...del the original one..push the new one to the original directory..
Yay. Now hopefully we can get this in an update.zip to flash
Yeah, I'm putting off doing this until someone makes an update.zip which I definitely know how to apply and get rid of if I screw anything up
REPLACES the internal memory...?
So the internal memory isnt used?
kinda the same trick as the browser cache and market cache, just a bit more complex as its an entire filesystem your moving, which wouldnt let the sys see the internal, mem, please correct me if im reading it wrong, Im not a total noob at linux but no guru dev either...
bhang
The internal memory is still used, just not for /data/app
19.rm -r /data/app
20.ln -s /sd/app /data/app
Click to expand...
Click to collapse
It should probably be /sdcard/app. In any case, this is a fairly complex mod that is not suited for Linux newbies. I would advise against folks considering this mod unless they understand and can test each step before attempting.
I agree and added a warning to the first post
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Stericson said:
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Click to expand...
Click to collapse
The procedure calls for two partitions on the microsd, one FAT32, other EXT. Theoretically it should work with mounting for mass storage. However, I agree that it's a rather sloppy hack.
There is talk about a similar strategy being officially implemented by the Android team. Instead of two partitions, it would be loopback mounted to a file in the FAT32. That would also provide some encryption security. See here. It's just talk though. Won't be a reality for at least a few months.
Well talk is certainly better than nothing...thanks for the info....
Stericson
I post a method withtout compiling the ramdisk.img but that do not force mounting the sd ext2 drive under rootfs but still workable...probably when i back to work I can compile 1 to flash
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
TheDudeOfLife said:
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
Click to expand...
Click to collapse
/sd is /sdcard (mount point for the micro sd card's partition)
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
pershoot said:
/sd is /sdcard (mount point for the micro sd card's partition)
Click to expand...
Click to collapse
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
IzzeLing said:
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
Click to expand...
Click to collapse
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
This line looks mangled (need flags in the args):
Edit: nevermind, looks like it should work in the init.rc
TheDudeOfLife said:
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
Click to expand...
Click to collapse
ahh yea. i just re-glanced over the instructions.
cool.
TheDudeOfLife said:
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
Click to expand...
Click to collapse
Yeah, don't see it. Hm.

ROM Developers: Please switch to ext3 for a2sd!

99% of the problems users are having with Apps2SD are caused by the unclean shutdown of the ext2 filesystem, because Android does not unmount it when rebooting or shutting down the system, and there are no tools on the device to fsck the filesystem on boot. Ext3 is journaled and this isn't an issue because the journal will simply replay on boot.
I'd like to put an end to this.
Attached is e2fsprogs (tune2fs, e2fsck, resize2fs, and mke2fs) built for Android/ARM. You should also use the "-t auto" mount option so that it's still backwards compatible with ext2.
To convert your ext2 to ext3, you can simply run "tune2fs -j /dev/block/mmcblk0p2" after you have these tools on your device, and reboot (assuming your ramdisk allows for mounting as "auto"). You should unmount and e2fsck the partition first, if it's not been checked for errors.
Step by step by neoobs
can we have a noob-friendly guide to this preferably through terminal.
cyanogen said:
99% of the problems users are having with Apps2SD are caused by the unclean shutdown of the ext2 filesystem, because Android does not unmount it when rebooting or shutting down the system, and there are no tools on the device to fsck the filesystem on boot. Ext3 is journaled and this isn't an issue because the journal will simply replay on boot.
I'd like to put an end to this.
Attached is e2fsprogs (tune2fs, e2fsck, resize2fs, and mke2fs) built for Android/ARM. You should also use the "-t auto" mount option so that it's still backwards compatible with ext2.
To convert your ext2 to ext3, you can simply run "tune2fs -j /dev/block/mmcblk0p2" after you have these tools on your device, and reboot (assuming your ramdisk allows for mounting as "auto"). You should unmount and e2fsck the partition first, if it's not been checked for errors.
Click to expand...
Click to collapse
Will this work with ADP JF1.5?
Before I try it, let me get a few things straing. I have to put these files in the corresponding folders, reflash, then type type the commands from terminal on the phone? Or does this have to be done with adb?
Beast84 said:
Will this work with ADP JF1.5?
Before I try it, let me get a few things straing. I have to put these files in the corresponding folders, reflash, then type type the commands from terminal on the phone? Or does this have to be done with adb?
Click to expand...
Click to collapse
its already working for ADP. I have both my phones running on EXT3 and I havent found a problem. Its more reliable and I have gotten a Force Close or Wait screen with all the speed his build has.
cyanogen said:
To convert your ext2 to ext3, you can simply run "tune2fs -j /dev/block/mmcblk0p2" after you have these tools on your device, and reboot (assuming your ramdisk allows for mounting as "auto"). You should unmount and e2fsck the partition first, if it's not been checked for errors.
Click to expand...
Click to collapse
Huh?
Can you explain this in English please?
Henchman said:
Huh?
Can you explain this in English please?
Click to expand...
Click to collapse
I mainly intended this for other ROM makers, so they can incorporate these features into cooked ROMs.
So this basically means all of us with ext2 partitions will have to get a new card or is there anyways for us to convert to ext3?
djdeviance said:
So this basically means all of us with ext2 partitions will have to get a new card or is there anyways for us to convert to ext3?
Click to expand...
Click to collapse
please re-read the first post.
"To convert your ext2 to ext3, you can simply run "tune2fs -j /dev/block/mmcblk0p2" ....
pershoot said:
please re-read the first post.
"To convert your ext2 to ext3, you can simply run "tune2fs -j /dev/block/mmcblk0p2" ....
Click to expand...
Click to collapse
Yes I did read that and tried as well. Was unsuccessful that why I asked.
Premature SD failure from frequent journal commits?
I wondered why this solution wasn't inplemented from the beginning. However, In one of the threads on A2SD, I read that moving /DATA/DATA to SD would negatively affect the longevity of the SD cards because of the frequent write/re-write cycles of files in that directory, particularly sqlite database commits . One contributor suggested that a using a journalled filesystem in this context would have a similar effect in that there would be repeated writes to the specific area of the SD where the journal is stored.
Any thoughts on this?
Once we run the commands in terminal, will that wipe everything off the ext partition? Or will it just convert the ext2 to ext3 & leave all my apps intact?
sir*mez said:
its already working for ADP. I have both my phones running on EXT3 and I havent found a problem. Its more reliable and I have gotten a Force Close or Wait screen with all the speed his build has.
Click to expand...
Click to collapse
I am not on his build. I am on ADP JF1.5
Which is why I asked if it will work on JF's build & not his build. I know it works on his. He's the one who brought it up
arqueware said:
I wondered why this solution wasn't inplemented from the beginning. However, In one of the threads on A2SD, I read that moving /DATA/DATA to SD would negatively affect the longevity of the SD cards because of the frequent write/re-write cycles of files in that directory, particularly sqlite database commits . One contributor suggested that a using a journalled filesystem in this context would have a similar effect in that there would be repeated writes to the specific area of the SD where the journal is stored.
Any thoughts on this?
Click to expand...
Click to collapse
Most Class 6 cards support wear leveling these days.
Beast84 said:
I am not on his build. I am on ADP JF1.5
Which is why I asked if it will work on JF's build & not his build. I know it works on his. He's the one who brought it up
Click to expand...
Click to collapse
aaahhhh... ;p no i dont think jf has made his EXT3 compatable which is why cyangen is asking every dev to use EXT3.
Cyanogen
Can I put these files in my ADP JF1.5 update.zip & flash that? Or does something else need to be done to have it see the ext3 partition? Also your boot.img with the noatime change, can I put that in also? Or could you possibly take the boot.img from JF1.5 & change it for me?
ext3 is built in ;P
Code:
$ adb shell cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev debugfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev tmpfs
nodev inotifyfs
nodev devpts
ext3
ext2
nodev ramfs
vfat
yaffs
yaffs2
Your ramdisk needs to mount the partition with "-t auto" (or "-t ext3" if you don't want backwards compatibility) instead of "-t ext2" for it to be effective. My build is the only one that does this so far AFAIK. In the JF builds, you need to change the "runme.sh" script.
cyanogen said:
Your ramdisk needs to mount the partition with "-t auto" (or "-t ext3" if you don't want backwards compatibility) instead of "-t ext2" for it to be effective. My build is the only one that does this so AFAIK.
Click to expand...
Click to collapse
I'm guessing that wouldn't be an easy change to do? Well I guess I will have to try one of the new roms which supports this since JF doesn't update his releases like the other guys do
Beast84 said:
I'm guessing that wouldn't be an easy change to do? Well I guess I will have to try one of the new roms which supports this since JF doesn't update his releases like the other guys do
Click to expand...
Click to collapse
It requires a little bit of hacking.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
cyanogen said:
It requires a little bit of hacking.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
Click to expand...
Click to collapse
Wow all I see is matrix code! Thanks anyway I will read up, see what I can make of it. Thanks for pointing me in the right direction at least

[DEV] Someone ever tried an "init.d/rc0.d" script on Android ?

While messing around with ext2 and data2ext i noticed that android doesn't umount the sd-ext partition (Vold process unmounts the fat partition just fine as it can be seen with logcat). Also cyanogen states the same in this posting (Im wasn't sure on this but i don't doubt him EDIT: i doubt him now ... ).
I wonder now why the recommended solution for file corruption issues is using ext3/4 (wich slows things down due to the journal and reduces the lifetime of flashdrives due to limited r/w cycles) instead of just make a shutdown script wich unmounts the ext partition? (About lifetime: I think 10.000-100.000 r/w cycles is a rather high value and lifetime is only a theoretical and not a practical issue - but im not sure on this)
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Edit: At least if rc0.d scripts are run BEFORE logcat stops it doesn't work. Logcat log is empty if i "grep test" an "echo "test"" script.
Need help. Someone ...
melethron said:
While messing around with ext2 and data2ext i noticed that android doesn't umount the sd-ext partition (Vold process unmounts the fat partition just fine as it can be seen with logcat). Also cyanogen states the same in this posting (Im wasn't sure on this but i don't doubt him ).
I wonder now why the recommended solution for file corruption issues is using ext3/4 (wich slows things down due to the journal and reduces the lifetime of flashdrives due to limited r/w cycles) instead of just make a shutdown script wich unmounts the ext partition? (About lifetime: I think 10.000-100.000 r/w cycles is a rather high value and lifetime is only a theoretical and not a practical issue - but im not sure on this)
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Click to expand...
Click to collapse
Does /system/bin/shutdown get called to turn off the phone?
Logcat looks like its the last thing to stop
coutts99 said:
Does /system/bin/shutdown get called to turn off the phone?
Logcat looks like its the last thing to stop
Click to expand...
Click to collapse
Code:
adb logcat | grep /system/bin/shutdown > ~/shutdowntest.log
Empty file
Although the file is present in ROM's so maybe it IS called after logcat stops. But i don't know if it's added to Custom ROMs and if it's also present in RUU's.
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
melethron said:
Code:
adb logcat | grep /system/bin/shutdown > ~/shutdowntest.log
Empty file
Although the file is present in ROM's so maybe it IS called after logcat stops. But i don't know if it's added to Custom ROMs and if it's also present in RUU's.
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
Click to expand...
Click to collapse
hmm, interesting. Maybe have to poke through the source and see what is called to shutdown the phone.
Sent from my HTC Desire using XDA App
coutts99 said:
hmm, interesting. Maybe have to poke through the source and see what is called to shutdown the phone.
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
I think this would be a major improvement. Since journaling is actually bad for sd's. Im not sure on this, but the journal is in some specific area on the filesystem. If this is the case I'm not sure if algorithms used to distribute r/w on flash drives will help if the journal gets overwritten (as i understand it so far the r/w is distributet over FREE space but not if something gets overwriten). If this is the case the part of the SD with the journal will be stressed heavy.
I've been playing around with data2sd with ext2 for a few weeks now.
I might be wrong but I think that the system is unmounting cleanly /data (and not /dev/block/mtdblock5) because I always have a clean e2fsck log after rebooting the phone.
So basically if you mount something under the /data mountpoint, it won't be cleanly unmounted and you'll end-up with corrupted FS. That what happens for A2SD because /data is still /dev/block/mtdblock5. But if you mount straight over /data, like I do with DATA2SD, the system unmounts /data on shutdown, witch is now your ext partition (whether your ext partition or a file on ext partition mounted via a loop device) and your FS is not corrupted. In that case you don't need journaling and can stick with ext2.
sibere said:
I've been playing around with data2sd with ext2 for a few weeks now.
I might be wrong but I think that the system in unmounting cleanly /data (and not /dev/block/mtdblock5) because I always have a clean e2fsck log after rebooting the phone.
So basically if you mount something under the /data mountpoint, it won't be cleanly unmounted and you'll end-up with corrupted FS. That what happens for A2SD because /data is still /dev/block/mtdblock5. But if you mount straight over /data, like I do with DATA2SD, the system unmounts /data on shutdown, witch is now your ext partition (whether your ext partition or a file on ext partition mounted via a loop device) and your FS is not corrupted. In that case you don't need journaling and can stick with ext2.
Click to expand...
Click to collapse
Im pretty sure for 3 reasons that it doesnt unmount data:
1. Android unmounts "/sdcard" as it can be seen in logcat while other stuff isn't unmounted. It may be still that the other unmount stuff is not not by the "Vold" process. Sdcard needs to be able to get unmounted when the phone is plugged to usb.
2. I also did quite a lot testing with sd-ext directly mounted to /data and i did get quite a lot corruption. But it is situation depended. If my phone was "idle" i didn't get corruption (1 time in 20 reboots) with no corruption. Then to make absolutly sure that it works i shut it down right after it boots up. There is many stuff running then wich means there is a much higher chance that something is still written while it shutdowns. Doing this i had corruption every 3rd reboot.
3. And this is the most important reason why you didn't get corruption but i did : You use sync as a mount option so you there is no need to unmount it ^^ !!!!
Sync is not an option for me for some reason:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
melethron said:
Im pretty sure for 3 reasons that it doesnt unmount data:
1. Android unmounts "/sdcard" as it can be seen in logcat while other stuff isn't unmounted. It may be still that the other unmount stuff is not not by the "Vold" process. Sdcard needs to be able to get unmounted when the phone is plugged to usb.
2. I also did quite a lot testing with sd-ext directly mounted to /data and i did get quite a lot corruption. But it is situation depended. If my phone was "idle" i didn't get corruption (1 time in 20 reboots) with no corruption. Then to make absolutly sure that it works i shut it down right after it boots up. There is many stuff running then wich means there is a much higher chance that something is still written while it shutdowns. Doing this i had corruption every 3rd reboot.
3. And this is the most important reason why you didn't get corruption but i did : You use sync as a mount option so you there is no need to unmount it ^^ !!!!
Sync is not an option for me for some reason:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
Click to expand...
Click to collapse
To me, the main purpose with data2Sd was to get more storage with at least the same amount of performances than the original NAND. I found that, on top of the extra space I have now, I also have a very good performance, roughly the same as NAND on small files and a much better one on bigger files. And I'm not thinking about quadrant score here
Talking about the unmount, if I run an e2fsck -n on the ext2 file while it's in use by the system, I have a report of a few errors (like deleted inode with nodtime, or wrong count of free blocks) But if I shut down the phone and turn in on again, the e2fsck I run at boot reports no errors at all. I might be wrong but my guess is that there is a clean umount done at some stage...
What I am going to do is an other test. You know that when an ext2 partition is not umounted properly, a flag is activated and this ext2 partition must be checked, regardless of the number of mounts done before running a check. This flag can be check by running a tune2fs -l on the partition before mounting it. It is reported as well by the system that the partition hasn't been unmounted properly when you try to mount it and that it should be checked .
So If i turn off my phone, restart in recovery mode, run a tune2fs -l on the ext2 file or mount it manually, I should be able to see if the partition has been unmounted by the system or not before the actual reboot.
I'll report the results and let you know if I'm wrong
OK
I've just turned off my phone. rebooted in recovery, mounted the 2nd FAT32 partition and run a tune2fs -l ext2 (that's the name of my ext2 file mounted via a loop device over /data)
Here is the result:
Code:
tune2fs 1.40.8 (13-Mar-2008)
Filesystem volume name: userdata
Last mounted on: /data
Filesystem UUID: 296f98d0-21e8-48b6-82ac-6c94c4edf28d
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr dir_index filetype sparse_super
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 60800
Block count: 243056
Reserved block count: 0
Free blocks: 168874
Free inodes: 57516
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 7600
Inode blocks per group: 475
Filesystem created: Tue Dec 7 15:00:51 2010
Last mount time: Thu Dec 9 17:40:16 2010
Last write time: Thu Dec 9 21:16:43 2010
Mount count: 1
Maximum mount count: 21
Last checked: Thu Dec 9 17:40:10 2010
Check interval: 15552000 (6 months)
Next check after: Tue Jun 7 17:40:10 2011
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Default directory hash: half_md4
Directory Hash Seed: 8ff9238f-aef7-48a7-85e1-7d2d45b9e809
You can see that it's reporting that the system is clean. If the ext2 partition wasn't cleanly unmounted by the system at shutdown, it would never report as being clean.
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
It's reporting 1 as mount count because I'm forcing an fsck on boot anyway.
This doesn't mean that I will never get errors tho. I even have some errors from time to time when I reboot my linux home server
melethron said:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
Click to expand...
Click to collapse
Remember that there is no writeback cache (AFAIK) with YAFFS2
But I should try with sync off and see if the system is still "clean" after a shutdown. If the systems unmounts ext2 properly, then the cache should be flushed by the system before unmounting the filesystem.
sibere said:
OK
I've just turned off my phone. rebooted in recovery, mounted the 2nd FAT32 partition and run a tune2fs -l ext2 (that's the name of my ext2 file mounted via a loop device over /data)
You can see that it's reporting that the system is clean. If the ext2 partition wasn't cleanly unmounted by the system at shutdown, it would never report as being clean.
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
It's reporting 1 as mount count because I'm forcing an fsck on boot anyway.
This doesn't mean that I will never get errors tho. I even have some errors from time to time when I reboot my linux home server
Click to expand...
Click to collapse
You are right about the "clean" flag being set while unmounted. But you forgot one thing. The "clean" flag must be cleared when the partition is mounted. You should check if it as also reported while it IS mounted .... if so mount doesn't write proberly to the superblock. I would do this myself but im on ext4 and afaik it isn't cleared on mount then. For me this far it shows also "clean" when it is mounted.
My guess that mount doesn't write the superblock proberly is also supported by the fact that your and my mount count both shows 1. This could be a coincidince (chance for this is 0,147928994083 %) but could also support my assumption.
So check again while you mounted your system.
EDIT: I completly agree with you that data2ext is about space. Considering speed i also expirienced that reading larger amounts of data from data/data is faster with data2ext. But i also expirienced some slowdown sometimes on ext 4. It was better on ext2 and with that im really fine.
Remount done: Mount count still 1. I bet you will also get clean when you mount your ext.
melethron said:
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Edit: At least if rc0.d scripts are run BEFORE logcat stops it doesn't work. Logcat log is empty if i "grep test" an "echo "test"" script.
Need help. Someone ...
Click to expand...
Click to collapse
i think that won't work with rc.0 as init.d script execution is initiated in
init.rc only for "before booting", its not as a "normal" linux init system
# Execute files in /etc/init.d before booting
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
i wonder if a shutdown.rc could be populated, there is a shutdown.bravo.rc but its empty
for init-handling, in the kernel source its in system/core/init
but im not fit with c/c++ to look into
maybe the init binary would have to be modified by a kernel dev to enable shutdown.rc / also possible that htc has motified it to not to be used.
woti23 said:
i think that won't work with rc.0 as init.d script execution is initiated in
init.rc only for "before booting", its not as a "normal" linux init system
# Execute files in /etc/init.d before booting
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
i wonder if a shutdown.rc could be populated, there is a shutdown.bravo.rc but its empty
for init-handling, in the kernel source its in system/core/init
but im not fit with c/c++ to look into
maybe the init binary would have to be modified by a kernel dev to enable shutdown.rc / also possible that htc has motified it to not to be used.
Click to expand...
Click to collapse
This would have been to easy ....
Well maybe some Kernel Dev will look into this.... coutts, sibere, anyone ... can you help ?
Btw: i still wonder why /system/bin/shutdown is present in ROMs if it's not used ....
melethron said:
This would have been to easy ....
Well maybe some Kernel Dev will look into this.... coutts, sibere, anyone ... can you help ?
Btw: i still wonder why /system/bin/shutdown is present in ROMs if it's not used ....
Click to expand...
Click to collapse
this works for the script that should be executed part
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/shutdown.d
runs every script which is in /system/etc/shutdown.d
if you create /system/etc/shutdown.d before
and put one or more executable script/s that do something in
melethron said:
You are right about the "clean" flag being set while unmounted. But you forgot one thing. The "clean" flag must be cleared when the partition is mounted. You should check if it as also reported while it IS mounted .... if so mount doesn't write proberly to the superblock. I would do this myself but im on ext4 and afaik it isn't cleared on mount then. For me this far it shows also "clean" when it is mounted.
My guess that mount doesn't write the superblock proberly is also supported by the fact that your and my mount count both shows 1. This could be a coincidince (chance for this is 0,147928994083 %) but could also support my assumption.
So check again while you mounted your system.
EDIT: I completly agree with you that data2ext is about space. Considering speed i also expirienced that reading larger amounts of data from data/data is faster with data2ext. But i also expirienced some slowdown sometimes on ext 4. It was better on ext2 and with that im really fine.
Remount done: Mount count still 1. I bet you will also get clean when you mount your ext.
Click to expand...
Click to collapse
Sorry mate, but, like I wrote in my previous post, it shows unclean when mounted.
Sent from my HTC Desire using XDA App
sibere said:
Sorry mate, but, like I wrote in my previous post, it shows unclean when mounted.
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
ROFL! I should learn to read proberly:
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
Click to expand...
Click to collapse
Well thats actually good news thanks for helping me reading. ^^
Well so this isn't a problem. Now its time for ext4 (no loop) without journal mounted to data. About the loopdevice: you might wanna read what ownhere has to say about loop.
melethron said:
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
Click to expand...
Click to collapse
http://android.git.kernel.org/?p=pl...2af4c72427ad069245d0aa572;hb=refs/heads/froyo
Some interesting stuff in this code here
coutts99 said:
http://android.git.kernel.org/?p=pl...2af4c72427ad069245d0aa572;hb=refs/heads/froyo
Some interesting stuff in this code here
Click to expand...
Click to collapse
i'm running this now on btrfs partition
/dev/block/mmcblk0p6** on /system/sd type btrfs (rw,relatime,ssd,noacl)
/dev/block/mmcblk0p6 5.2G 1.3G 3.9G 26% /system/sd
tmpfs 85.8M 24.0M 61.8M 28% /cache
a2sd btrfs *
d2sd btrfs *
dalvik-cache in /data mtd
cache in ram 90M
* without loop mounted img filesystem
** logical partition on extented partition
woti23 said:
i'm running this now on btrfs partition
/dev/block/mmcblk0p6** on /system/sd type btrfs (rw,relatime,ssd,noacl)
/dev/block/mmcblk0p6 5.2G 1.3G 3.9G 26% /system/sd
tmpfs 85.8M 24.0M 61.8M 28% /cache
a2sd btrfs *
d2sd btrfs *
dalvik-cache in /data mtd
cache in ram 90M
* without loop mounted img filesystem
** logical partition on extented partition
Click to expand...
Click to collapse
Running what now?
conventional (not froyo app2sd) a2sd + data2sd both on btrfs without loopmounted filesystem files
/data/dalvik-cache left in nand
/cache tmpfs in RAM
btrfs instead of ext4

Idea for creating extra storage space

I have a good 2 GB of space that I am unlikely to use on the /data partition. So I created an 'sdcard' directory in there. What I'm trying to do is trick the system into believing that it's a second SD card. Can android support more than one? It's all good getting the directory to work as a secondary storage place, but the problem is, media scanner will not show pictures/music that are in that directory.
So my question is, is it possible to edit the ramdisk (init.rc) or vold.fstab etc or any other files, so the system is tricked into believing it's an actual storage card? I have tried making symlinks and doing directory bindings from /data/sdcard to /storage/sdcard1, but haven't had any luck.
Edit:
something like this maybe in init.rc??
symlink /storage/sdcard /sdcard
symlink /storage/sdcard1 /data/sdcard
export EXTERNAL_STORAGE /storage/sdcard
export SECONDARY_STORAGE /storage/sdcard1
I'm sure something is possible.
The nicest thing would be to have vold bind-mount a directory or loop-mount a filesystem image, but I'm not sure vold can do that at all and if it can I don't know what the syntax for that would be.
This would probably be a bit different between sense and aosp as it looks like vold is different.
You can easily bind-mount it yourself.
Either way, if you want to mount it on (say) /sdcard2 or anywhere on the root file system, you have to edit the ramdisk in the boot image.
But you can also mount it on top of /sdcard
mkdir /data/extra_sd
mkdir /sdcard/extra_sd
busybox mount --bind /data/extra_sd /sdcard/extra_sd
( ^^^-- I found that /system/bin/mount doesn't do --bind or -o loop and that busybox mount does.)
I tried this and it works. I have not yet experimented with putting it in an init.d script or so to mount it on boot and see if mediascanner scans it.
However, using this method you may corrupt stuff when you USB-mount your sdcard onto your PC. I'm not sure.
-Jobo
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
ardax said:
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
Click to expand...
Click to collapse
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
djsubtronic said:
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
Click to expand...
Click to collapse
I don't think it should, since it's not changing the partition layout of the internal memory itself, just globbing it together and slapping virtual volumes on top with LVM. The biggest things are making sure that the kernel has LVM support and binaries built in and that recovery can get to those LVM binaries.
Perhaps I'm wrong though.
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
I really like the idea using data to get some extra space.
I tried "busybox mount --bind" via console and it works. Now i will have a look at ScriptManager.
But what happens if you are installing/updating a new ROM. Do you lose all your things located in /data?
regards
If you format /data then yes, obviously. You are only creating a "shortcut" to /data/folder.
Also, if you run out of space in /data/app/ you can move apps to /system/app instead.
I did that on my blade with a way too big /system/ partition and way too small /data/ partition
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
Could I get a hold of that script by chance?
Daiskei said:
Could I get a hold of that script by chance?
Click to expand...
Click to collapse
+1. Yes, please share.
One S | Xparent Blue Tapatalk 2 | Viper 1.2.1 | Bricked Beastmode
So updating a ROM without formating data partition should be no problem.
But for installing a new ROM i have to backup the folder in the data partition.
I tried to use ScriptManager, but this app seems to be bit overloaded.
After this i installed GScriptsLite.
In there i made a new script with something like this:
busybox mount --bind /data/myfolder /sdcard/myfolder
The script is not started automatically after a reboot, but after running the script via GScriptsLite the folder is mounted.
Yeah I suppose it could be difficult if changing ROMs, but I use CM only so I never worry about changing the data partition. But if I do, I just copy the /data/media folder onto my PC using adb pull, then do the wiping/flashing, and finally push the media folder back before booting the ROM.
As for the script, it's essentially just this one line:
Code:
busybox mount -o bind /data/media /storage/sdcard0/Music/Music2
I've kept the script file itself on the /data partition as well. In script manager I've set it to run the script as SU and on boot, and that's it. I've mounted it into a sub folder within Music since I use PlayerPro and it only adds music found within /sdcard/Music.
Yes, ScriptManager is a lot more complicated than GScripts, but it always mounts it automatically on boot so saves the hassle of having to remember to manually run the script if you ever reboot. Plus you only have to sort it out once then never open the app again if you don't want to

method to set 0123-4567 as mount point for removable sdcard

This is a very annoying issue but I have not found any thread about it.
I'm trying to upgrade my external/removable sdcard for an android 6 device.
The new sdcard gets mounted to /mnt/media_rw/XXXX-XXXX (i.e. not 0123-4567), so no app works as files can't be found.
The linux way (ln) wont work. Simply creating /mnt/media/0123-4567 causes bad bootloop on my device. This suggests that FolderMount app or Magisk modules such as fbind are a bad idea. selinux is enforcing.
It appears that Android assigns different mount points are to different sdcards and the first sdcard always gets 0123-4567. It that's right, Android probably stores sdcards' identifiers so as to know which mount point to use at boot time. So, deleting the identifiers database would probably mean that the next card inserted would get 0123-4567 as mount point.
I have looked at the data of com.android.externalstorage, but there is nothing there. I don't see other obvious candidate apps.
Where is this ext sdcard data stored?
I was wrong. Android sets mount points matching sdcard uuid
How to change vfat partition UUID?
How do I change the UUID of a vfat partition? For ext2 / ext3 / ext4, this is done with a simple: tune2fs -U <new-uuid> /dev/<partition> Is there a similar command for vfat partitions?
superuser.com

Categories

Resources