Solved Missing Internal Memory

Andrew Phillips

New Member
Joined
Feb 23, 2016
Messages
4
Reaction score
0
Location
Sydney
Website
www.hexedit.com
Current Phone Model
Samsung Galaxy Note GT-N7000
I have a Galaxy Note Tab (GT-N7000). I recently upgraded to Lollipop (Nightowl-cm12-beta1-n7000.zip). All works fine except that I can't install more than about 2GB of apps, which is really limiting - I should have about 13 GB for apps including "internal" SD card.

After I got Lollipop all working I installed a few things then started getting the dreaded "Insufficient storage" message. I actually had similar problems with Jelly Bean - I got "Insufficient storage" even though there was plenty of storage available but I got around it by moving apps to the SD card. However, now when I try to move apps I get the error: "Couldn't move app. Not enough space."

There's obviously something wrong as I can see free 2.9GB in File Manager (and when mapping the drive to Windows PC) including 300MB in /data partition.

I thought maybe using an external SD card might avoid the problem even if I sacrifice some internal memory. So I installed a 64GB micro-SD card. But this made no difference. The "move to SD card" option obviously does not work for an "external" SD card.

To get more info I installed BusyBox and when I run the UNIX (Linux) df command I get these mounted filesystems (partitions):

Filesystem Size Used Free Blksize
/dev 389.8M 40.0K 389.8M 4096
/sys/fs/cgroup 389.8M 12.0K 389.8M 4096
/mnt/asec 389.8M 0.0K 389.8M 4096
/mnt/obb 389.8M 0.0K 389.8M 4096
/system 838.6M 779.0M 59.6M 4096
/cache 196.8M 5.0M 191.8M 4096
/efs 19.7M 8.2M 11.4M 4096
/data 2.0G 1.7G 239.6M 4096
/misc 503.9M 8.4M 495.6M 4096
/storage/oldsdcard0 11.1G 8.5G 2.6G 16384
/mnt/shell/emulated 11.1G 8.5G 2.6G 16384

Here are some relevant directory entries that I extracted using ls -lsa:

lrwxrwxrwx root root 2016-02-24 00:55 /extSdCard -> /storage/sdcard1
lrwxrwxrwx root root 2016-02-24 00:55 /sdcard -> /storage/emulated/legacy
dr-xr-xr-x root root 2016-02-24 00:55 /storage/emulated
drwxrwxrwx root root 1970-01-01 11:00 /storage/oldsdcard0
lrwxrwxrwx root root 2016-02-24 00:55 /storage/sdcard0 -> /storage/emulated/legacy
drwxrwx--- root root 2016-02-24 00:55 /storage/sdcard1
drwxrwx--- root root 2016-02-24 00:55 /storage/usbdisk0
lrwxrwxrwx root root 2016-02-24 00:55 /storage/emulated/legacy -> /storage/oldsdcard0/0

There is currently about 250MB of files in /storage/oldsdcard0/0 (which is on the /storage/oldsdcard0 partition).

In Android: Settings/Storage/Internal Storage shows Total Space=1.97GB, Available=211MB.

When I tried moving files (4GB of photos) from /storage/oldsdcard0 into /storage/oldsdcard0/0 Internal Storage still shows Total Space=1.97GB, but Available=0, Pictures=4GB and the graph is full (no grey area at the right end).

I am not really sure what Android is up to but it seems that when looking to store apps it is looking at the size of the /data partition (2GB) and subtracting the size of files in /data (1.7GB) + in /storage/oldsdcard0/0 directory (0.25GB). This gives a value of less than 50MB which is too small for what I am trying to install. It must be doing the same incorrect calcs when looking to move apps from /data to the SD card.

Here are some possible solutions I can think of:

1. Delete (or rename) /data partition and rename /storage/oldsdcard0 to /data, and possibly hard-link /sdcard to external SD card (/storage/sdcard1)
- this should give me 11GB for /data but I am not sure that Android will see that size or still think "internal storage" is 2GB
- what Android thinks is "internal SD card" (/sdcard) would now map to external SD card (/storage/sdcard1) which may cause problems if it is removed

2. Delete /data and /storage/oldsdcard0 and create one or two new partitions
- I'm still not sure that this would assist Android to get its sizes right, or perhaps this would confuse it even more

Does anyone think they would work or have another suggestion? Does anyone know the filesystem layout and usage for Android 5.0.1 (Kernel 3.0.64-CM-gc74695a). I used to do systems development for UNIX/Linux and also sys-admin work so I am happy to delete/create/format/mount partitions etc.
 
UPDATE. After using DiskUsage (suggested in another post here) I noticed my Dalvik cache was taking up over 1GB so I cleared it but when rebuilt it was still the same. I also cleared normal cache and it made no difference. However, I found that /data/lost+found was 200MB so I deleted that and got a bit of space to install some more apps but quickly ran out of space again.
 
Is the build of CM you flashed official? How did you install it? Did you do a full system wipe prior?

I don't think it is official, but this beta has been around a couple of years and no major problems reported AFAIK.

