[Q] swap /sdcard and /media directory? - Nook Touch General

Hello all,
I try to use my rooted nook firmware 1.2.1 without any SD card.
So I want to put all my files to /media directory. It works for my side loaded books but don't works for any other apps how need to access to /sdcard
For example any web browser want to save downloaded files to /sdcard
AnkiDroid also don't want to start without sdcard.
So is it possible to swap /sdcard and /media directory or change something in the nook system to declare /media directory as a SD card reader?
I found this http://forum.xda-developers.com/showthread.php?t=1991583 but not sure it will works on nook.
Thanks for your advices

Here is the content of /etc/vold.conf file
Code:
## vold configuration file for zoom2
# modified for encore
volume_sdcard {
## This is the direct uevent device path to the SD slot on the device
media_path /devices/platform/mmci-omap-hs.1/mmc_host/mmc0
partition 6
media_type mmc
##mount_point /sdcard
mount_point /media
ums_path /devices/platform/usb_mass_storage/lun0
}
volume_sdcard2 {
## Currently points to internal eMMC, assumes eMMC is formatted as FAT32
media_path /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
media_type mmc
##mount_point /media
mount_point /sdcard
ums_path /devices/platform/usb_mass_storage/lun1
}
I thing that a app control place to access user files with the function called Environment.getExternalStorageDirectory()
But I don't understand the link between that function and the content of /system/etc/vold.conf

Related

SD Card Formatting

Hi everyone,
I need to Format a SD Card (programatically ), and I havn't got the foggiest on where to start, I mean, do I need to build the whole structure on the card myself, or is there some API level I can go to to do the job.
Can anyone help me out here?
I just completed that from my linux box
I did this from my linux box to get set up for linux on the HTC apache and was listing all the gory details.
Code:
fdisk /dev/sdb //after verifiing itis correct device
p //print out partition table
d //delete existing partition if not 32M fat 16
n //new partition
p //primary
1 //number
<cr> //Accept default of first cylinder
+32M //make it 32M in size
t 6 //change it to fat16 type
n //create another partition
p //chose primary, even though it is callet ext3
2 //number it 2
<cr> //accept default
<cr> //to use rest of stick
t //set it's type
2 //select second partition
83 //type is linux (ext2 or ext3)
w // write table or you get to do it again
Unplug it and count to 5, plug it back in and cd /dev and "ls -al |grep sd"
it will probably be in a differnt location.
mkdosfs /dev/sdc1 //format the FAT16 partition In gentoo, this was in dosfstools'
mkfs.ext3 /dev/sdc2 //format the linux partition
//create a pair of mount points and mount them
cd /mnt
mkdir MiniSDDos
mkdir MiniSDLinux
mount /dev/sdc1 /mnt/MiniSDDos
mount /dev/sdc2 /mnt/MiniSDLinux
transfer rd,zimiage,default.txt and gnuharet-200603042123.exe to dos partition

[Q] SD wrong size ...

