[Q] KitKat CM11 SDCard Usage (Best) Options - General Questions and Answers

EDIT:
I am a programmer with experience working on Linux, brand new to Android. Recently I got my first Android phone, a Moto G 4G (XT1045) and installed CM11-20141009-NIGHTLY-peregrine on it. Today I bought a 32GB SDCard and formatted it to ext4 filesystem with AParted.
So it seems like cyanogenmod kernel should have SDCard fix for kitkat built in. Now I have a specific problem. I am trying to switch Titanium Backup to use sdcard1 as backup the location. So I have to browse to that folder.
My sdcard seems to be mounted in two places:
/mnt/media_rw/sdcard1
/storage/sdcard1
but both of them have problems. /storage/sdcard1 is a fuse mount and is read-only, even to root. I can browse there with TitaniumBackup, but then TitaniumBackup can't write any backups. /mnt/media_rw/sdcard1 is writable, and I can make directories on it from adb. But TitaniumBackup cannot browse inside of it, because media_rw is only accessible to user 1023(AID_MEDIA_RW). So I can't point TitaniumBackup to my sdcard!
How to fix this?

Related

Flirting with CM7 -- Notes and Observations

I have been a big fan of VEGAn Ginger -- sure it has some issues but it works pretty well. But recently I was wondering how much of an issue would it be to install CM7.02, the VTL Launcher, and whatever other extras and just keep up to date.
I did and for the most part it works the same. A few things were FC that didn't on VEGAn and a few things worked that FC on VEGAn. No big difference on too many things.
However, two issues came up.
1) CM really wanted to install ROM Manager. The CM forum implied it works ok so I tried it. It DOES work on my system but it expects everything on /mnt/emmc which was a pain since all my backups and recovery were on the external sdcard /mnt/sdcard2 in VEGAn and /mnt/sdcard in CM7. What's worse is apparently it will refuse to flash over it self with an old version! So it wasn't insurmountable, just required me to move everything for awhile. But I finally got tired of it and reflashed good old bekit 0.8 using nvflash. So if you experiment, be sure you have a backup of partition 9 (clockwork mod) or you know how to unpack the ZIP file and flash it.
2) This brings up an interesting issue. I was going to try it but I didn't because I realized I'd have to repack the root directory and I didn't want to do it. But if the Gingerbread ROM repackagers were interested this would be easy for them to do. I'd propose having 3 directories in /mnt (well, plus the others, but 3 we are interested in): /mnt/emmc /mnt/sdcard /mnt/sdcard2
What you would do is let CM7 mount /mnt/emmc as always and change vold.conf to mount the external card at /mnt/sdcard2. Then you bind mount /mnt/emmc over /mnt/sdcard. That way you have the exact same filesystem at /mnt/emmc and /mnt/sdcard and in CM7 and the other ROMs it would "just work" since regardless of where you were looking for the SDCARD you'd wind up with the internal unless you looked for sdcard2.
I understand not all devices have big internal SD and that's why CM is set up the way it is, but if we are mucking with the mount scheme anyway, why not like this?
I may go in and try it again if I reinstall CM7. Without having to recast the ROM you'd have to put a userinit script in that DID not block but would spin off a process to wait for /dev/emmc to mount and then moved /mnt/sdcard to /mnt/sdcard2 and then created /mnt/sdcard again and did the bind mount. This requires a remount of root to make it writeable, etc. Kind of a pain.
Something like this (untested):
#!/system/bin/sh
( until mount | grep -l sdcard
do
mount -o remount,rw / /
mv /mnt/sdcard /mnt/sdcard2
mkdir /mnt/sdcard
chown 1000 /mnt/sdcard
chgrp 1015 /mnt/sdcard # whatever sdcard_r gid is? 1015? 1025?
chmod 076 /mnt/sdcard
mount -o bind /mnt/emmc /mnt/sdcard
mount -o remount,ro / /
done ) &
Something like that. Would be easier if you could just get vold to mount on sdcard2 to start with and have /mnt/sdcard and /mnt/sdcard2 already created in /mnt.
Just a thought.
By the way, another trick like this that I do is to mount sdcard2 as a subdirectory of sdcard. That works great EXCEPT when you USB mount the tablet it never works until you unmount. Not a big deal but a pain.
Good suggestion, but it's easier to just symlink /mnt/sdcard to /mnt/emmc and mount the internal SD card there--assuming that vold does not check that the mount point is not a symbolic link. The external SD card can be mounted on /mnt/sdcard2.
However, this might be a temporary problem. Google, for Gingerbread, wants the removable SD card on all devices, whether cell phone or tablet, to always be mounted on /mnt/sdcard (or /sdcard) and the internal SD card to be mounted elsewhere (/mnt/emmc, I believe), which is why Gingerbread-based firmwares like CM7 have /mnt/emmc and /mnt/sdcard as mount points.
In 6 months, hopefully, everybody will be on Gingerbread+ and the current multiplicity of possible mount locations will cease to be an irritation.
you have emmc and sdcard mountable right now. you can also mount a usbdisk. you can have 2 mounts going at the same time currently.
Screenshots? Last I checked (7.0.2) you still could not take a SS by any method on CM7.
That's pretty much why I'm on VEGANginger.
I used the vold.fstab.zip thing floating around here or on the CM forums to change the fstab on CM7 to be like VEGANtab/froyo for mounting the internal sdcard - makes all the 3rd party apps happy.
schettj said:
Screenshots? Last I checked (7.0.2) you still could not take a SS by any method on CM7.
That's pretty much why I'm on VEGANginger.
I used the vold.fstab.zip thing floating around here or on the CM forums to change the fstab on CM7 to be like VEGANtab/froyo for mounting the internal sdcard - makes all the 3rd party apps happy.
Click to expand...
Click to collapse
Same thing here, it makes almost everything back to normal, unless you try to use ROM Manager automagically, which will fail.
rajeevvp said:
Good suggestion, but it's easier to just symlink /mnt/sdcard to /mnt/emmc and mount the internal SD card there--assuming that vold does not check that the mount point is not a symbolic link. The external SD card can be mounted on /mnt/sdcard2.
However, this might be a temporary problem. Google, for Gingerbread, wants the removable SD card on all devices, whether cell phone or tablet, to always be mounted on /mnt/sdcard (or /sdcard) and the internal SD card to be mounted elsewhere (/mnt/emmc, I believe), which is why Gingerbread-based firmwares like CM7 have /mnt/emmc and /mnt/sdcard as mount points.
In 6 months, hopefully, everybody will be on Gingerbread+ and the current multiplicity of possible mount locations will cease to be an irritation.
Click to expand...
Click to collapse
Symlinks don't work for everything -- especially any FS that is VFAT. Bind mounts always work even through a chroot, etc. I don't think you can mount on top of a symlink either although I could be wrong. Same problem with trying to symlink /mnt/sdcard/sdcard2 => /mnt/sdcard2. The sdcard FS is VFAT so...
schettj said:
Screenshots? Last I checked (7.0.2) you still could not take a SS by any method on CM7.
That's pretty much why I'm on VEGANginger.
I used the vold.fstab.zip thing floating around here or on the CM forums to change the fstab on CM7 to be like VEGANtab/froyo for mounting the internal sdcard - makes all the 3rd party apps happy.
Click to expand...
Click to collapse
screen shots are in cm7 now.
wd5gnr said:
Symlinks don't work for everything -- especially any FS that is VFAT. Bind mounts always work even through a chroot, etc. I don't think you can mount on top of a symlink either although I could be wrong. Same problem with trying to symlink /mnt/sdcard/sdcard2 => /mnt/sdcard2. The sdcard FS is VFAT so...
Click to expand...
Click to collapse
No, symlinks will work in this case because the link in not on the VFAT filesystem--it's outside it. And, you can mount through a symlink.
pershoot said:
screen shots are in cm7 now.
Click to expand...
Click to collapse
Hm... they didn't work in 7.0.2 when I flashed it. So they're in the nightly since? I could flash over and kick the tires.