I found it and instructions to install it somewhere on the Internet but can't seem to find them again. From memory the instructions said to do a factory reset (wipe /data), and wipe cache and wipe dalvik-cache. before installing the .zip (all in CWM recovery 6.0.5.0).
 
Just a followup to say that I worked out how to do this. Once I understood what was going on, it was easy. You just need to install CWM recovery and backup all your partitions, run Odin to install new partitions (and stock ROM), install CWM again so you can then restore all your data to the new partition layout. The new partition layout had a /data partition that was 6GB larger (and an /sdcard partition that was correspondingly smaller).

To create the new partition layout I just extracted the current layout into a .PIT file, edited it using HexEdit (Windows Hex Editor for Programmers, Power Users) and used it with Odin as mentioned below. To make it easier/safer to edit the .PIT file I created a template in HexEdit (attached below). However, I have since found pre-made .PIT files for the GT-N7000 at [MOD][GUIDE]Partition your internal SD for better App management 16GB & 32GB Models! .

The only thing I was careful about was to free up space on my /sdcard partition before backing up. To do this I just deleted a whole bunch of photos and music (after copying to my PC first). I wasn't sure what would happen when I restored a NAndroid backup to a partition which was not big enough to hold all the files.

Requires: CWM recovery image, Odin software, Stock ROM for the phone, PIT file with adjusted partition sizes, external SD card with space for full system backup (prob. about 8GB).

1. Reboot the phone into download mode (VolDown+Home+Power).
2. Run Odin (eg: 3.07) on your PC and connect the phone via USB.
3. Select the CWM recovery image to install using the PDA button.
4. Select Start button to install the CWM recovery partition.
5. Reboot into CWM recovery mode (VolUp+Home+Power).
6. Backup everything to ext SD card (sdcard1).
7. Reboot into download mode (VolDown+Home+Power).
8. Run Odin on PC and connect phone via USB.
9. Select "repartition" option and choose a PIT file.
10. Select the stock ROM to install using PDA button.
11. Choose Start (installs new partitions + stock OS).
12. Shutdown and remove battery.
13. CWM has been overwritten so reboot into download mode.
14. Select the CWM recovery file again using Odin PDA button.
15. Select Start to install CWM recovery once more.
16. Reboot into CWM recovery mode (VolUp+Home+Power).
17. Restore the backup you made on the ext SD card (sdcard1).
18. After I restarted the phone I had an extra 6GB of storage.

Remember that this procedure completely overwrites your internal storage. Unless you use a backup (as in step 6 above) you will lose any data on the so-called "internal SD card".

My phone now works much better. I have installed 41 apps and still have 5.1 GB free storage.

Here is the HexEdit template for editing .PIT files:
HTML:
<?xml version="1.0"?>
<!DOCTYPE binary_file_format SYSTEM "BinaryFileFormat.dtd">
<binary_file_format name="PIT" type_name="struct PIT" comment="Partition Info Table" expr=" ({this.NumEntries} Entries)">
    <data type="int" name="MagicNumber" format="unsigned" len="4" domain="this == 0x12349876" display="hex"/>
    <data type="int" name="NumEntries" format="unsigned" len="4"/>
    <data type="none" len="20"/>
    <eval expr="curr_entry = 0" display_error="false" display_result="false" comment="init loop var"/>
    <for name="Entry" count="NumEntries">
        <struct type_name="struct Entry" comment="one partition in the table" expr="{this.name} {this.num_blocks; dec} blocks" name="">
            <data type="int" format="unsigned" len="4" comment="Binary Type?"/>
            <data type="int" name="device_type" format="unsigned" len="4" domain="{FAT=1,MMC,}" bits="2" direction="up"/>
            <data type="int" name="id" format="unsigned" len="4" display=""/>
            <data type="int" name="attr" format="unsigned" len="4" domain="{RO, RW, }" bits="1" direction="up"/>
            <data type="int" name="update_attr" format="unsigned" len="4" display="hex"/>
            <data type="int" name="start_block" format="unsigned" len="4" display="dec"/>
            <data type="int" name="num_blocks" format="unsigned" len="4" display="dec"/>
            <data type="int" format="unsigned" len="4" comment="File Offset?"/>
            <data type="int" format="unsigned" len="4" comment="File Size?"/>
            <data type="string" name="name" len="32"/>
            <data type="string" name="flash_file_name" len="32"/>
            <data type="string" name="fota_file_name" len="32"/>
            <if test="curr_entry &gt; 0 &amp;&amp; num_blocks &gt; 0">
                <eval expr="start_block &gt;= Entry[curr_entry - 1].start_block + Entry[curr_entry - 1].num_blocks" display_error="true"
                      comment="check that this partition starts after the end of the previous"/>
            </if>
            <eval expr="++curr_entry" comment="inc loop var"/>
        </struct>
    </for>
</binary_file_format>
 
I've edited the title to mark it solved. Thanks for posting your solution

Support Our Troops!!!
Beast Mode 4
<><
 
Back
Top