[ info] Storage: Nexus 5 Data (info / loss / recovery / prevention) - Nexus 5 General

Contents:
Background of Android storage (Pre-Nexus 5)
How the Nexus 5 is different
You lost me at file system
Did I REALLY need to know ALL that?
A bit more info for the Nexus 5
Deleting data
Wow, all this time I've been stressing, is it really that simple?
Phone won't boot, can I get my data back from internal memory?
Display and Digitiser won't work, can I get my data back from internal memory?
Data corruption
Wiped /cache and now data is lost
Preventing data loss
Usable space
Where are CWM backups / Storage menu doesn't show all my data (Available space is less than adding up used space / What is "system data"?)
USB OTG storage
I have duplicate sdcard data
Other info
Nexus 5 Data (loss / recovery / prevention)
This thread is intended to give you an overview of some of the Storage of the Nexus 5 from a Data Loss and recovery perspective. It is not intended to cover USB sticks or mods for other storage. It is solely to cover day-to-day data concerns and give a background to how these things work
{
"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"
}
Before we get started...
Here are a couple of threads you should get familiar with before posting on XDA.
A message from the moderators - All users please read
QUESTIONS DO NOT GO IN GENERAL - There is a Q&A Forum - Please Use It
Backround of Android storage (Pre-Nexus 5)
Firstly, I think we need to understand how Android worked historically as this will help us to understand how the Nexus 5 works now.
A legacy android device, lets pretend the Nexus 1 on Android 2.2 as this was a standard configuration at the time. It had 2 major partitions (and several minor ones which are irrelevant to this topic). It has the /system partition and the /data partition. These were partitions of the internal NAND flash memory.
/system is where the Android operating system lives. The user could not delete or change anything in here (unless you were rooted). All the software that came with the phone was installed in the /system partition
/data is where all the userdata goes. Whenever you installed an app from the market, it installed to /data/app and it put all it's important data into /data/data. Also any system settings you changed (Wallpaper, ringtones etc) all were stored in /data/data. When you did a factory reset, it wiped /data and everything in it.
Of course, having these 2 partitions was not enough for everyday use. There was no where to store your music, photos, documents etc. /data is just for app data and settings. So this is where /sdcard comes in
/sdcard is the Android mount point for the External SD card in this legacy android device. This means that when you inserted a Micro SD card, Android used /sdcard as it's internal reference to where the card's storage is. The /sdcard was a necessity before you could take photos. Over time, bigger apps started to put other data here. For example, a GPS / Map application would store its apk (application package) in /data/app and store your personal configuration settings in /data/data but it may download and store offline maps somewhere on the /sdcard. In older devices, the internal Memory (NAND Flash) was usually too small to allow much data on it. Many users would have to root to get more storage space or keep uninstalling apps to keep the "low on space" warnings at bay
How the Nexus 5 is different
Well, the Nexus 5 is substantially different. There are of course SOME similarities. For example, the Nexus 5 still has internal NAND Flash Memory. This is often referred to as the eMMC (Embedded MultiMedia Card) - which still contains the /system and /data partitions, used in exactly the same way.
The main difference is /sdcard. The Nexus 5 is designed specifically to not have an SD card. It has a larger NAND Flash internal memory (eMMC) so it can also have an "internal SD card". This is where people start to get confused. The entire internal memory is an eMMC which is essentially an internal SD card, however a partition of that internal memory is /sdcard.
OK, I know - let me explain. /sdcard is a mount point that Android uses to know where to store /sdcard data. But on the Nexus 5, instead of storing it on a required external sd card, it points to an internal memory partition. Now here is the clever bit. The /sdcard actually points to /data/media/0. So you continue to have your /data partition, but within /data you have:
/data/app
/data/data
/data/media/0
The clever thing is that the file system that android uses for /system and /data is a Linux file system called Extended FS. In our case, we use the Ext 4 file system. This is important to understand because these file systems do not work with Windows so an external SD card would usually be Fat 32 file system, or exFAT so we could plug it into our windows computers and read the contents. What Google have had to do is use the FUSE file system to allow /sdcard (or /data/media/0) to be accessed from windows. Clever stuff. But it has it's pro's and cons...
Ext 4 is seen as a safer file system to FAT, or any of the Windows friendly ones. This is because it has something called journalling which keeps data safer from corruption and errors. Ext 4 also preserves permissions on files, so the data is safer from anything that may be malicious on your phone. Using FUSE with MTP and PTP means we have maximum compatibility across computer OS platforms.
You lost me at file system
All electronic systems that have an operating system and store data use a file system. Think of it in it's simplest form. Imagine a school text book. It has lots of chapters about different things. It has a "Table of Contents" in the first few pages, telling you where each chapter in the book is so if you want to know what page chapter 13 is on, you look in the contents and find the page and go straight there - The alternative is looking through each page individually to find the chapter. Not a quick process.
Well data storage works the same. When you put a file on a hard drive, sdcard, USB stick (or whatever) it is written to a specific location. When it is written to this location, the location is added to the file system. So when you put word.doc onto the drive, The file system is informed of the (very complicated) location of the file. When you tell Windows, Android (or whatever) that you want to open word.doc, the operating system consults the File system and goes to retrieve the data from its true and real (yet very complicated) location on the drive.
Did I REALLY need to know ALL that?
You know what? Probably not but it may go some way to help understand the limitations we will cover later on.
A bit more info for the Nexus 5
One thing many of you have probably noticed is that with the Nexus 5, there is no option to mount the /sdcard as USB Mass storage on your computer. You must use MTP or PTP.
PTP - Photo Transfer Protocol. When you connect your Nexus 5 to your computer using PTP, Your computer sees it as a camera. It will show photos on your "camera" and will set about implementing the default camera options (such as suggesting you import your photos) etc. It won't show documents or other media necessarily.
MTP - Media Transfer Protocol. When you connect your Nexus 5 to your computer, it will be seen as a media player. This should allow you full access to all the files on there, including word documents and the such like.
One of the reasons for this is that because /sdcard points to something using the FUSE file system and is not a true partition, it would be difficult to allow it to be used as USB Mass Storage. It may or may not be possible but the biggest advantage of using MTP / PTP is that the computer and the Nexus 5 can both access the internal memory at the same time. With USB Mass Storage (UMS) this is quite awkward and can result in errors.
The draw back of these protocols is that you cannot give your device a Windows "Drive letter"
Deleting data
This is partially why we needed to understand a little about file systems. So I could explain to you how data is handled when it is deleted.
As I explained earlier, when you write a file to memory, a corresponding entry is written to the file system to advise the OS where the data is. Sure, you may think you are writing the file to /sdcard/documents/work directory on the internal memory, but in reality these directories or folders do not actually exist at a memory hardware level. The data is written to a block and the file system is informed where that block is, how big the file is, what directory it should appear in to the OS etc. When a file is written the memory, the OS see's the available space go down and the used space go up. All this information comes from the file system.
When you delete the file, the actual data is NOT deleted. It remains where it is on the memory. The block is not overwritten. When the OS is told by the user to delete the file, the File system entry is deleted. This changes the free/used space as the file system is no longer accounting for the data, however the truth is the data still exists. When the next request to write a file to the memory comes from the OS, the file system will think the block where the old data was is empty and will overwrite it.
It is this difference between the file system and reality that allows data to be recovered by external software. if you do not write any data to the memory, external software can scan the memory for data whilst bypassing the file system all together. Ff course the window is small. You only have a very limited time to recover data before the file system allows the data to be overwritten with a new entry.
This is not just true of a deleted file. Even formatting the memory (which is actually just re-creating a new, blank file system) leaves all the data in tact behind-the-scenes and can all still be recovered until you start writing data to the memory. Cool huh?
Wow, all this time I've been stressing, is it really that simple?
Awwww snap! You got me. No it is not that simple. All this PC software, example: Piriform recuva only works on a computer drive. In windows, imagine this is anything with a Drive Letter. C: drive etc. The only way to get a drive letter on your /sdcard is to use USB Mass Storage mode, which as previously discussed - is not possible on your Nexus 5.
It is not realistically possible to get your data back once deleted from internal memory. Once gone, it's gone forever*
* Please see This post as pointed out by @efrant as a possible method which was touted as "not for the faint of heart"
* Some people have reported success with DiskDigger
Phone won't boot, can I get my data back from internal memory?
Let's start by saying, it depends why your phone won't boot. If your internal eMMC (NAND FLash memory) has failed, then probably not. However, if you believe this is not the case then you can get your /sdcard data using adb BUT you need a custom recovery to be flashed, which also requires your bootloader to be unlocked - Read THIS
However, if out of curiosity - you do still want to get your data off, using adb , read below:
Pre requisite is having adb "installed" on your windows PC. Download THIS file and follow the instructions in the readme.
1) Boot into recovery, connect usb and go to "mounts and storage". Toggle the "mount data" options to mount these partitions. Tip, when mounted, the option then becomes "unmount data"
2) Open "cmd" in Windows and type the below code, which will copy all your data to a folder called sdcard on your windows desktop
Code:
adb pull /data/media/0/ c:\users\rootsu\desktop\sdcard
Also note, this assumes you have windows vista or newer. Also, it assumes your windows username is rootsu.
That's it, simple.
Display and Digitiser won't work, can I get my data back from internal memory?
You can use adb and a custom recovery to pull data from your /sdcard or even app data from /data/data
Pre requisite is having adb "installed" on your windows PC. Download THIS file and follow the instructions in the readme.
1) Boot into recovery, connect usb and go to "mounts and storage". Toggle the "mount data" options to mount these partitions. Tip, when mounted, the option then becomes "unmount data"
2) Open "cmd" in Windows and type the below code, which will copy all your data to a folder called sdcard on your windows desktop
Code:
adb pull /data/media/0/ c:\users\rootsu\desktop\sdcard
Other things you may want to pull.....
Code:
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db c:\users\rootsu\desktop\sdcard
Code:
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db c:\users\rootsu\desktop\sdcard
Also note, this assumes you have windows vista or newer. Also, it assumes your windows username is rootsu.
That's it, simple.
FYI, if you want to use adb pull in Android (Kitkat+) it's different. Instead of /data/media/0, use /sdcard (yes you could use /sdcard in recovery too, but not all recoveries mount everything correctly to /sdcard).
Otherwise, in Android you'd need to mount /data rw....
Code:
adb root
restarting adbd as root
adb shell
mount -o rw,remount /data
exit
adb pull <whatever>
Data corruption
When data becomes corrupt, there's really not a lot you can do. The file system knows where the data is already. If it's corrupt, you're stuck. Most common causes of corruption is dirty unmount (phone shuts off when writing) or dodgy flash / wipe. If your data is corrupt, there really isn't much you can do to restore it. This is why backups are important.
Wiped /cache and now data is lost
It's quite common during a bad /cache wipe that data appears to be lost or even cannot connect to the mobile network. The data is still there however, you just can't see it.
If your bootloader is unlocked, you can usually fix this by using fastboot to flash the stock cache image
Code:
fastboot flash cache c:\path_to\cache.img
Of course unlocking the bootloader wipes data so if you haven't, you won't want to. All you can do is try to reformat /cache via stock recovery a few times.
Factory images (to get cache.img) can be found here: https://developers.google.com/android/nexus/images
Preventing data loss
Time to wise up guys. It is possible to recover data off your removable media, but internal memory - very unlikely. No apps on your PC or Android will help with deleted data. So you need to backup.
Dropbox - Use dropbox to automatically upload your photos to online storage.
Foldersync - Use FolderSync to upload important sdcard files to your dropbox account, or better yet - got a computer thats always on at home? Set foldersync to schedule a sync over wifi whilst you're asleep.
I personally use Tasker with Foldersync. I have tasks that upload new photos over sftp to my NAS, no matter where I am and tasks that backup /sdcard overnight to my NAS whilst I sleep.
Useable space
32 GB Nexus isn't 32 GB. 16 GB Nexus isn't 16 GB
Here is how it works.
A true GB is 1024 MB, which is 1024 KB, which is 1024 B. This is how Software (including operating systems) report a true GB (Now referred to as GiB).
Hardware manufacturers however, refer to a GB as 1000 MB, which is 1000 KB, which is 1000 B. So there is a disparity here that gets bigger, the higher the number.
So you need to employ mathematics to work out the TRUE capacity of the Nexus 5.
Take your 32 GB reported hardware, and multiply it by 1000 a total of 3 times. Then, take the result and divide it by 1024 a total of 3 times. This is the total true capacity
32 x 1000 MB x 1000 KB x 1000 B = 32,000,000,000 B
32,000,000,000 B / 1024 B / 1024 MKB / 1024 MB = 29.8 GB
So in summary, any SD card, SSD, Device, HDD that reports to have "32 GB" capacity, it is only ever 29.8 GB (or 29.8 GiB) capacity.
So now it starts to add up a bit more. Then obviously there is a recovery partition, cache partition, System partition and more..... which is excluded from the total "storage"
Here are the main partitions (excluding /data which was 12.6GB) for the N5 (taken from a 16GB) - use "df" from terminal
/system 1009.3M
/cache 689.8M
/persist 15.8M
/firmware 64.0M
However, there are technically 29 partitions, they obviously don't add up to much between the others - use "ls -lR /dev" from terminal
Code:
lrwxrwxrwx root root 1970-01-15 02:15 DDR -> /dev/block/mmcblk0p24
lrwxrwxrwx root root 1970-01-15 02:15 aboot -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 1970-01-15 02:15 abootb -> /dev/block/mmcblk0p11
lrwxrwxrwx root root 1970-01-15 02:15 boot -> /dev/block/mmcblk0p19
lrwxrwxrwx root root 1970-01-15 02:15 cache -> /dev/block/mmcblk0p27
lrwxrwxrwx root root 1970-01-15 02:15 crypto -> /dev/block/mmcblk0p26
lrwxrwxrwx root root 1970-01-15 02:15 fsc -> /dev/block/mmcblk0p22
lrwxrwxrwx root root 1970-01-15 02:15 fsg -> /dev/block/mmcblk0p21
lrwxrwxrwx root root 1970-01-15 02:15 grow -> /dev/block/mmcblk0p29
lrwxrwxrwx root root 1970-01-15 02:15 imgdata -> /dev/block/mmcblk0p17
lrwxrwxrwx root root 1970-01-15 02:15 laf -> /dev/block/mmcblk0p18
lrwxrwxrwx root root 1970-01-15 02:15 metadata -> /dev/block/mmcblk0p14
lrwxrwxrwx root root 1970-01-15 02:15 misc -> /dev/block/mmcblk0p15
lrwxrwxrwx root root 1970-01-15 02:15 modem -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 1970-01-15 02:15 modemst1 -> /dev/block/mmcblk0p12
lrwxrwxrwx root root 1970-01-15 02:15 modemst2 -> /dev/block/mmcblk0p13
lrwxrwxrwx root root 1970-01-15 02:15 pad -> /dev/block/mmcblk0p7
lrwxrwxrwx root root 1970-01-15 02:15 persist -> /dev/block/mmcblk0p16
lrwxrwxrwx root root 1970-01-15 02:15 recovery -> /dev/block/mmcblk0p20
lrwxrwxrwx root root 1970-01-15 02:15 rpm -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 1970-01-15 02:15 rpmb -> /dev/block/mmcblk0p10
lrwxrwxrwx root root 1970-01-15 02:15 sbl1 -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 1970-01-15 02:15 sbl1b -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 1970-01-15 02:15 sdi -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 1970-01-15 02:15 ssd -> /dev/block/mmcblk0p23
lrwxrwxrwx root root 1970-01-15 02:15 system -> /dev/block/mmcblk0p25
lrwxrwxrwx root root 1970-01-15 02:15 tz -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 1970-01-15 02:15 tzb -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 1970-01-15 02:15 userdata -> /dev/block/mmcblk0p28
USABLE space for the user is:
26.7 GB for the 32 GB
12.55 GB for the 16 GB
Where are CWM backups / Storage menu doesn't show where all my data is
Please note, rooted users with clockworkmod recovery will find that their backups to not go to /data/media/0/clockworkmod as it is supposed to. The reason for this is CWM has not been updated to this location, instead it uses the legacy location of /data/media/clockworkmod. The Storage menu can see that the space is used but it cannot include it in it's breakdown. Please check this location. You'll need to move it to 0 if you want to access it on a computer
/data/media is the OLD location of /sdcard. All recoveries should use /data/media/0 as /sdcard but CWM itself is antiquated. Really you should upgrade to Philz or TWRP recovery.
A handy app is "Disk Usage" on Play. It can help identify exactly where this data is....
USB OTG storage
The Nexus 5 by default does not automatically mount USB Storage. There are a few options for you however.
1) Buy Nexus Media Importer - No-root required (Read description before purchase)
2) Use OTG USB Helper or Stickmount which are both free but require root
3) Use a custom kernel such as Chaos Kernel with automount of USB OTG
I have duplicate sdcard data
I bet you haven't. All these locations all point to the same place. If you're looking in any of these, you're looking at your sdcard data so don't delete it.
/sdcard
/data/media/0
/data/media/legacy
/storage/sdcard0
/storage/emulated/0
/storage/emulated/legacy
Other info
This is a work in progress. Please let me know if you think I need to reword something or add something.