[Q] SD Card will not mount after ext4 part.

Attempting to partition sd card with ext4 -a process I completed multiple times successfully on a Nexus One, the process appeared to complete but now the phone will not mount the sd card. I've tried a wipe/reset, to no avail. I can still access and partition the sd card through adb, but the phone cannot mount it to format/partition, restore from recovery, partition sd-card from within ClockWork Recovery, nothing. I've re-partitioned the sd card through adb, which indicated a successful completion, but the phone still refuses to mount the sd card. If this weren't a Nexus S with it's cursed internal sd-card I would simply swap out the sd card with another or format it externally like all the google topics I pull up on the subject suggest.
Is this fixable or has the fused sd-card scenario become a liability?
Common Error messages:
Can't mount /sdcard
Can't mount /sdcard/.android_secure
Phone: Nexus S (US, T-Mobile, manufactured Dec. '10)
Recovery Img: ClockworkMod Recovery 3.0.2.4
Rom: CM 7.0.3 (now wiped, cannot put back on since sd card won't mount)
fstab:
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/platform/s3c-sdhci.0/by-name/userdata /data ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
Can mount everything except the last one, /sdcard.
I've tried all the recommended procedures garnered from the first 10 or so pages in google, xda, cyanogem forum, etc:
Restore from nandroid: Not possible, can't mount the SD,
Wipe/Reset: can't wipe /media as sd card won't mount,
partition sd card from within Clockwork: indicates success but does nothing,
format from within clockwork: unable to mount,
repartition using adb: works, parted can see them, I can move files to from, but the phone will not mount,
clearing fstab: no effect,
Fastboot works, but I don't have the proper images. ADB works, as do the installed utilities. Have not tried ODIN as again, I don't have the proper images. Should I attempt to compile my own images from source?
Update: SOLVED, Microsoft Windows. To whom it may concern: I was able to mount the /dev/block/platform/s3c-sdhci.0/by-name/media from two different laptops running OSX and Fedora/Ubuntu then successfully been able to partition them with fat32 as the ClockworkMod (and maybe Cyanogen?) expect with 0 progress. Then I pulled out an old Windows machine, installed the JDK/ADK's +tools and performed the same procedure and that time it worked. I'm uncertain as to what particular quality a 'genuine' Windows formatting provides, but either this phone or the particular software combination I'm running require it. I was able to mount & re-partition the /sdcard in Clockwork, then manually remove rebuild them and upgrade to ext4 using tune2fs as usual. In the interim for work and such, I had to find a surrogate (for the SIM) and could only find and old k750i (which still had a full charge and worked flawlessly all day, btw). Wow phones used to be small.
I think I was missing something about the way ClockworkMod handles fstab, because everytime I would modify it specifically to the specs I passed to parted while creating the partitions with mkpartfs, it would either ignore or overwrite them. So be careful messing with the sd-card, the S's aren't like the One's in the sense that if you screw it (the sd-card) up or it goes bad you can't just take it out and format it in another machine/phone, you have to appeal to ClockworkMod. ODIN $ucks by the way, I found fastboot to be much more effective.
If you format the sd partition ext4, then you should change the fstab too.
from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
to from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard ext4 rw
or from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard auto rw
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Of course, I don't know, whether the recovery has the vfat type in fstab. You might have to change it there too. On my linux box auto works very well in fstab.
Of course, if you partition your sd partition ext4, you won't be able to use it as usb memory from windows. (At least I am pretty sure you can't, haven't tried)
Well of course I couldn't let it die, I went back and started tinkering again now that I have a way back. I can't change the fstab it seems, whatever I change it to gets over written everytime either Clockwork or the Rom starts. It's weird, I know I'm missing something and I don't know much about CWMod. (had Amon_Ra on the N1, which had the nifty fsupgrade script)
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Click to expand...
Click to collapse
I'm quite familiar with unix style fs and fstab, it's the stubbornness I'm not used to. I'm also spoiled by vi and nano. CW has some nice scripts built in as well though.

/storage, /mnt, cannot nandroid from ROM manager

I'm not sure when this started, but it could have been when I flashed the latest CWM recovery last week. Here's the deal. I've been running CleanROM 7 for several months with Darkhorse theme and Gunthermic's inverted apps. I went to flash some inverted apps Gunthermic recently updated and tried to nandroid like I've done for the last year with ROM Manager. I always backup to the extsdcard. I have ROM Manager set to save to the external sd card. It failed saying it could not find the path to /storage/sdcard1/clockworkmod/. This seemed strange to me because it formerly had the path set as /mnt/extsdcard/. Using Root Explorer, I investigated /storage/. In this folder is /sdcard0, /sdcard1, and a bunch of /USB folders. Under /mnt/ are /sdcard and /extsdcard and they contain the same sub files and folders as /storage/sdcard0 and /storage/sdcard1. I then tried to nandroid from recovery and the path options were /storage/sdcard0 and /storage/sdcard1. I tried sdcard1 since it is apparently the external sd card and it worked.
Any thoughts about
1. why it changed from /mnt/extsdcard to /storage/sdcard1?
2. why it fails to backup direct from ROM Manager?
3. why /storage is the same as /mnt?

[Q] How to mount ext sdcard as read-only in 4.1.2

Hi,
I have a Samsung Galaxy S3 verizon model. Its rooted and running CleanROM 6.0R2 ROM android 4.1.2.
I am trying to accomplish below
1. Mount external sdcard in read-only mode. This is to avoid files on the extsdcard being accidentally deleted.
I have music and some old photos in there. Sometimes my son plays with the phone. I don't want him
to delete all the photos/music on the external sdcard.
I have tried following, but none of then resolved the issue
1. Partition external sd card as ext3 and set all files/dir to read-only permission from ubuntu box.
This didn't work because, phone doesn't recognize the sdcard and partitions on it.
2. Partition extsdcard as vfat and set permission for the files/dir to read-only using root-explorer.
I cannot set permissions for vfat partition.
3. Partition extsdcard as vfat and Mount extsdcard as read-only using "root-explorer".
Doesn't work. Files can be deleted from other apps like Gallery.
4. Partition extsdcard as vfat and mount extsdcard as read-only using terminal and busybox.
This works. But files are owned by root. For group and other, permission is None. Hence
other apps are not able to view the files.
From reading many posts, I conclude, partition has to be vfat for apps like Gallery/video player etc to view it.
Only option to achieve read-only on a vfat partition is to mount it read-only. Based on this, any idea how I can achieve my objective?
Also, once set, what happens is the phone is rebooted? Anyway to repeat the sets at boot time?
Thanks

Help with mounting SDExt partition

Hi floks,
I have a oneplus X phone (Onyx) with the weirdest problem with AOSP 8.1 (this rom). I am trying to mount my partitioned external SDCard (ext2 primary partition) in /data/sd to be able to move some app data to my card and free up internal space. Mounting works ok from adb ("su"+"mount -o bind /dev/block/mmcblk1p1 /data/sd") but doesn't work from terminal. I used Magisk to root my phone. I tried other methods such as fbind magisk module and all kind of apps like link2SD, App2SD, none managed to mount my partition from the phone. Mounting from the phone is mandatory to be able to mount at boot so my apps always work.
Can someone help me with that issue ? I'm a bit lost, searched a lot around but couldn't find anything. Maybe it's kernel related, or systemless root, or the way the rom is built. Note that android sees my partition and can mount it by itself on other mount points (unmounting it before mounting doesn't help)

Categories

Resources