I have a 2GB card in my NC, and it's only showing 1.00GB size on the NC.
When I plug it into the computer over USB, it shows only 1.00GB.
When I pull the card and put it in the computer using the builtin card reader, it shows 2GB as it should.
What gives?
I have a new card on the way, 32GB, don't want to wind up with the same issue. Help?
?s
1. did you use it to nooter/install CWM? Some of the SD card CWM installers reformat the sd card to 1gb
Use easus partition to format the entire SD card and fix this...
2. did you get it off ebay? some people have reported getting fake cards there (where the actual capacity of the card is less than reported) though typically they can get it to fake the higher capacity until you write to it above its actual capacity.
I formatted it to 2GB in my computer. I can put the card directly into my computer and write 2GB on it. The problem with the card only occurs when it is in the NC.
??
and with file explorer can you see the 2gb of files on the sd when it's in the NC?
what happens when you connect to the NC as a flash drive? can you see the 2gb of files then? Do you also see your media partition?
The nook color internal memory has two partitions. A system partition and a media partition that you can connect to over usb. Some versions of Nook color had the media partition formatted to be 1gb.
gallahad2000 said:
and with file explorer can you see the 2gb of files on the sd when it's in the NC?
what happens when you connect to the NC as a flash drive? can you see the 2gb of files then? Do you also see your media directory?
The nook color has two partitions. A system partition and a media partition that you can connect to over usb. Some versions of Nook color had the media partition formatted to be 1gb.
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
1.00 Gb according to the NC.
As I said, when I connect the NC to the computer over USB it also appears as 1 gb. When I remove the card and put it directly into the computer it is 2 gb.
There is no media directory.
It appears the NC doesn't correctly recognize the card.
mr72 said:
It appears the NC doesn't correctly recognize the card.
Click to expand...
Click to collapse
If you remove the SD card does the 1.0gb or 1.88gb partition disappear?
Some things don't look right in there, in your posted image.
You got Internal storage of 5.09GB (it is the first weird one), then you got Additional storage (/mnt/emmc) of 1.86GB (it is another weird one).
Normally, we have either
1. old scheme: 1GB /data, 5GB /media
2. new scheme: 5GB /data, 1GB /media
3. custom scheme: 1.96GB /data, 4+GB /media.
Yours doesn't look right.
votinh said:
Some things don't look right in there, in your posted image.
You got Internal storage of 5.09GB (it is the first weird one), then you got Additional storage (/mnt/emmc) of 1.86GB (it is another weird one).
Normally, we have either
1. old scheme: 1GB /data, 5GB /media
2. new scheme: 5GB /data, 1GB /media
3. custom scheme: 1.96GB /data, 4+GB /media.
Yours doesn't look right.
Click to expand...
Click to collapse
Well I just did the normal install of cm 7.10 stable and no partitioning. However my problem is the SD. I am not particularly worried about the internal flash partitioning.
Any ideas why I can't use more than 1gb of SD? I have a 32gb SD card arriving today. I really would like to get to the bottom of this.
There is no /media partition mounted on my nook color.
$ export PATH=/data/local/bin:$PATH
$ mount
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,relatime,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
/dev/block/mmcblk0p2 on /rom type vfat (rw,noatime,nodiratime,uid=1000,gid=1000,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/block/mmcblk0p5 on /system type ext4 (ro,relatime,barrier=1,data=ordered)
/dev/block/mmcblk0p6 on /data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
/dev/block/mmcblk0p7 on /cache type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,relatime)
/dev/block/vold/179:8 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:8 on /mnt/secure/asec type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /mnt/sdcard/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)
/dev/block/vold/179:17 on /mnt/emmc type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0602,dmask=0602,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/dm-0 on /mnt/asec/pl.idreams.jellydefense-1 type vfat (ro,dirsync,nosuid,nodev,relatime,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/dm-1 on /mnt/asec/com.devolver.sska-2 type vfat (ro,dirsync,nosuid,nodev,relatime,uid=1000,fmask=0222,dmask=0222,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
$ mount |grep media
$cd /media
cd: can't cd to /media
$
mr72 said:
Well I just did the normal install of cm 7.10 stable and no partitioning. However my problem is the SD. I am not particularly worried about the internal flash partitioning.
Any ideas why I can't use more than 1gb of SD? I have a 32gb SD card arriving today. I really would like to get to the bottom of this.
Click to expand...
Click to collapse
Just a stab in the dark but I have found most of my issues with uSD (and quality brands such as SanDisc) cards have gone back to how the card was formatted. I now never format in the device, nor do I use Windows to format. I've mentioned this before but it bears mentioning again, this free utility has never failed giving me a good intact format on cards of sizes 1G to 32G. Try it out here.
HTH
My NC is partitioned like this:
Code:
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
255 heads, 63 sectors/track, 965 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 9 72261 c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2 10 18 72292+ c Win95 FAT32 (LBA)
/dev/block/mmcblk0p3 19 56 305235 83 Linux
/dev/block/mmcblk0p4 57 965 7301542+ 5 Extended
/dev/block/mmcblk0p5 57 114 465853+ 83 Linux
/dev/block/mmcblk0p6 115 789 5421906 83 Linux
/dev/block/mmcblk0p7 790 834 361431 83 Linux
/dev/block/mmcblk0p8 835 965 1052226 c Win95 FAT32 (LBA)
I think this is default for the "new" partition style (which I will soon change).
However this is not affecting my SD card.
I should get my 32GB SD in the mail today or tomorrow. I suppose I will know soon enough whether I can use more than 1G on THAT card.
While trying to poke around on this NC and figure out exactly how the partitions are working, I discovered another thing which may be normal but sure seems odd to me.
The /emmc and /sdcard contents (directory names) are nearly identical.
Code:
ls /emmc
Android Music clockworkmod
B&N Downloads My Files com.maildroid
Books Nook data
DCIM OverDrive dropbox
Digital Editions ReceivedFiles eBooks
Download TempAudio fix_permissions.log
Evernote TunnyBrowser opera
GOLauncherEX Videos tmp
GoStore adobe
LOST.DIR backups
# ls /sdcard
ls /sdcard
Android My Files com.maildroid
B&N Downloads Nook data
Books OverDrive dropbox
DCIM ReceivedFiles eBooks
Digital Editions TempAudio fix_permissions.log
Download TunnyBrowser notes
GOLauncherEX Videos opera
GoStore adobe tmp
LOST.DIR backups
Music clockworkmod
#
Creating a file on one does not create it on the other. But some of the directories have identical files. For example the Titaniumbackup files in the /data dir on both /emmc and /sdcard are identical. I didn't check any others.
This seems quite odd. Comments?
OK, I think maybe I am getting to the bottom of this!
on my NC, when I take the SD card completely OUT, I can still view files mounted on /sdcard
So I am not convinced that my /sdcard mountpoint is actually reflecting the SD card directly.
When I unmount the SD card in the "Storage" settings, and I get the "Safe to remove..." notification, I presume the actual SD card is not mounted.
I removed the SD card from the NC and reformatted it using Panasonic SDFormatter. It's 1.86GB and has no files on it.
Without the SD card in my NC, it operates normally and still thinks it's writing to the /mnt/sdcard for things like downloading files.
My suspicion is that the partition normally mounted to /media is mounted to /mnt/sdcard
Code:
# df
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 245892 32 245860 0% /dev
tmpfs 245892 0 245892 0% /mnt/asec
tmpfs 245892 0 245892 0% /mnt/obb
/dev/block/mmcblk0p2 71164 108 71056 0% /rom
/dev/block/mmcblk0p5 458532 169376 289156 37% /system
/dev/block/mmcblk0p6 5336664 688980 4376592 14% /data
/dev/block/mmcblk0p7 350018 42216 289731 13% /cache
/dev/block/vold/179:8 1050156 1029924 20232 98% /mnt/sdcard
/dev/block/vold/179:8 1050156 1029924 20232 98% /mnt/secure/asec
THERE IS NO SD CARD IN THE NC.
Looks like the NC still THINKS the sd card is mounted.
Notice there also is no mount point for /media
The partition I'd expect to be mounted at /media (/dev/block/mmcblk0p8) is not mounted.
Please, someone explain this to me! Seriously, what's the Nook Color's partition scheme?
mr72 said:
OK, I think maybe I am getting to the bottom of this!
on my NC, when I take the SD card completely OUT, I can still view files mounted on /sdcard
So I am not convinced that my /sdcard mountpoint is actually reflecting the SD card directly.
When I unmount the SD card in the "Storage" settings, and I get the "Safe to remove..." notification, I presume the actual SD card is not mounted.
I removed the SD card from the NC and reformatted it using Panasonic SDFormatter. It's 1.86GB and has no files on it.
Without the SD card in my NC, it operates normally and still thinks it's writing to the /mnt/sdcard for things like downloading files.
My suspicion is that the partition normally mounted to /media is mounted to /mnt/sdcard
Code:
# df
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 245892 32 245860 0% /dev
tmpfs 245892 0 245892 0% /mnt/asec
tmpfs 245892 0 245892 0% /mnt/obb
/dev/block/mmcblk0p2 71164 108 71056 0% /rom
/dev/block/mmcblk0p5 458532 169376 289156 37% /system
/dev/block/mmcblk0p6 5336664 688980 4376592 14% /data
/dev/block/mmcblk0p7 350018 42216 289731 13% /cache
/dev/block/vold/179:8 1050156 1029924 20232 98% /mnt/sdcard
/dev/block/vold/179:8 1050156 1029924 20232 98% /mnt/secure/asec
THERE IS NO SD CARD IN THE NC.
Looks like the NC still THINKS the sd card is mounted.
Notice there also is no mount point for /media
The partition I'd expect to be mounted at /media (/dev/block/mmcblk0p8) is not mounted.
Please, someone explain this to me! Seriously, what's the Nook Color's partition scheme?
Click to expand...
Click to collapse
If there is no SD in... the vold.conf is setup to mount /dev/block/mmcblk0p8 as /sdcard...
Code:
## vold configuration file for zoom2
# modified for encore
volume_sdcard {
## This is the direct uevent device path to the SD slot on the device
media_path /devices/platform/mmci-omap-hs.1/mmc_host/mmc0
partition 8
media_type mmc
##mount_point /sdcard
mount_point /media
ums_path /devices/platform/usb_mass_storage/lun0
}
volume_sdcard2 {
## Currently points to internal eMMC, assumes eMMC is formatted as FAT32
media_path /devices/platform/mmci-omap-hs.0/mmc_host/mmc1
media_type mmc
partition 4
##mount_point /media
mount_point /sdcard
ums_path /devices/platform/usb_mass_storage/lun1
}
That doesn't seem to be the case, although it would make sense.
Looks like my sdcard is mounted at /mnt/emmc.
Rebooting into CWM after reformatting my SD card and putting it back in blank, putting a couple of files on it, it is found in CWM as /sdcard.
Once I boot, I find that content in /mnt/emmc.
Perhaps this explains it:
http://forum.cyanogenmod.com/topic/36236-help-sd-card-and-emmc-changed-places/
I've had the same issue as the OP since installing CM7 a few weeks ago. It really had me baffled, but I tried the fix linked above just now and it did the trick thank you mr72!
Sent from my NookColor using xda premium
CountKrzysztof said:
I've had the same issue as the OP since installing CM7 a few weeks ago. It really had me baffled, but I tried the fix linked above just now and it did the trick thank you mr72!
Sent from my NookColor using xda premium
Click to expand...
Click to collapse
OK, so to reiterate:
If you have CM7 installed, and in Settings -> Cyanogenmod Settings -> Application Settings, you check "Use internal storage", then CM7 will SWAP the SD card and the internal 1G (default) "Additional storage:/mnt/emmc" partition. The result is that your SD card will be mounted at /mnt/emmc and your internal memory 1G partition will be mounted at /mnt/sdcard.
Also, when you plug the NC into the computer if you have these swapped, then the 1G "internal memory" will be mounted on your computer, rather than the sdcard.
In actuality, this is a good thing, and there is a hack out there to swap these, therefore making use of the normally unused partition that by default in CM7 would be mounted at /mnt/emmc.
I'm lost following your posts but I know
/mnt/emmc is the additional internal storage and /mnt/sdard is the external uSD card.
That's the case when running CM7 off eMMC.
It's set by default, otherwise, maybe I have to set something to twist around.
Also, when having uSD plugged in, connecting to PC (Windows), both mounted as you would see the 1G internal AND the CM7SDCARD

[Q] What determines which partitions get mounted in windows?

I've been looking off and on and having little luck finding the answer. My ultimate goal is to not have the EMMC partitions mounted at all when booting from my CM7 SD card as I have a 32GB card and have plenty of space on it so do not need the 5GB or so that's mounted as /media. I know I can go into the fstab.vold file and change the mounts there that CM7 uses, but what controls which partitions are mounted when connecting it to windows? I either want to alter the EMMC /media partition that's mounted to something else on the SD card (boot maybe? dunno if this is a good idea or not) or remove it from the USB mounting altogether.
- Aerlock
You can remove emmc from vold.fstab and create your own startup script in /data/local/userinit.sh.
Something like: mount /dev/block/mmcblk... /mnt/emmc -t ... -o .........
Note: I am using CM7 and it executes /data/local/userinit.sh at boot. (Look at /etc/init.d/20userinit)
bigsheep123 said:
You can remove emmc from vold.fstab and create your own startup script in /data/local/userinit.sh.
Something like: mount /dev/block/mmcblk... /mnt/emmc -t ... -o .........
Note: I am using CM7 and it executes /data/local/userinit.sh at boot. (Look at /etc/init.d/20userinit)
Click to expand...
Click to collapse
Thanks, I already had that in mind for changing the actual partitions mounted in Android, but what I would like to figure out (and am having absolutely zero luck with) is how to change what shows in Windows/OSX/Linux when I plug it into a USB port. Currently when I connect my Nook I have the sdcard partition show up and the internal media partition show up in windows. I want to change those so that I can get a different partition to who instead of the emmc partition.
- Aerlock
Aerlock said:
Thanks, I already had that in mind for changing the actual partitions mounted in Android, but what I would like to figure out (and am having absolutely zero luck with) is how to change what shows in Windows/OSX/Linux when I plug it into a USB port. Currently when I connect my Nook I have the sdcard partition show up and the internal media partition show up in windows. I want to change those so that I can get a different partition to who instead of the emmc partition.
- Aerlock
Click to expand...
Click to collapse
You can use the samuelhalff Nook Color UMS app to select mapping of partitions to USB
http://forum.xda-developers.com/showthread.php?t=952456
Windows is normally only going to show results for partitions which are formatted as FAT(32) and won't show the ext3/4 partitions used for system and data.
bobtidey said:
You can use the samuelhalff Nook Color UMS app to select mapping of partitions to USB
http://forum.xda-developers.com/showthread.php?t=952456
Windows is normally only going to show results for partitions which are formatted as FAT(32) and won't show the ext3/4 partitions used for system and data.
Click to expand...
Click to collapse
Hrmmm...this works temporarily. I can use this app to change whats mounted but I need to re-run and remount at every disconnect and reconnect. What I really would like to find is the files/config that determines which partitions to mount at the time the Nook is connected to the computer. If I could find that info I'd be a happy Nooker.
- Aerlock
Anybody got an idea where I can look this info up? Or what files I should start poking around in to make these changes? I tried PMing samuelhalff last week and haven't gotten a reply yet.
- Aerlock
Aerlock said:
Anybody got an idea where I can look this info up? Or what files I should start poking around in to make these changes? I tried PMing samuelhalff last week and haven't gotten a reply yet.
- Aerlock
Click to expand...
Click to collapse
I can tell you what you need to change. The partition to mount is stored in /sys/devices/platform/usb_mass_storage/lun0/file. The 'file' is a text file with the partition number in it. For instance, if you wanted to mount the boot partition in emmc you would add "/dev/block/mmcblk0p1" (without the quotes) to the file. Then you could do the same with lun1 to mount something else. After you put the value in the file and save it, just plug in the cable. It will show up as a drive letter. (Do not select the 'turn on USB storage' button that pops up in android, that changes the files to point to /media (emmc) and /sdcard, and when you exit the mode, it clears them to null.)
I leave it to you to figure which partitions to mount and how to change the file when you need it. Remember, Windows can only read fat partitions, which on emmc is /rom (2?), /boot (1) and media (8). /system (5), /data (6), and /cache (7) are all ext and Windows cannot read ext without third party software help.
Not sure why you want to do this. If you are wanting to mount the SD boot partition on an SD installed system, it is ...mmcblk1p1.
leapinlar said:
I can tell you what you need to change. The partition to mount is stored in /sys/devices/platform/usb_mass_storage/lun0/file. The 'file' is a text file with the partition number in it. For instance, if you wanted to mount the boot partition in emmc you would add "/dev/block/mmcblk0p1" (without the quotes) to the file. Then you could do the same with lun1 to mount something else. After you put the value in the file and save it, just plug in the cable. It will show up as a drive letter. (Do not select the 'turn on USB storage' button that pops up in android, that changes the files to point to /media (emmc) and /sdcard, and when you exit the mode, it clears them to null.)
Click to expand...
Click to collapse
Thank you! Thank you! Thank you! I've been trying to find this info off and on for a few months now. I wasn't able to get it to go away with fiddling with the vold.fstab so I knew it was somewhere else but I didn't know where exactly.
So if I were to leave that file blank would it have nothing show up when I connect the NC to windows? Or do I need to do something else to disable the second lun?
leapinlar said:
I leave it to you to figure which partitions to mount and how to change the file when you need it. Remember, Windows can only read fat partitions, which on emmc is /rom (2?), /boot (1) and media (8). /system (5), /data (6), and /cache (7) are all ext and Windows cannot read ext without third party software help.
Click to expand...
Click to collapse
Thanks again, I'd found this out on my own while playing with mounting the various partitions in the vold.fstab but it's helpful to get someone else to confirm my findings.
leapinlar said:
Not sure why you want to do this. If you are wanting to mount the SD boot partition on an SD installed system, it is ...mmcblk1p1.
Click to expand...
Click to collapse
My ultimate goal is to disable the second partition mount in Windows. I only want to have the SD card data partition show up, I want to completely separate the emmc boot from the SD boot. I may also want to add the boot partition from the SD card at a later time so I can do upgrades when I have a computer but no SD card adapter/reader.
Also (just theoretically, for my understanding) would it be possible to add more luns by creating the dirs and files in the /sys/devices/platform/usb_mass_storage/ directory?
- Aerlock
Aerlock said:
So if I were to leave that file blank would it have nothing show up when I connect the NC to windows? Or do I need to do something else to disable the second lun?
Also (just theoretically, for my understanding) would it be possible to add more luns by creating the dirs and files in the /sys/devices/platform/usb_mass_storage/ directory?
Click to expand...
Click to collapse
There are always going to be two drives show up when you plug it in (lun0 and lun1). They are non functional until you press the button to turn on (because the two files are empty). When you press the button the software populates the files with the emmc and sdcard partition locations and the drives become functional.
I'm not sure how to prevent emmc from showing if you want just sdcard. Maybe you can set permissions on one to be all boxes unchecked. But two drives will always show, just one may be non functional. Another option would be to set the two luns to be what you want and set permissions to be read only. Then maybe pushing the button will have no effect.
But two drive letters will always show.
No, there can only be two lun files. It is built into the operating system.
Edit: I am going to experiment and get back to you.
Edit 2: I've got it all fixed for you. I attached a rar file to the board. Just unrar and you will find two files
The first, 55mountsingleSD, will cause just the SD card to mount. The second drive letter should disappear.
The second, 56mount2customdrives, will mount the boot partition of emmc and the SD card. You can edit the file to change which two partitions you want Windows to see.
Place one (only one) of these files in the /system/etc/init.d folder and change its permissions to match the other files in that folder.
When you reboot with one of these files in that folder, the drive(s) are ready for mounting in Windows. All you have to do is plug in your USB cable. The drive(s) should show in Windows automatically. Do NOT select the "Turn on USB storage" button (just hit the back button). If you do, it will unmount emmc and the SD card in CM7 and you will have to go to settings to re-mount them. Also, be sure to "eject" the drives in Windows before disconnecting the cable.
NookColorUMS will not work anymore because I accomplished this by locking the lun files. If you want to use it, just remove the file from init.d or rename it with .bak and reboot and everything will return to normal.
Enjoy
Have you tried this? I'm looking for feedback. BTW, for others interested, this will not work on CM9 since it does not currently support UMS mounting.
leapinlar said:
Have you tried this? I'm looking for feedback. BTW, for others interested, this will not work on CM9 since it does not currently support UMS mounting.
Click to expand...
Click to collapse
Sadly I haven't had a chance to try it. I've got a 2 year old and a sick wife at home so my time has been limited. Good news is the wife is almost back to normal now and I should be able to play with these tomorrow or this weekend.
- Aerlock
P.S. Thanks for the scripts. They'll save me lots of trial and error making my own.
leapinlar said:
Have you tried this? I'm looking for feedback. BTW, for others interested, this will not work on CM9 since it does not currently support UMS mounting.
Click to expand...
Click to collapse
Finally got a chance to try these out between projects at work today.
Here's what I get when I run the 55mountsingleSD script in gscript:
Code:
stderr:
stderr:
stderr:
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun0/file: permission denied
stderr:
stderr:
stderr:
stderr:
stderr:
stderr:
The first time I ran it I got all 'stderr:' lines. I do have a Boot partition mounted in windows after running this script. I haven't checked to determine if its the SD card or the emmc but it appears to be the SD card at first glance.
Here's what I get when I run the 56mount2customdrives script in gscript:
Code:
stderr:
stderr:
stderr:
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun0/file: permission denied
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun1/file: permission denied
stderr:
stderr:
stderr:
stderr:
stderr:
stderr:
Again the first time I ran it I got all 'stderr:' lines. This time I have 2 boot partitions mounted in windows, 1 appears to be the emmc and the other the SDcard.
I also took a look at the /sys/devices/platform/usb_mass_storage/lun(x)/file files and heres what I found in them when I had the USB storage turned on:
Code:
lun0 - /dev/block/vold/179:20
lun1 - /dev/block/vold/179:8
Since you've been so helpful with these scripts I've got some more questions for you.
Where are the settings for the USB storage stored? For example what do I change if I want the 'Turn on USB storage' button to mount the sdcard and boot partitions of my SD card instead of the sdcard and emmc media partitions?
Or how do I disable the USB storage screen from popping up when I connect the USB cable so I can just use the script.
Also how do I unmount the partitions when I'm done in windows? Just delete the contents of those two files?
- Aerlock
Aerlock said:
Finally got a chance to try these out between projects at work today.
Here's what I get when I run the 55mountsingleSD script in gscript:
Code:
stderr:
stderr:
stderr:
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun0/file: permission denied
stderr:
stderr:
stderr:
stderr:
stderr:
stderr:
The first time I ran it I got all 'stderr:' lines. I do have a Boot partition mounted in windows after running this script. I haven't checked to determine if its the SD card or the emmc but it appears to be the SD card at first glance.
Here's what I get when I run the 56mount2customdrives script in gscript:
Code:
stderr:
stderr:
stderr:
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun0/file: permission denied
stderr:
stderr: cannot create /sys/devices/platform/usb_mass_storage/lun1/file: permission denied
stderr:
stderr:
stderr:
stderr:
stderr:
stderr:
Again the first time I ran it I got all 'stderr:' lines. This time I have 2 boot partitions mounted in windows, 1 appears to be the emmc and the other the SDcard.
I also took a look at the /sys/devices/platform/usb_mass_storage/lun(x)/file files and heres what I found in them when I had the USB storage turned on:
Code:
lun0 - /dev/block/vold/179:20
lun1 - /dev/block/vold/179:8
Since you've been so helpful with these scripts I've got some more questions for you.
Where are the settings for the USB storage stored? For example what do I change if I want the 'Turn on USB storage' button to mount the sdcard and boot partitions of my SD card instead of the sdcard and emmc media partitions?
Or how do I disable the USB storage screen from popping up when I connect the USB cable so I can just use the script.
Also how do I unmount the partitions when I'm done in windows? Just delete the contents of those two files?
- Aerlock
Click to expand...
Click to collapse
Did you read my post? Those scripts were not meant to run in gscript. Thats why you are getting those error messages. They were meant to put in /etc/init.d. They have to be run at boot time to have the right permissions to do things.
The settings for 'turn on' are stored in the operating system program code. You will not be able to change that.
Again, the scripts are not to be run after booting. They run at boot time and are there waiting for you to plug in the cable. When the cable is plugged in, they automatically show up in windows (depending on which script you put in init.d). Just hit the back button when the pop-up comes up to get rid of it. To disconnect the drives in Windows, use the eject command by right clicking on the drive in Windows Explorer. Then unplug the cable and it is ready for next time you plug in. Don't do anything with the files. Just never press the 'Turn on' button, ever. Just hit back to get rid of it.
If you want different partitions to show, edit the script file before you re-boot.
leapinlar said:
Did you read my post? Those scripts were not meant to run in gscript. Thats why you are getting those error messages. They were meant to put in /etc/init.d. They have to be run at boot time to have the right permissions to do things.
The settings for 'turn on' are stored in the operating system program code. You will not be able to change that.
Again, the scripts are not to be run after booting. They run at boot time and are there waiting for you to plug in the cable. When the cable is plugged in, they automatically show up in windows (depending on which script you put in init.d). Just hit the back button when the pop-up comes up to get rid of it. To disconnect the drives in Windows, use the eject command by right clicking on the drive in Windows Explorer. Then unplug the cable and it is ready for next time you plug in. Don't do anything with the files. Just never press the 'Turn on' button, ever. Just hit back to get rid of it.
If you want different partitions to show, edit the script file before you re-boot.
Click to expand...
Click to collapse
I feel stupid now. I did read that the first time. When I went back and got the files to test I just skimmed your post and thought I knew what I was doing. Let me try these again and I'll post the results.
- Aerlock
where are these files in cm 10.1
Hi there,
I'm running CM 10.1 aka 4.2 on a Samsung I9000..I'm wondering if you can point me in the wright direction where these files are stored....
And what to change...
As said in the private message i would like to make my second SDCARD or a folder from it visible on the first sdcard even when I connect to Windows.
Vold.fstap doesn't help me in this case..
Already a big thank you for pointing in the right direction
Is there a posibility to repost the scripts I understand they'll have to be in init.d...
Kind Regards
Guy Forssman
How on Samsung I9000 CM 10.1
With putty as the tool and SSHDroid running as app
I do a "ls /dev/block/vold"
results in 179.0 179.1 179.2 179.8 179.9
"ls /dev/block/platform" results in s3c-sdchi.0 s3c-sdchi.2 s5pc110-onenand
"mount" learns me
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,relatime)
none on /acct type cgroup (rw,relatime,cpuacct)
tmpfs on /mnt/secure type tmpfs (rw,relatime,mode=700)
tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,relatime,mode=755,gid=1000)
/dev/block/mtdblock3 on /cache type yaffs2 (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /radio type yaffs2 (rw,relatime)
/dev/block/mtdblock2 on /datadata type yaffs2 (rw,relatime)
/dev/lvpool/system on /system type ext4 (ro,relatime,barrier=1,data=ordered)
/dev/lvpool/userdata on /data type ext4 (rw,nosuid,nodev,noatime,errors=panic,barrier=1,nomblk_io_submit,data=ordered)
/dev/block/mtdblock4 on /efs type yaffs2 (rw,relatime)
]/dev/block/vold/179:9 on /storage/sdcard1 type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /storage/sdcard0 type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /storage/sdcard0/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)
/dev/block/dm-2 on /mnt/asec/me.shkschneider.dropbearserver-1 type ext4 (ro,dirsync,nosuid,nodev,noatime,barrier=1)
and indeed windows 7 shows me a walkman icon with 2 entrys
SD card
USB storage
The content of the external micro sd card is on the SD card which Windows8 shows
The content of the internal memory is shown on windows8 in the USB storage
The phone itself doesn't shown the usb mount icon
It seems that even after a reboot the settings stay
I did a "setprop persist.sys.usb.config mtp,adb"
"echo /dev/block/vold/179:1 > /sys/devices/platform/s3c-usbgadget/gadget/lun0/file"
"echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file"
Forssound said:
With putty as the tool and SSHDroid running as app
I do a "ls /dev/block/vold"
results in 179.0 179.1 179.2 179.8 179.9
"ls /dev/block/platform" results in s3c-sdchi.0 s3c-sdchi.2 s5pc110-onenand
"mount" learns me
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,relatime)
none on /acct type cgroup (rw,relatime,cpuacct)
tmpfs on /mnt/secure type tmpfs (rw,relatime,mode=700)
tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,relatime,mode=755,gid=1000)
/dev/block/mtdblock3 on /cache type yaffs2 (rw,nosuid,nodev,relatime)
/dev/block/mtdblock5 on /radio type yaffs2 (rw,relatime)
/dev/block/mtdblock2 on /datadata type yaffs2 (rw,relatime)
/dev/lvpool/system on /system type ext4 (ro,relatime,barrier=1,data=ordered)
/dev/lvpool/userdata on /data type ext4 (rw,nosuid,nodev,noatime,errors=panic,barrier=1,nomblk_io_submit,data=ordered)
/dev/block/mtdblock4 on /efs type yaffs2 (rw,relatime)
]/dev/block/vold/179:9 on /storage/sdcard1 type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/block/vold/179:1 on /storage/sdcard0 type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /storage/sdcard0/.android_secure type tmpfs (ro,relatime,size=0k,mode=000)
/dev/block/dm-2 on /mnt/asec/me.shkschneider.dropbearserver-1 type ext4 (ro,dirsync,nosuid,nodev,noatime,barrier=1)
and indeed windows 7 shows me a walkman icon with 2 entrys
SD card
USB storage
The content of the external micro sd card is on the SD card which Windows8 shows
The content of the internal memory is shown on windows8 in the USB storage
The phone itself doesn't shown the usb mount icon
It seems that even after a reboot the settings stay
I did a "setprop persist.sys.usb.config mtp,adb"
"echo /dev/block/vold/179:1 > /sys/devices/platform/s3c-usbgadget/gadget/lun0/file"
"echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file"
Click to expand...
Click to collapse
If you want those luns to be different, you echo a different /dev/block... to the file instead of the vold locations. Looks like it uses /dev/block/mtdblock with a partition number after it for the interior partitions. Look in /dev/block/platform and those sc3-h... folders and see if it lists partition numbers either for interior or sdcards.
Sent from my HD+ running CM10 on SD with XDA Premium
rest the question
how do i make these commands flash proof?
Already the commands I did made the car find my phone and played the music..
It also played system sounds, my movies etc etc
I just did a
/dev/block/platform # ls
s3c-sdhci.0 s3c-sdhci.2 s5pc110-onenand
/dev/block/platform # cd s5pc110-onenand
/dev/block/platform/s5pc110-onenand # ls
mtdblock0 mtdblock1 mtdblock2 mtdblock3 mtdblock4 mtdblock5 mtdblock6
"cd /dev/block/platform/s3c-sdhc1.0"
"ls"
result by-num mmcblk0 mmcblk0p1 mmcblk0p2
cd /dev/block/platform/s3c-sdhci.2
/dev/block/platform/s3c-sdhci.2 # ls
by-num mmcblk1 mmcblk1p1
So if I only would mount the music folder from my external folder onto a folder on the internal folder?
Or is it easyer to just mount the whole extenal sd card ?
Forssound said:
how do i make these commands flash proof?
Click to expand...
Click to collapse
I'm not sure what you mean flash proof. Do you mean so they stick after flashing a new rom? To do that you need to put the commands in /data. And for that to work, your rom has to support userinit.d or bootcompletehook.sh in /data. Each device is different. Look in your init.d folder and see if it has a script that calls userinit.d. You said you had CM10.1 and usually CM supports userinit.d. Create a folder in /data/local named userinit.d and put your scripts there. They get run right after init.d scripts are run. Be sure to set the script file permissions to execute.
Sent from my HD+ running CM10 on SD with XDA Premium
leapinlar said:
I'm not sure what you mean flash proof. Do you mean so they stick after flashing a new rom? To do that you need to put the commands in /data. And for that to work, your rom has to support userinit.d or bootcompletehook.sh in /data. Each device is different. Look in your init.d folder and see if it has a script that calls userinit.d. You said you had CM10.1 and usually CM supports userinit.d. Create a folder in /data/local named userinit.d and put your scripts there. They get run right after init.d scripts are run. Be sure to set the script file permissions to execute.
Sent from my HD+ running CM10 on SD with XDA Premium
Click to expand...
Click to collapse
I found a init.rc on /data/local/tmp
it's huge
in /system/etc/init.d I found 2 files 00banner and 90userinit
vi 90userinit is this
#!/system/bin/sh
# call userinit.sh and/or userinit.d/* scripts if present in /data/local
if [ -e /data/local/userinit.sh ];
then
log -p i -t userinit "Executing /data/local/userinit.sh";
logwrapper /system/bin/sh /data/local/userinit.sh;
setprop cm.userinit.active 1;
fi;
if [ -d /data/local/userinit.d ];
then
logwrapper busybox run-parts /data/local/userinit.d;
setprop cm.userinit.active 1;
fi;
so it seems that I can make a
/data/local/userinit.d
this file should be executable and what do you advise I put in it?
---------- Post added at 11:01 PM ---------- Previous post was at 10:51 PM ----------
Is it better to use
setprop persist.sys.usb.config mass_storage,adb
or
setprop persist.sys.usb.config mtp,adb
further you talk about the /dev/block/platform and those sc3-h... folders
I found the following
echo /dev/block/vold/179:9 > /sys/devices/platform/s3c-usbgadget/gadget/lun1/file"
Is there a reason to choose to use one above the other?