You have a lot of good information in there.
However, there are a couple of things that I would consider not entirely accurate:
1)
rootSU said:
Well, the Nexus 5 is substantially different.
Click to expand...
Click to collapse
The issue with this is that the changes to the file system are not related to the Nexus 5, but are related to the version of Android. The changes you talk about came with Android 4.2, and any device using 4.2 (or newer) with no external sdcard (e.g., Galaxy Nexus, Nexus 4, etc.) will have the same file system structure. What you see on the N5 is no different that the Galaxy Nexus for example.
2)
rootSU said:
It is not realistically possible to get your data back once deleted from internal memory. Once gone, it's gone forever.
Click to expand...
Click to collapse
This is not true. There are ways to dump your userdata partition to your PC and you can recover your deleted files. See here for an example. It is not for the faint of heart, but it is doable.

efrant said:
You have a lot of good information in there.
However, there are a couple of things that I would consider not entirely accurate:
1)
The issue with this is that the changes to the file system are not related to the Nexus 5, but are related to the version of Android. The changes you talk about came with Android 4.2, and any device using 4.2 (or newer) with no external sdcard (e.g., Galaxy Nexus, Nexus 4, etc.) will have the same file system structure. What you see on the N5 is no different that the Galaxy Nexus for example.
2)
This is not true. There are ways to dump your userdata partition to your PC and you can recover your deleted files. See here for an example. It is not for the faint of heart, but it is doable.
Click to expand...
Click to collapse
Thanks.
2) ill have a look at that tomorrow.
1) i've been using FUSE since 4.0.4 and //data/media/0 since 4.2 but this is a Nexus 5 thread. I'm showing how the Nexus 5 specifically is different from earlier android versions. My S3 version of this thread states that the S3 is substantially different too. It's not relevant to talk about FUSE in pre 4.2 android context in a device thread that launched with 4.4 - the outline is to distinguish between having to have an sdcard and not having to have an sdcard today - but I don't really think different iterations of internal /sdcard need to be mentioned. The journey isn't as important as the disparity between the start and "end" points
-----------------------
Sent via tapatalk.
I do NOT reply to support queries over PM. Please keep support queries to the Q&A section, so that others may benefit

rootSU said:
[snip]
1) i've been using FUSE since 4.0.4 and //data/media/0 since 4.2 but this is a Nexus 5 thread. I'm showing how the Nexus 5 specifically is different from earlier android versions.
Click to expand...
Click to collapse
Maybe I misunderstood then.
You say you are showing "how the Nexus 5 specifically is different from earlier android versions." What do you mean exactly?
Do you mean you are showing:
a) how 4.4 specifically is different from earlier android versions, or
b) how the Nexus 5 specifically is different from earlier android devices?
In any case, in terms of what you are discussing (i.e., /sdcard, directory structure, data recovery, etc.):
a) 4.4 is no different than 4.2.
b) the Nexus 5 is no different than the Nexus 4
so I'm not entirely sure I understand what you are getting at.
If I misunderstood, and 4.4 is different than 4.2, or the N5 is different than the N4 (in the context of the discussion here, i.e., /sdcard, directory structure, data recovery, etc.), then I would be interested in hearing your thoughts. Since having both devices, I have seen no difference at all.
EDIT: The only reason I am mentioning any of this, is that in my opinion, it is misleading to refer to "Pre-Nexus 5", as it implies that everything before was different, when in fact it wasn't. In any case, after re-reading your reply, I think you are showing the comparison of the Nexus 5 and Android 4.4 versus an older device (pre-GNex) with a version of Android pre-4.2.

Nice write up.
Sent from my Nexus 5 using xda app-developers app

efrant said:
Maybe I misunderstood then.
You say you are showing "how the Nexus 5 specifically is different from earlier android versions." What do you mean exactly?
Do you mean you are showing:
a) how 4.4 specifically is different from earlier android versions, or
b) how the Nexus 5 specifically is different from earlier android devices?
In any case, in terms of what you are discussing (i.e., /sdcard, directory structure, data recovery, etc.):
a) 4.4 is no different than 4.2.
b) the Nexus 5 is no different than the Nexus 4
so I'm not entirely sure I understand what you are getting at.
If I misunderstood, and 4.4 is different than 4.2, or the N5 is different than the N4 (in the context of the discussion here, i.e., /sdcard, directory structure, data recovery, etc.), then I would be interested in hearing your thoughts. Since having both devices, I have seen no difference at all.
EDIT: The only reason I am mentioning any of this, is that in my opinion, it is misleading to refer to "Pre-Nexus 5", as it implies that everything before was different, when in fact it wasn't. In any case, after re-reading your reply, I think you are showing the comparison of the Nexus 5 and Android 4.4 versus an older device (pre-GNex) with a version of Android pre-4.2.
Click to expand...
Click to collapse
Ok, to be succinct...
The reader of this thread should have a nexus 5. This thread is about the Nexus 5. Regardless of whether anything is an "android feature" or a "nexus 5 feature", this thread is being read because the reader owns a Nexus 5.
Android 4.2, Nexus 4, Galaxy S3 - they do not matter. They are not important. I only wish to show what /sdcard used to mean to android in a pre-fuse context and what /sdcard means to android -specifically on a Nexus 5. What /sdcard means on the Nexus 4 is irrelevant. Got A Nexus 4? Read a nexus 4 thread. I cannot attest to that.
When someone tries to sell loft-insulation to a home owner, they sell it in context "your home could benefit" rather than "a house could benefit". I don't want anyone to look at this and say "that's not true on my phone" because i've generalised "android this" or "android that" and I don't feel it necessary to further caveat that by "well except this version of android" or "unless you have a Galaxy S2". Its a Nexus 5 thread.
Thanks for your feedback but I wont be changing that. Hope you understand.
Not so succinct afterall
Please feel free to pm me if you wish.
Edit... just so you know, i'm not taking this personally. Its all constructive. ...and I do hope im not coming off as rude. Im just trying to clarify my point
-----------------------
Sent via tapatalk.
I do NOT reply to support queries over PM. Please keep support queries to the Q&A section, so that others may benefit

Deleted

!dea
Your contents are rather informative and had let me think this way. As in androids with SD Card feature come with two partitions, why can't we Partition Internal memory to two drives and let use one for Android kernel and another as /sdcard If this is possible, USB Mass Storage would become possible and guarantee File transfers, well as one does with SD (that too in Maxi Speed!). Is this possible?:cyclops:

arvindgr said:
Your contents are rather informative and had let me think this way. As in androids with SD Card feature come with two partitions, why can't we Partition Internal memory to two drives and let use one for Android kernel and another as /sdcard If this is possible, USB Mass Storage would become possible and guarantee File transfers, well as one does with SD (that too in Maxi Speed!). Is this possible?:cyclops:
Click to expand...
Click to collapse
Then you would need to have a set a limited size /data partition. So instead of having
/data (including /sdcard) = 12.35 GB
You have:
/data = 2GB
/SDcard = 10.35 GB
But is 2 GB enough for /data? Usually not...
Also, you cannot then use /sdcard if it is plugged into the computer.
Its more trouble than it is worth. Just backup your /sdcard data regularly.