Changing sdcard to external_sd

Hi, I would like to change sdcard to external_sd with your help by modifing vold.fstab
Have some idea how to change it ?
Code:
#LGE_CHANGE_S [[email protected]] 20120928:Adding mount for SDcard
#LGE_CHANGE_S [[email protected]] 20121031:change external_SD path
dev_mount sdcard /storage/external_SD auto /devices/platform/msm_sdcc.1/mmc_host/mmc1

i9100 emulated sdcard, partition resizing and full disk encryption

I recently upgraded a Galaxy S2 to Cyanogenmod 12.1 / android 5.1. I also wanted to use full disk encryption with the device and being able to access the internal memory via MTP instead of having a mass storage device. The removable sd card may be accessed via MTP, too, but will not be encrypted. Updating the recovery images to reflect the changes in the storage configuration (in case this is necessary) is not in scope, either.
Cyanogenmod by default only encrypts the /data partition. Newer models emulate the sdcard storage and save the data to /data/media, so everything gets encrypted. However, being an older phone there is still a separate sdcard-partition on the phone which is physically and directly mounted and which will not be touched by encryption.
In order to achieve the goal of full disk encryption two steps are necessary:
1. Change storage configuration to emulated media
2. Shrink old /sdcard partition and grow /data partition
= Change storage configuration to emulated media =
Emulating the sdcard in /data/media instead of physically mounting it directly requires changes to fstab.hardware (fstab.smdk4210), storage_list.xml and init.hardware.rc (init.smdk4210.rc). These files have to be changed in the Cyanogenmod source code and compiled to a new image. The configuration is based on the "Emulated primary, physical secondary" example given in h t t p s : / / source . android . com / devices / storage / config-example.html (cannot properly post URL due to new user restriction).
Here are the relevant changes in init.hardware.rc (init.smdk4210.rc):
Code:
--- init.smdk4210.rc.bak 2015-11-22 23:01:49.259579157 +0000
+++ init.smdk4210.rc.final 2015-11-30 20:21:37.977943177 +0000
@@ -2,35 +2,47 @@
import init.gps.rc
on init
- export EXTERNAL_STORAGE /storage/sdcard0
+ export EXTERNAL_STORAGE /storage/emulated/legacy
+ export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
+ export EMULATED_STORAGE_TARGET /storage/emulated
export SECONDARY_STORAGE /storage/sdcard1
- mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
- mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
mkdir /mnt/media_rw/usbdisk0 0700 media_rw media_rw
- mkdir /storage/sdcard0 0770 root root
- mkdir /storage/sdcard1 0770 root root
+ mkdir /mnt/shell/emulated 0700 shell shell
+ mkdir /storage/emulated 0555 root root
+ mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
+ mkdir /storage/sdcard1 0700 root root
+
mkdir /storage/usbdisk0 0770 root root
+ mkdir /storage/sdcard1 0775 system system
+
mkdir /efs 0771 radio system
mkdir /preload 0771 system system
mkdir /mnt 0775 root system
mkdir /mnt/.lfs 0755 root root
# for backwards compatibility
- symlink /storage/sdcard0 /sdcard
- symlink /storage/sdcard0 /mnt/sdcard
- symlink /storage/sdcard1 /extSdCard
- symlink /storage/sdcard1 /mnt/extSdCard
symlink /storage/usbdisk0 /usbdisk0
symlink /storage/usbdisk0 /mnt/usbdisk0
+ symlink /storage/emulated/legacy /sdcard
+ symlink /storage/emulated/legacy /mnt/sdcard
+ symlink /storage/emulated/legacy /storage/sdcard0
+ symlink /mnt/shell/emulated/0 /storage/emulated/legacy
+ symlink /storage/sdcard1 /ext_card
+ symlink /storage/sdcard1 /mnt/ext_card
+
+
+
# Disable CFQ slice idle delay
write /sys/block/mmcblk0/queue/iosched/slice_idle 0
on fs
mount_all /fstab.smdk4210
+ setprop ro.crypto.fuse_sdcard true
+
swapon_all /fstab.smdk4210
mkdir /efs/bluetooth
@@ -428,11 +440,10 @@
oneshot
keycodes 114 115 116
-service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
+service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
class late_start
- disabled
-service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
+service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
class late_start
disabled
Here are the relevant changes in fstab.hardware (fstab.smdk4210):
Code:
--- fstab.smdk4210.bak 2015-11-29 23:52:30.652913883 +0000
+++ fstab.smdk4210.final 2015-11-30 20:20:23.513945994 +0000
@@ -11,8 +11,8 @@
/dev/block/mmcblk0p12 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait
# vold-managed volumes ("block device" is actually a sysfs devpath)
-/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable,noemulatedsd
-/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto,noemulatedsd
+/devices/platform/dw_mmc/mmc_host/mmc0/mmc0* auto auto defaults wait,voldmanaged=sdcard0:11,nonremovable
+/devices/platform/s3c-sdhci.2/mmc_host/mmc1* auto auto defaults wait,voldmanaged=sdcard1:auto
/devices/platform/s3c_otghcd/usb* auto auto defaults voldmanaged=usbdisk0:auto
# recovery
Here are the relevant changes in storage_list.xml:
Code:
--- storage_list.xml.bak2 2015-11-30 21:38:14.565769302 +0000
+++ storage_list.xml.final 2015-11-30 21:43:21.697757684 +0000
@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<StorageList xmlns:android="h t t p : / / schemas . android . com / apk / res / android "(cannot properly post URL due to new user restriction)>
- <storage android:mountPoint="/storage/sdcard0"
- android:storageDescription="@string/storage_internal"
- android:primary="true"
- android:removable="false"
- android:allowMassStorage="true" />
+ <storage android:storageDescription="@string/storage_internal"
+ android:emulated="true"
+ android:mtpReserve="100" />
<storage android:mountPoint="/storage/sdcard1"
android:storageDescription="@string/storage_sd_card"
- android:primary="false"
android:removable="true"
- android:allowMassStorage="true" />
+ android:maxFileSize="4096" />
<storage android:mountPoint="/storage/usbdisk0"
android:storageDescription="@string/storage_usb"
@@ -18,3 +15,4 @@
android:removable="true" />
</StorageList>
Compile Cyanogenmod and flash your phone. It should boot, but the amount of available storage should be significantly lower as the sdcard is emulated on the /data partition which has not been grown, yet.
= Shrink old /sdcard partition and grow /data partition =
Use PIT Magic to resize the partitions to an appropriate size. For a stock i9100 having 16GB of internal memory my configuration was as follows (according to the backup .pit-file downloaded via heimdall):
Code:
DATAFS:
start: 1,392,640
block count: 4,194,304
end: 5,586,943
UMS:
start: 5,586,944
block count: 24,133,632
end: 29,720,575
Hidden:
start: 29,720,576
block count: 1,048,576
end: 30,769,151
I changed the partition layout to the following sizes:
Code:
DATAFS:
start: 1,392,640
block count: 28,295,167
end: 29,687,807
UMS:
start: 29,687,808
block count: 32,768
end: 29,720,575
Hidden:
start: 29,720,576
block count: 1,048,576
end: 30,769,151
Deleting the UMS or hidden partitions or shrinking the hidden led to Cyanogenmod not booting. Upload the new .pit-file using heimdall and boot the modified Cyanogenmod. Reboot to Cyanogenmod recovery and wipe data. Formatting again using the Cyanogenmod recovery was required as apparently only this recovery honours the "encryptable=footer,length=-16384" option for the /data partition in fstab.hardware which directs the formatting tools to leave 16 kiB of space at the end of the partition for in-place encryption.
Is there a way to achieve emulated SD, without changing source code and recompiling?
Like editing fstab and other config files?
I run CM13 at the moment and would like to achieve full encryption through emulated SD.
I was playing around with the idea that i would resize the sdcard partition to 8mb and resize the /data partition (~14gb), so that applications have a hefty space and i would use the external sdcard (sdcard1) for storing data and media files. Would that be possible to with an emulated sdcard ? I was hoping that with the introduction of Android 6.0 it would allow me to merge (LVM?) the /sdcard0 and /sdcard1 but instead it merges /data and /sdcard1.
fireburner-de said:
Is there a way to achieve emulated SD, without changing source code and recompiling?
Like editing fstab and other config files?
Click to expand...
Click to collapse
I cannot prove that there is no way without having to recompile. However, I couldn't find storage_list.xml in the filesystem on my phone, so I assume that this file is only used during image compilation and therefore it's probably hard/impossible to achieve emulated SD without recompiling.
Maybe this configuration is easier to achieve using Cyanogenmod 13 / Android 6 as the storage_list.xml resource overlay has been removed.
PelzigesOhr, thank you sharing and documenting your experience so well, it has inspired me to try the same on Replicant 4.2 (distro based on CyanogenMod 10).
https:// github . com / GrimKriegor / replicant42-device_samsung_galaxys2-common / commit / 84c5a91a45b059a147921d0ea32367534904b314
However it seems the best way to create a partition table is using PitMagic, which seems to be proprietary software. Would you consider sharing your PIT file please?
Thank you for your time, all of this is greatly appreciated!
EDIT:
If you still have memory of the heimdall parameters used to flash this partition table, please do share as well.
EDIT2:
Managed to create a PIT file similar to yours, thanks for documenting it.
The following thread also includes a patch compatible with Replicant/Android 4.2.
Best of luck!
redmine . replicant . us / boards / 39 / topics / 13707
GrimKriegor said:
Would you consider sharing your PIT file please?
Thank you for your time, all of this is greatly appreciated!
EDIT:
If you still have memory of the heimdall parameters used to flash this partition table, please do share as well.
EDIT2:
Managed to create a PIT file similar to yours, thanks for documenting it.
The following thread also includes a patch compatible with Replicant/Android 4.2.
Click to expand...
Click to collapse
Thanks for the praise, I'm happy that the instructions are of use to someone else. Good to know that you managed everything yourself, I'll answer anyway: This forum doesn't seem to support attachments, so I haven't attached the .pit-file. Feeding the parameters I provided to PIT Magic should yield a good result, though. PIT Magic is indeed a proprietary Windows binary, but it runs fine using wine (at least that's the way I use it).
All the flashing has been done by loading clockworkmodrecovery (
Code:
heimdall flash --KERNEL clockworkmodrecovery.6050.i9100.touch.img
) and afterwards sideloading the compiled ROM.
PelzigesOhr said:
Thanks for the praise, I'm happy that the instructions are of use to someone else. Good to know that you managed everything yourself, I'll answer anyway: This forum doesn't seem to support attachments, so I haven't attached the .pit-file. Feeding the parameters I provided to PIT Magic should yield a good result, though. PIT Magic is indeed a proprietary Windows binary, but it runs fine using wine (at least that's the way I use it).
All the flashing has been done by loading clockworkmodrecovery (
Code:
heimdall flash --KERNEL clockworkmodrecovery.6050.i9100.touch.img
) and afterwards sideloading the compiled ROM.
Click to expand...
Click to collapse
Thanks for the reply sir.
Which partitions did you upload via Heimdall when you flashed the PIT file? I believe repartitioning could delete the contents of important partitions such as BOOT and MODEM, but I am unsure. Do you think maintaining their block boundaries would preserve the data in the respective partitions?
guy i can't mount /storage/sdcard0
i use Cyanogenmod 12.1 android 5.1.1
i need help guy
GrimKriegor said:
Which partitions did you upload via Heimdall when you flashed the PIT file? I believe repartitioning could delete the contents of important partitions such as BOOT and MODEM, but I am unsure. Do you think maintaining their block boundaries would preserve the data in the respective partitions?
Click to expand...
Click to collapse
The exact command I used for repartitioning with Heimdall-1.3.1 was as follows:
Code:
heimdall flash --repartition --pit <filename>
Data should be preserved and if you don't mess with the boundaries of partitions other than DATAFS, UMS and HIDDEN you should be fine. Before repartitioning I backed up all partitions as a precautionary measure, but I didn't have to restore any of them. See also http://forum.xda-developers.com/galaxy-s2/orig-development/guide-enlarge-datafs-partition-rid-t2353551
PelzigesOhr said:
The exact command I used for repartitioning with Heimdall-1.3.1 was as follows:
Code:
heimdall flash --repartition --pit <filename>
Data should be preserved and if you don't mess with the boundaries of partitions other than DATAFS, UMS and HIDDEN you should be fine. Before repartitioning I backed up all partitions as a precautionary measure, but I didn't have to restore any of them. See also http://forum.xda-developers.com/galaxy-s2/orig-development/guide-enlarge-datafs-partition-rid-t2353551
Click to expand...
Click to collapse
Ah! This is excellent, thanks for clarifying this! Just one last question if I may, how did you backup the partitions? Did you use Heimdall to download their contents as image files, did you use DD or maybe even ADB?
Thank you for your time!
GrimKriegor said:
Just one last question if I may, how did you backup the partitions? Did you use Heimdall to download their contents as image files, did you use DD or maybe even ADB?
Click to expand...
Click to collapse
Good guess, I used dd and adb. Get a shell on the phone with adb and dump the partitions to files using dd:
Code:
dd if=/dev/block/mmcblk0pX of=/sdcard/mmcblk0pX.bin bs=512
And then copy the files to your computer using adb pull. You may want to get the mountpoints of the partitions (e.g. using mount) so that you can associate them easily.
Read here for an easy way to switch to emulated storage. Thanks to @Lanchon
https://forum.xda-developers.com/galaxy-s2/orig-development/mod-switch-emulated-to-emulated-t3539651

Categories

Resources