rootSU said:
Then you would need to have a set a limited size /data partition. So instead of having
/data (including /sdcard) = 12.35 GB
You have:
/data = 2GB
/SDcard = 10.35 GB
But is 2 GB enough for /data? Usually not...
Also, you cannot then use /sdcard if it is plugged into the computer.
Its more trouble than it is worth. Just backup your /sdcard data regularly.
Click to expand...
Click to collapse
Thank u for response. Sure 2GB not gonna be sufficient. If I illustrate needs you could understand,
I use Ttorrent Client for downloading files and often USB MTP Mode does not list recently downloaded files especially through Ttorrent. Reboot suffixes Bug, yet remain Troublesome.
Also, I have habit watching Large-size Movies which mostly seem above 2GB's. For copying such .mkv (or) .avi through I need to disable Security lock or else, file copy gets interrupted! (Not that adb push). Also, if interrupted s/w like Teracopy help resume copy. Another significant drawback on MTP is, every time I copy some non-proprietary contents it issues warning like "This content may not play in your device". For one instance it is Okay. But, for months, and for long run it is annoying!.
Maybe for time I remember only these. Your comment about non-availability of /sdcard is agreeable but rather said drawbacks, I could manage that one. As said surely 2GB won't be sufficent, Say if I split partitions to some 7GB+remaining. It would suffix the needs. Next time, Link me(us) some source or post me instructions to do so, such that I'd consider trying...

Sorry is ttorrent on pc or android? Please can you describe set up / actions in detail so I can better understand the problem?
-----------------------
Sent via tapatalk.
I do NOT reply to support queries over PM. Please keep support queries to the Q&A section, so that others may benefit

Thank much for your clear instruction! Reallly helps me to figure out how android system works.It is crystal clear!
Sent from my Nexus 5 using XDA Premium 4 mobile app

Reply
rootSU said:
Sorry is ttorrent on pc or android? Please can you describe set up / actions in detail so I can better understand the problem?
-----------------------
Sent via tapatalk.
I do NOT reply to support queries over PM. Please keep support queries to the Q&A section, so that others may benefit
Click to expand...
Click to collapse
Sure on phone. PC's consume more power to do same I do, over phones!!!:angel: Running torrent client on phone, fore-said things are to be considered.:fingers-crossed:

arvindgr said:
Sure on phone. PC's consume more power to do same I do, over phones!!!:angel: Running torrent client on phone, fore-said things are to be considered.:fingers-crossed:
Click to expand...
Click to collapse
OK I am still struggling to understand your problem. I think we can find a solution but I still dont understand where the issue is. Please can you simplify the issue for me?

Thank you for this summary. Though I have a question about this.
The /sdcard actually points to /data/media/0. So you continue to have your /data partition, but within /data you have:
/data/app
/data/data
/data/media/0
Click to expand...
Click to collapse
As I did not do a nandroid backup via Recovery yet, I wonder how /data is backed up besides /system, as /sdcard is a mount of /data/media/0 instead of an external device. So /data is backed up to itself recursively which will not make much sense.
Does the backup system detect /data/media/0 and exclude it from the backup or do I misunderstand something about this whole
concept ?
Also, do I understand correctly that, if the /data partition itself gets corrupt I will not be able to flash a backup of it because /data
can not be mounted and in consequence /data/media/0 can not be mounted at /sdcard to access the backup ?
Also I did not find reliable information on what nandroid actually backs up and what it doesn't.
Thank you all in advance for answers.
Edit:
I hope this is not a violation of QUESTIONS DO NOT GO IN GENERAL as I think this fits here quite well.

Luddi said:
I hope this is not a violation of QUESTIONS DO NOT GO IN GENERAL as I think this fits here quite well.
Click to expand...
Click to collapse
No, it's fine. It's what the thread is for, to service these kind of queries instead of creating new threads.
Luddi said:
As I did not do a nandroid backup via Recovery yet, I wonder how /data is backed up besides /system, as /sdcard is a mount of /data/media/0 instead of an external device. So /data is backed up to itself recursively which will not make much sense.
Does the backup system detect /data/media/0 and exclude it from the backup or do I misunderstand something about this whole
concept ?
Also, do I understand correctly that, if the /data partition itself gets corrupt I will not be able to flash a backup of it because /data
can not be mounted and in consequence /data/media/0 can not be mounted at /sdcard to access the backup ?
Also I did not find reliable information on what nandroid actually backs up and what it doesn't.
Click to expand...
Click to collapse
You are right, in that the /sdcard or /data/media/0 is not backed up in a nandroid backup. nandroid backs up /system, /cache and /data (excluding legacy and 0, 1, 2 etc). It may backup more depending on what recovery you are using and what options you have configured for backups.
In regards to /data corruption, it is really hard to say because each corruption case is different. All i can really tell you is backup your backups off device.

rootSU said:
OK I am still struggling to understand your problem. I think we can find a solution but I still dont understand where the issue is. Please can you simplify the issue for me?
Click to expand...
Click to collapse
Let's cut to chase.
1. I'm not comfortable with MTP type connection.
2. I want to split internal memory to two partitions.
3. How to do that? (Like 7GB for Internal Android files and remaining space like 5.9GB for /sdcard)
4. Enable /sdcard partition to mount as Mass Storage drive when I connect device to computer...
Previously I've been telling the need for that. Just reply whether it's possible to and how to...
Can u get me now?
Sent from my Nexus 4 using Tapatalk

arvindgr said:
Let's cut to chase.
1. I'm not comfortable with MTP type connection.
2. I want to split internal memory to two partitions.
3. How to do that? (Like 7GB for Internal Android files and remaining space like 5.9GB for /sdcard)
4. Enable /sdcard partition to mount as Mass Storage drive when I connect device to computer...
Previously I've been telling the need for that. Just reply whether it's possible to and how to...
Can u get me now?
Sent from my Nexus 4 using Tapatalk
Click to expand...
Click to collapse
I got THAT and NO IT IS NOT Possible. I wanted to understand the problem so I could offer alternative solutions but since you cannot be bothered to explain yourself correctly, I no longer want to try and help you. Get me now?

I won't have wrote much times if I have not bothered. I'm glad that you got the thought.
rootSU said:
Then you would need to have a set a limited size /data partition. So instead of having
/data (including /sdcard) = 12.35 GB
You have:
/data = 2GB
/SDcard = 10.35 GB
But is 2 GB enough for /data? Usually not...
Also, you cannot then use /sdcard if it is plugged into the computer.
Its more trouble than it is worth. Just backup your /sdcard data regularly.
Click to expand...
Click to collapse
This reply implied as if it is possible. Actually this is not some problem. Since you have asking me detail problem, I want to portray the need. Rather than asking to detail problem for more times, you could have quoted have specific part, so that more information is gathered. Thank you for your time spent ... ^_^
Artistic Viable Ndugu on Mako
---------- Post added at 02:50 AM ---------- Previous post was at 02:43 AM ----------
I won't have posted many times of I didn't bother. Better as you were unable to understand it I was unable to explain, there is better way to split to specific parts of my question so that more efficient time is spent.
rootSU said:
Then you would need to have a set a limited size /data partition. So instead of having
/data (including /sdcard) = 12.35 GB
You have:
/data = 2GB
/SDcard = 10.35 GB
But is 2 GB enough for /data? Usually not...
Also, you cannot then use /sdcard if it is plugged into the computer.
Its more trouble than it is worth. Just backup your /sdcard data regularly.
Click to expand...
Click to collapse
This implied as if my wish us possible. Thank you for your time spent, maybe I'll keep looking for some solution and would post if I narrow down...
Artistic Viable Ndugu on Mako

So is this why es file explorer had recycle bin option? Because the data isn't really gone until it's overwritten?
Sent from my white Nexus 5 using xda-developers app.
Please press the thanks button if I help you.

Related

Possible to put stock image on sd card

I am on rooted 1.1 v2 and everything works great. The only thing missing is the in store reading free books for an hour a day. I was wondering if I could boot stock BN image on sd card when I am in the BN store, so I could get the in store feature?
I have been reading a lot and many people with 1.1 v2 cannot get access to the free one hour reading. I am a newbie, so alot of android dev forum is a little over my head.
If anyone knows of another way to get in store reading, I would appreciate the help.
Not a bad question. In theory i bet its possible. Id love to have an sd for stock use....
Sent from my Nook Color (zoom2) using Tapatalk
I just want it for in store reading.
Why no one has thought of this before I have no idea, but its a Great Idea, Count me in if they can come up with this, maybe some high and mighty dev will come by and hear our pleas.
It would be great to have the Free Reading and to get books on free book Friday, Also i think they have in-store coupons.
therealguppy said:
Why no one has thought of this before I have no idea, but its a Great Idea, Count me in if they can come up with this, maybe some high and mighty dev will come by and hear our pleas.
It would be great to have the Free Reading and to get books on free book Friday, Also i think they have in-store coupons.
Click to expand...
Click to collapse
I believe it was tried previously, but there's things in the stock ROM that have hard coded reference points to parts of the system (if memory serves). The person trying to do this early on gave up for that reason. I could be wrong, but I think this was in mid December.
I was getting ready to ask this question when I found your thread. I really hope something like this does pop up in the Dev section - I'll use my nook daily with a custom froyo rom, but it would be nice to be able to use the stock image off a SD when I stop into a B&N.
Well, in theory it's quite easy to do. Read the entire post before attempting the trick.
As usual, I'm not responsible if your NC starts speaking Flemish. Be careful with your Internal partitions!
Requirements: stock on internal, gparted, maybe my UMS utility (DEV), an SDCard (8GB at least, to be safe), a few minutes.
Partition an SDcard following stock layout.
You can partition the SD by using gparted. Create a new partition table, then create the partitions. Then apply. Don't forget to use "round to cylinder" and always leave a 1mb space at the beginning of each partition (except boot). Or else, you'll end up with corrupt partitions, writing over one another. Partition size can be changed, just make sure they're big enough..
Make sure the first partition has the bootable/boot flag.
To print the layout, use ADB command "fdisk /dev/block/mmcblk0 -l".
Or search for the layout in dev forum.
Layout looks like this (by heart, so check):
(Primary: )
p1: boot = FAT32 ~70 MB
p2: rom = FAT32 ~70 MB
p3: factory = ext2 ~??MB (this can left at 1mb, its a recovery partition, no use here)
p4: extended (not a partition strictly speaking, it's an extension)
(Logical: )
p5: system = ext2 ~470MB
p6: data = ext3 ~900MB (this can be bigger, app data storage)
p7: cache = ext3 ~350MB
p8: media = media FAT32 ~5GB (this can use all the remaining space, as big as you can/wish: media storage, books, films)
Then, you'll need to copy partition contents onto the SDCard's newly created partitions.
The easyiest way of doing it is by making .tar files of internal partition contents and extracting the files onto the SD partitions.
To create the tar files:
- either use <tar XXX.tar *> adb command on each partition, make sure you compress the actual content, not the container folder (i.e tar system content and not system, the * in the command stands for all content). Then pull the tar file. Delete it afterwards from internal!
- OR, probably more user friendly, use my USB mass storage utility found in DEV, mount each partition and create tar files with your usual UI (Ubuntu, Windows, OSX).
Copy every tar file onto your PC.
Tar files of internal partitions aren't all mandatory, all depends on if you want to make a complete backup of running stock rom, or if you just want the general stock rom on an SD. For instance, cache and media can be ignored, if you just want a general version. If you want to backup your media, tar media as well.
Then, extract each file onto the corresponding partition of you partitioned SD. Delete .tars afterwards from SD partitions.
THEN: download attached file, erase uRamdisk from you SD's boot partition and replace it with the one in the attached zip file (rename SD-STOCK-uRamdisk to uRamdisk). Without this step, your SD will boot from system and data internal partitions.
This uRamdisk has adb activated, so you should be able to push files to the SD once booted. Some internal commands won't work though (i.e, mount). You'll have to install busybox and root (su) the system, well if that's your goal that is.
Then insert the SD and boot.
In theory, this should boot up to stock from SD.
I could be missing something, it's late here, and I haven't tried any of this.
Beware: recovery, even from SD, will affect the internal partitions! Maybe it's best you delete uRecRam and uRecImg from your SD's boot (NOT INTERNAL!).
NB: you need to edit vold.conf. See second page of this thread.
Note: you could also use 'dd' command instead of making tars, but you'd end up with huge .img files.
PS: If you have no way of accessing your SD partitions once they're created, use the following command from ADB while booted from working internal system, with SD inserted in NC:
echo /dev/block/mmcblk1 > /sys/devices/platform/usb_mass_storage/lun0/file
Click to expand...
Click to collapse
This last command should open every SD partition in you PC's explorer.
Sam
I don't see the point in asking a question if you're not interested in the answer...
Sent from my HTC Desire using XDA App
samuelhalff said:
I don't see the point in asking a question if you're not interested in the answer...
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
I for one appreciate it, but missed that reply. I'm going to need to stockpile some microSD cards for all these various things to try .
I tried these instructions and it boots to the initial setup screen. I can see broadcasting AP's, but unfortunately I can't get it to connect any WiFi hotspot.
It appears to associate, sits at obtaining IP, but eventually gives up.
ADB connects and I was able to look at dmesg, but nothing stands out.
I went back to the eMMC and registered, exported /data, imported it to the SD card, and was able to bypass registration. However, it still doesn't connect to WiFi.
Only point that is probably worth noting is that I used a 2GB SDCard and here's what my mount output looks like:
mount
rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /sqlite_stmt_journals tmpfs rw,size=4096k 0 0
/dev/block/mmcblk1p2 /rom vfat rw,sync,noatime,nodiratime,uid=1000,gid=1000,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,errors=remount-ro 0 0
/dev/block/mmcblk1p5 /system ext2 ro,errors=continue 0 0
/dev/block/mmcblk1p6 /data ext3 rw,nosuid,nodev,noatime,nodiratime,errors=continue,data=ordered 0 0
/dev/block//vold/179:17 /sdcard vfat rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,
shortname=mixed,utf8,errors=remount-ro 0 0
Click to expand...
Click to collapse
Any ideas?
Success
I could follow the instruction and made a 8gb stock bootable micro sd card. Only problem I can see is it mounts the boot partition of sd card as "/sdcard" and creates few folders like "B&N Downloads", "My Files". Is there any way to disable the sd card mount.
If anyone is interested in getting a copy of the sd card I can upload.
pbcal said:
I could follow the instruction and made a 8gb stock bootable micro sd card. Only problem I can see is it mounts the boot partition of sd card as "/sdcard" and creates few folders like "B&N Downloads", "My Files". Is there any way to disable the sd card mount.
If anyone is interested in getting a copy of the sd card I can upload.
Click to expand...
Click to collapse
I'm interested in it, or at least a "dummies guide" to doing this via a Windows PC..
I mean, as I read samuelhalff's post, it looks like it should be relatively easy to follow, but I have a few questions...
I see things like creating the partitions on the SD using gparted (which appears to be a linux command) so I don't know if I can maybe use EASEUS in Windows do do it? And am I reading it correctly, that TAR is a command I can run from inside an ADB SHELL? (i.e. type ADB Shell, then TAR)
I'll upload it tonight and post the link.
pbcal said:
I'll upload it tonight and post the link.
Click to expand...
Click to collapse
only reason that might not be a good idea is copyrights... not sure what if any might make it against the rules here, or something B&N would frown upon... then again, I guess its no worse than the .ZIP image in the recovery threads?
In any case, Thank you!!! I do appreciate it!
pbcal said:
I could follow the instruction and made a 8gb stock bootable micro sd card. Only problem I can see is it mounts the boot partition of sd card as "/sdcard" and creates few folders like "B&N Downloads", "My Files". Is there any way to disable the sd card mount.
If anyone is interested in getting a copy of the sd card I can upload.
Click to expand...
Click to collapse
I eagerly await this...and thank you for the work. I would use this as a dual-boot SD card with my daily-use ROM installed to internal memory. There are fairly easy-to-follow directions here on xda that will allow us to dual boot your SD card and internal memory. If you choose to boot from internal memory, then the SD card just becomes your external storage. No SD card swapping needed to go between your daily OS and the B&N stock. Very cool.
Thanks again.
You're welcome..
Sent from my Desire HD using XDA App
I'd love to get this as well. I had a 1.1 rooted stock which didn't give me the free hour in the store laast weekend. Sort of bummed as I heard it worked for some people.
Dan
Sent from my NookColor using Tapatalk
As I mentioned above, this would be great for dual-booting from eemc and sd card. I messed around with this a bit this evening and got it working nicely with one of the old Honeycomb images. The instructions for setting up dual boot are here:
http://forum.xda-developers.com/showthread.php?t=947698&highlight=dual+boot
I did have to mess around with the SD card a bit as once you boot from the internal memory, it is the first partition of the SD card that is used as your SD storage. Most SD card images have this as a very small boot partition with the fourth partition the larger SD card partition. I used a free program called Parted Magic to move the second, third, and fourth partitions over and expand the first partition into the unused space, creating a 5GB boot partition. I then put the multi-boot files from the thread above into the large boot partition. Worked like a charm - when booting from the SD card, Honeycomb used the fourth partition as the SD card storage space. When booting from internal memory, CM7 (the ROM I have installed to internal memory) used the 5GB boot partition as the SD card storage space.
Eageraly awaiting someone to build this and post an image file. I will admit that I am not smart enough to carry out the lengthly and excellence directions posted by samuelhalff.
Here is the link for the image. You will need a 8 GB or higher SD card.
Sorry for the large file. It has all partitions with stock data except data, cache and media.
Post your results / issues.
[COLOR="Red"][B]Removed[/B][/COLOR]
Click to expand...
Click to collapse
To avoid having /sdcard mounted on boot, you need to edit /system/vold.conf :
Code:
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
##mount_point /media
mount_point /sdcard
ums_path /devices/platform/usb_mass_storage/lun1
}
Add "partition 8" in the sdcard section.
Explanation: see, media is set to partition 8 of internal. That's right. But here, sdcard will mount automatically the first sdcard partition (boot), as partition isn't set. You need to manually set it mount partition 8 (sdcard)..
Sam

Alternate Webtop partition

I was hoping to be able to figure all of this out on my own (so that I could impress everybody with my brilliance, of course! ), but I've hit a brick wall, so I figured I would see whether anybody had any suggestions.
The short version: I'd like to be able to create an alternate and larger /osh partition that we can run Ubuntu off of so that we can install software more freely as well as not worry about any future software updates that might conflict with the partition contents.
My thought was that it should be possible to have an alternate partition to /osh that's used to run from (whether it's mounted on /osh or not is largely irrelevant).
However, the problem I'm hitting up against is a matter of timing. The best entry point I've found to modify behaviour is /system/bin/mountosh when it's called by /init.rc, especially since it's responsible for most of the webtop setup. The catch is that by the time mountosh is called, the only partitions mounted are through p16, meaning that internal storage (p18) isn't available and the SD card (mmcblk1) isn't available either, meaning that there's no way to use either (a loopback file on the former, a partitioned SD card for the latter). I suppose it would theoretically be possible to create a loopback file on p16 (data), but that's only 2 GB and would conflict with other uses.
Does anybody know how to force internal storage and/or the SD card to be mounted earlier? Or is this going to require hacking a kernel (and bootloader and...) that we don't have the source code to yet? If I can get past this piece, then I'll be able to help other users get a webtop that would be in much better shape (especially since this would let us start using apt without having to worry so much about space issues). Thanks!
I am not sure off hand at the moment, but you might have a look at /etc/fstab and see if you can have the sdcard mounted earlier there. While having it mounted earlier may have some unexpected side effects; I presume the driver for the sd card reader is compiled into the kernel, so I don't see a reason it can't be mounted earlier.
But, not having an atrix anymore I can't test this outright.
Fenny said:
I am not sure off hand at the moment, but you might have a look at /etc/fstab and see if you can have the sdcard mounted earlier there. While having it mounted earlier may have some unexpected side effects; I presume the driver for the sd card reader is compiled into the kernel, so I don't see a reason it can't be mounted earlier.
But, not having an atrix anymore I can't test this outright.
Click to expand...
Click to collapse
/etc/fstab is pretty meaningless, unfortunately. Most of the mounting is performed within /init.rc, and I see no entries for the external storage there. As it stands, the entry for the internal storage is more in the format of "on X, do Y" rather than the more traditional procedural format, so I'm not sure how much control I can have over that.
Also, second thoughts tell me that putting a filesystem file in /mnt/sdcard would be stupid, because it would cause all kinds of issues when attempting to USB mount the partitions from a computer.
I think the best way to attack this would be to pivot to another filesystem structure on the external sdcard. I'll take a look at init.rc later today and see what can be done.
agentdr8 said:
I think the best way to attack this would be to pivot to another filesystem structure on the external sdcard. I'll take a look at init.rc later today and see what can be done.
Click to expand...
Click to collapse
So you'd think. And that's what I did. I have a nice 2 GB ext3 partition on my SD card with the contents from the /osh partition (p13) rsync'ed over. But, only the mmcblk0 partitions are available when mountosh runs (up through p16), with no mmcblk1 partitions. Naturally, /dev/block/vold is empty as well.
I might need to poke some contacts to see if it's possible to detect mmcblk1 earlier, but in the meantime, I might just create a filesystem file in /data (p16). Hell, /data is almost 2 GB large, and I'm only using a little over 500 MB in it, so there's plenty of free space there. Why did they make it so large? Do people really download that much crap to their phone?
Grr...
So, even creating a file in /data and mounting that via loopback doesn't work, even if it's mounted on top of the existing /osh partition. I'm guessing that they have some level of verification.... So yeah. Something else is missing here.
I had two sucessful ways of overcoming this. The first way was to move /usr onto /data, and to symlink it back. But, I wanted a way of not modifying /osh, so I ended up creating a init.d script to bind a copy of /osh over /osh. I don't have access to a dock or HDMI monitor at the moment, so I can't confirm if the webtop launches with either of these methods, but full functionality worked in the command line.
shawnbuck said:
I had two sucessful ways of overcoming this. The first way was to move /usr onto /data, and to symlink it back. But, I wanted a way of not modifying /osh, so I ended up creating a init.d script to bind a copy of /osh over /osh. I don't have access to a dock or HDMI monitor at the moment, so I can't confirm if the webtop launches with either of these methods, but full functionality worked in the command line.
Click to expand...
Click to collapse
Yeah, that's the thing. Everything worked on the command line, but X itself refused to start, even after I completely disabled TOMOYO (even when running /etc/init.d/startX.sh by hand).
I might decide to poke at it another time, but I'll at least wait for the SBF situation to sort itself out first.

[Q] KitKat Partitioning Issue

At the risk of sounding like a complete n00b, I come to you all with an issue I'm experiencing. I know it's an operator error, so bear with me;
I just recently flashed Milaq's KK build. I increased the /system partition using the new CWM w/ data/media to 512 mbs. Everything is running well, but all the apps I install are installed to the internal memory, which maxes out around 1.4 gbs. My question is, how do I make the default install location the virtual ext SD card?
I hope this makes a bit of sense to you all - because I'm about to pull my hair out here.
Thanks for any/all input on my current situation.
I understood the partition/directory structure in my previous CM7/CM9 installs.
But with the new datamedia storage configuration I'm confused to all the various labels for the memory storage areas.
I've read the document at http://teamw.in/DataMedia
but the situation is still not very transparent.
• Under Android settings I see "Internal Storage" and "SD Card" and "USB Storage".
• In ES File Explorer I observe:
/sdcard ->
/external_sd -> /storage/sdcard1
/usbdisk -> /storage/usbdisk
/storage/emulated
/storage/sdcard0 ->
/storage/sdcard1
/storage/usbdisk
• In X-plore I also observe:
/storage/0
/storage/legacy
• CM File Manager app top level directory is labeled as "0":
It appears there is various crossover in directory mappings. Is there a definitive guide as to the partitions, directory structures/mappings and symlinks that apply to the above memory areas. There is already enough contradictory posts in various development threads on this so not asking for assumptions/presumptions. Hoping to hear from an expert/developer who knows this stuff on back of their thumb.
And what controls/manages where new apps are installed?
Good Question I also would like to know
While looking around the internet, I found this as a potential option;
In terminal;
su
pm set-install-location 2
I attempted it, but haven't noticed any difference.
/bangshead/
Stryeguy said:
While looking around the internet, I found this as a potential option;
In terminal;
su
pm set-install-location 2
I attempted it, but haven't noticed any difference.
/bangshead/
Click to expand...
Click to collapse
I think you are looking at this wrong. Instead of making Android use the external storage by default, you just need to make the data partition bigger and use that as your default storage. Milaq himself suggested this partition layout:
system - 600mb
cache - 200mb
media - 400mb
data - [remaining space] (i.e. ~11.5gb for 16gb TouchPads)
If you are going to go with Milaqs builds, The best way to do it is to move all your stuff from your sd card to your computer, wipe your sd card, use tailor in webOS to repartition to match what Milaq suggested and move all your stuff back onto your device in, I think, the sdcard0 folder (which should now have the majority of the space).
jsgraphicart said:
I think you are looking at this wrong. Instead of making Android use the external storage by default, you just need to make the data partition bigger and use that as your default storage. Milaq himself suggested this partition layout:
system - 600mb
cache - 200mb
media - 400mb
data - [remaining space] (i.e. ~11.5gb for 16gb TouchPads)
If you are going to go with Milaqs builds, The best way to do it is to move all your stuff from your sd card to your computer, wipe your sd card, use tailor in webOS to repartition to match what Milaq suggested and move all your stuff back onto your device in, I think, the sdcard0 folder (which should now have the majority of the space).
Click to expand...
Click to collapse
Thank you for your response - it was exactly what I was looking for. I knew I was overlooking a step.
I'll get around to doing that tonight.
Again, thanks so much.
:cheers:
I had the same question. But I just used tailor to resize the partitions. If it says file system error, let it fix it. As long as there are free space, all your files will stay.
Just posting a follow up;
Installed Tailor and repartitioned as per Milaq's instructions, and everything is working as it should be.
Thanks for the help, guys. Glad to know it was just my reading skills that were lacking.

Can we repartition to make swap?

I've been thinking about this for a few days now. Then, today, xda posted an article on repartitioning the Xperia to gain some advantage. So it seems like a good time to pose this question for us HD+ owners.
This a "feasibility study" question. I'm not a developer. I can hardly hack my way though Mint, let alone the HD+. I'm asking if the following possible?
(If yes, maybe a nice developer will do it for us? )
Can we shrink and repartition the /factory partition in the HD+ (as they shrink partitions in the Xperia) and use the leftover space as /swap?
Background
I've been reading leapinlar's excellent treatises on the partition structure in the HD+ (see Item 16) and how the /factory partition, meant for automatic disaster recovery, doesn't do us much good if you've installed a custom ROM and a custom recovery. (See all of Item A12.)
Among other things, the /factory partition contains an image of the stock B&N ROM. Which will cause bootloops if triggered when you're running CM.
But, if I understand it correctly, the /factory partition isn't a total waste. It duplicates some important data from the /rom partition (devconf), which could come in handy IF you put the stock recovery back on in an attempt to fix your HD+. (Then it could rebuild the /rom partition if it had become corrupted.)
So, as it stands now, /factory is 448 MB that's mostly useless to us. Can't we put it to good use? Like /swap? Or direct zRAM to it?
Leapinlar has already created some repartitioning tools, as has the Xperia dev now. So I'm hoping a lot of the hard work has been done already.
Proposal
(I apologize in advance is my terminology isn't exactly correct.)
Is it possible to:
1) remove the factory.zip from the /factory partition and then shrink the partition to accommodate only the /rom backup files. (I'm thinking that all factory zips are the same size, so once the new smaller partition is calculated, it ought to be the same for everyone's HD+);
2) create a new partition from the left over space, calling it (new) partition #11;
3) format partition #11 as swap
4) easily tell CM 10 or CM 11 to use the /swap? I'm hoping this can be done with just a init.d script. (Maybe an fstab tweak too?)
5) Or perhaps dedicate #11 for zRAM, as a kernel developer has done with useless space in the Galaxy Tab 2. In essence, we'd have almost 1.5GB of RAM.
Feasible? Yes/No? I realize that dinking with partitions can damage my HD+. It's a risk I'm willing to take.
I'm not going to get involved with this, I'm just going to add a warning. The partition structure for the HD/HD+ is different than the Nook Color and most other devices. The NC and other devices like SDs use DOS partitioning. The HD/HD+ is like the Nook Tablet that uses GPT partitioning. The two partitioning schemes are not compatible. So don't try to use my tools in the NC forum. If you want to know more about GPT partitioning on the Nook Tablet and get some tools, search the Nook Tablet forum.
Sent from my BN NookHD+ using XDA Premium HD app
leapinlar said:
The partition structure for the HD/HD+ is different than the Nook Color and most other devices. The NC and other devices like SDs use DOS partitioning. The HD/HD+ is like the Nook Tablet that uses GPT partitioning. The two partitioning schemes are not compatible.
Click to expand...
Click to collapse
Good to know! Now we have more data than we had before.
Looks like a lot of the work has been done already
So, I found this thread in the xda forums all about nook tablet partitions. They even talk about resizing! (Or at least, about making a different size /userdata partition.)
There is also this here about repartitioning Nook partitions.
Looks like parted would be easier for what I'm looking to do, shrink the /factory partition and create a new partition.
I read here that I can use a live Linux CD to mount the factory.img. From there, I presume I can delete the factory.zip and create a new image?
I'm not a linux geek, but I presume I need to be on a live Mint CD to use parted in ADB? (Update: Apparently I am to use the Android SDK for ADB in Windows. Downloaded already. Am climbing the steep learning curve.)
First half of Step 1, Done
Well, it took longer than it should have, but I made a new, smaller factory7.partition.img file. It's 1 MB.
I started by booting a Mint 16 Live CD.
Then I mounted the OEM factory partition image I made beforehand using the dd command, per leapinlar's instructions. (See his Item 16.)
Code:
sudo mount -o loop partition7.factory.img {some.folder}
That image contained 4 zips: factory,zip; fsck.zip; rombackup.zip; romrestore.zip.
Dummy me, I tried deleting the factory.zip inside the mounted image. It occurred to me later that that would be like trying to delete a file from a mounted CDROM's iso image. Can't be done.
So I copied the 4 zips to a new folder. Then I could deleted factory zip, which was 433.3 MB.
That left less than 1MB for the other 3 zips.
If there's an elegant way of modifying an .img and resaving it, I couldn't find it. (I spent a lot of time with mkfs.yaffs2. But this .img was not a yaffs.(Didn't pass a "sanity check" when I tried to mount the new .img I had made with mkfs.yaffs2.)
So I brute forced an imaging solution by copying the 3 copied zips to a 1MB ext4 partiton on a USB stick. (I made the partition with gparted and used chmod 777 to clear permissions in the partition.)
Then I made an image of the new 1MB partition using the dd command. In my case
Code:
sudo dd if=/dev/sdd2 of=new.partition7.factory.img
(I probably don't have the leading /'s right here. Am truly hacking my way through all this. I'm sure most of you could do this whole project in a few minutes.)
So now I have a shiny new 1MB custom factory image just wating to be used.
Update: I think I'll redo this, and leave 4 zips, in case the recovery mechanism is looking for a "factory.zip" I'll made a dummy file and archive it, calling it "factory.zip."
The next task is to get ADB working, delete the original large partition7 in the HD+, create a new 1MB partition7 in its place, and then restore my new image to partition 7 using the dd command in reverse.
After that, then to create partition11 out of the unallocated 432MB and format that as swap.
Update: It occurs to me that I will have to backup partitions 8, 9, and 10 with dd. Then I'll have to destroy them, recreate them in new locations, and then restore them. Fortunately, an xda developer has already written the instructions on how to do all this.
I see that CM 10 supports swapon, so I'm hoping it will be downhill after the partition work. I'm hoping CM will automagically find the new swap partition, once I enable swap.
If you know different, I'd appreciate hearing from you. Will using swap in this memory burn the memory out quickly?
Better yet, swap file instead of swap partition
So, I was thinking more about this idea and how I'd have to destroy and recreate p8, p9 and p10 to make a new swap partition at p11. Aside from that being a lot of work and more prone to errors with all those operations, a new p11 would never get TRIM'd by the OS.
So now the plan is to reduce /factory (p7) to 1MB and increase /system (p8) by 443 MB. Then I'll put a swap file in /system.
Only have to work on two partitions that way and /system gets TRIM'd. (Or at least Lagfix will trim it.)
Whatdaya think?
I suppose it's easy enough to put a swap file in /data to get a feel if there's any performance gain from swap in eMMC. Someone wanna show me the code to do this? (I've read about how to create a swap file. Not sure how to mount it at emmcblk10.) Never mind, Found it on xda! Am currently running 500MB swap on /data to see what it's like.
PMikeP said:
So, I was thinking more about this idea and how I'd have to destroy and recreate p8, p9 and p10 to make a new swap partition at p11. Aside from that being a lot of work and more prone to errors with all those operations, a new p11 would never get TRIM'd by the OS.
So now the plan is to reduce /factory (p7) to 1MB and increase /system (p8) by 443 MB. Then I'll put a swap file in /system.
Only have to work on two partitions that way and /system gets TRIM'd. (Or at least Lagfix will trim it.)
Whatdaya think?
I suppose it's easy enough to put a swap file in /data to get a feel if there's any performance gain from swap in eMMC. Someone wanna show me the code to do this? (I've read about how to create a swap file. Not sure how to mount it at emmcblk10.) Never mind, Found it on xda! Am currently running 500MB swap on /data to see what it's like.
Click to expand...
Click to collapse
I guess this is a dumb question, but if you can put a swap file in /system and /data, why can't you delete the factory.zip from /factory and put the swap there? Why create a new partition?
Sent from my BN NookHD+ using XDA Premium HD app
leapinlar said:
I guess this is a dumb question, but if you can put a swap file in /system and /data, why can't you delete the factory.zip from /factory and put the swap there? Why create a new partition?
Click to expand...
Click to collapse
First, I'm abandoning my bright idea. Turns out that swap is slow (even on eMMC) and possibly destructive to the eMMC with all the writes. (Hmmm . . . I wonder how many writes /cache gets compared to a swap file? (IOW, would a swap file be any more destructive than cache is?))
There were 1 second pauses every now and then, presumably while swapping when I had a swap file mounted in /data. Even tho I could get more free memory with a swap file than with zRAM, zRAM is much faster. And since zRAM is supported by the OS, it's the path of least resistance for me.
But to answer your question, it's not a dumb question. I'm a dumb user.
First, I don't know how to mount the /swap on the /factory partition. Can it be done? I don't see /factory in root explorer when running. Whereas I can see /system and /data. (So, to use Windows talk, it seems like /factory is "hidden" when running the OS?) By the same token, I don't know if I can delete the factory.zip from /factory in situ. If it can be done, it probably requires ADB and fastboot (?). But I haven't learned about those yet. So I'd have to use my new image trick, from my post above, to "delete" factory.zip from /factory.
Second, even if I could mount a swap in /factory, I don't think I'd want to. (Although I agree it's be a lot easier (and less dangerous) than deleting and recreating partitions.) I don't think /factory gets TRIM' by the OS. And I presume I would want it TRIM'd every now and then or else the swap would get slower over time than it already is.
I notice that Lagfix offers to trim /system and /data (and /cache). But not /factory. As above, if /factory is not visible during operation of the OS, that would be one reason why Lagfix doesn't trim it.
Or it could simply be that Lagfix doesn't see the need to trim /factory. Since /factory is supposed to be static, there wouldn't be any reason for Lagfix (or CM) to trim it.
Whether /factory can be trimmed with the fstrim command while running, I don't know.
Anyway, my idea for swap wasn't such a good idea. So I've abandoned the idea.
It still bugs me, as an engineer who compulsively tries to optimize everything, to carry that wasted 443 MB around in /factory.
I don't think we need an extra 443 MB in /system or /data. (Or /cache.) But if we ever do, we know where to find it.
/factory is not automatically mounted in stock or CM. So to get access to it you would need to mount it with a script command. And I would assume you need script commands to set up /swap so that should not be a problem. But /factory is formatted fat32 and /data and /system are ext4 so that might interfere too.
And manual trim commands can be run to trim the mounted /factory. You don't need the app lagfix to do it.
But I agree, I'm not really sure you gain anything with swap on this device.
Edit: as PMikeP pointed out to me in a PM, I was mistaken. /factory is ext4, not fat 32. Thanks for the correction. That should make it easier.
Sent from my BN NookHD+ using XDA Premium HD app

Making an exact copy

Hey everyone.
So a few days ago I unfortunately dropped my nexus 6, destroying the screen. It's fully blacked out with no sense of touch. That's what I get for not using a case right. Anyway, I am looking to order a new one very soon and I would like to be able to pick up exactly where I have left off. Because the phone is in completely working condition besides the screen (Proven by using airdroid, android control and adb, as well as my lightflow and everything acting normally) I was wondering what I need to do to be able to put everything onto my new phone. What I think I need to do is run a TWRP backup of system, data, and boot by using the command line, as seen here. After that, I believe I need to use the adb pull command. Once that is all done, can I simply put TWRP onto my new devices, restore the backup, use adb push to replace the contents of my /sdcard partition and boot up as if it were the old device? I think I have it figured out here but, I wanted to run it by the smart people of xda. A couple of notes, although I assume it is irrelevant, are that I am running the PureNexus Project ROM, Elementalx on 6.0.1 unlocked.
Thanks,
TriguyRN
And I'm sorry everyone, this was meant to be put in the Q and A section :/
triguyrn said:
And I'm sorry everyone, this was meant to be put in the Q and A section :/
Click to expand...
Click to collapse
You would be best advised not to do that. You could mess up your device alot to the point of bricking it. If you back up anything only back up the data partition as that is where your apps are.
zelendel said:
You would be best advised not to do that. You could mess up your device alot to the point of bricking it. If you back up anything only back up the data partition as that is where your apps are.
Click to expand...
Click to collapse
agreed you can probably get away with a /data restore after reinstalling your rom but transplanting /system or boot partitions could easily go south. Best to reinstall purenexus with the zip.
zelendel said:
You would be best advised not to do that. You could mess up your device alot to the point of bricking it. If you back up anything only back up the data partition as that is where your apps are.
Click to expand...
Click to collapse
So if I understand this correctly, /data contains my appdata and that apps themselves, while /sdcard contains some extra documents etc. correct? Assuming yes, then I should back/restore up the data partition in TWRP and selectively movie around some folders from my /sdcard backup to my new device. Thank you for the advice and moving my thread.
triguyrn said:
So if I understand this correctly, /data contains my appdata and that apps themselves, while /sdcard contains some extra documents etc. correct? Assuming yes, then I should back/restore up the data partition in TWRP and selectively movie around some folders from my /sdcard backup to my new device. Thank you for the advice and moving my thread.
Click to expand...
Click to collapse
if you backup /data you'll have all your apps and internal storage files. /sdcard is just a shortcut pointing to /data/media/0 which is where your documents and whatnot are actually stored.
StykerB said:
if you backup /data you'll have all your apps and internal storage files. /sdcard is just a shortcut pointing to /data/media/0 which is where your documents and whatnot are actually stored.
Click to expand...
Click to collapse
This is incorrect.
A TWRP backup of /data *does NOT* backup your internal storage. That's the reason that there's a different option.
Same way that if you wipe /data it doesn't erase your sdcard (internal storage, we don't have sdcards).
You are correct though, /data/media/0 is *technically* where the internal storage is located. However a /data backup will not back this up as it traditionally skips the /data/media directory completely to prevent crazy issues on devices without a true sdcard.
Think about it.
You have 32gb of device storage. Let's say you have a ton of music, movies, documents and such on your internal storage/sdcard totaling 15-20gb. Even with a full /system, /data, /boot backup... it averages about 3-5gb. There's no way that it's getting that level of compression and backing up the 15-20 gb of stored files you have.
On top of that, it would have to include the backed up backup in the backup since it was also on internal storage, casuing a cycle that would simply fill up the device before failing due to a lack of free space.
Realistically, the only way to backup the internal storage is by using a usb-otg device as the target. Or by manally copying everything from there off to a computer.

Categories

Resources