Hi, i was just wondering what, if anything, is supposed to be in the /data directory on my g1...i dont have anything in my data folder at all, and i think maybe there should be, im not sure, but i wouldnt put it past me to mess something like this up...i downloaded an app called logcat that does just that, it runs logcat and you can save the results...i thought it was supposed to save to the sdcard, but then it said it was saving to /data/data/blah blah blah...so i went into my sdcard and theres no /data folder there, but theres nothing getting saved to the /data directory on my phone...so im not sure if its not saving, or if im just looking in the wrong place. I had moved my caches to my sdcard, has that anything to do with this? Did i delete stuff i wasnt supposed to? This isnt the first time ive thought i messed this up, and its making me paranoid! help!
when you browse into that directory you can't see anything if you are using a file manager, do the following in adb shell or terminal emulator:
ls /data (that shows you what is in your /data)
then you can browse using the shell, there are loads of files in /data but you just can't see them so you can't delete them and screw your phone up(did it once just to see what would happen, the phone crashed)
I do think you are confused. The /data you refer to is a partition, not a directory. You have
/data
/system
/sdcard
/dev
/cache
To see what is in your /data partition you need to use terminal emulator (or ADB shell with your PC) and do a "cd /data/data/blah blah blah" replacing blah blah blah with the actual directory name you need to get into.
Related
When ever I do a nandroid backup i partially backup my system as my "apps" "apps-private" & dalvik-cache" folders are on my /system/sd partition ( /dev/block/mmcblk0p2 ).
To fully backup i need to somehow backup my "/system/sd" along with my nandroid backup.
Now If i copy all the stuff to "/sdcard" I loose all my file permissions, so its not an option.
One option is to use "dd" command which will say something like this
Code:
dd if=/dev/block/mmcblk0p2 of=/sdcard/nandroid/SDBACKUP.img
( the final-full script will generate today's date-time for name etc. etc. )
what will be achieved with this, is that it will create an exact binary copy of the EXT3 partition maintaining all the permissions etc. in that point of time. with same "dd" command you can re flash this img file back to your EXT3 partition.
It all sounds good, but there is a problem and I need someone to help me out here. currently the "dd" which is available in busybox is crippled as it can only handle File->File (byte wise) copy and No Partition -> File or vice-versa .
If anyone out there has a proper build environment ready for building binaries for android( I dont have it set up ) and can build full "dd", I'll be really thankful. you can find dd in GNU Fileutils(If you can build stuff for linux you know where i am pointing you).
If someone has any other ideas to achieve this please comment.
you can do that with adb.
Adb pull /system/sd/* c:\
Or use the ADB File explorer
Then just adb push it back when you need it
why don't you mount /system/sd and /sdcard from recovery and do 'cd /system/sd && tar czpf /sdcard/ext-backup/`date +%F-%I.%M`.tar.gz *'. This backup will be much smaller than your 'dd' backup.
eventually, its needs to be built into nandroid backup.
Seems lovely!
What are the commands to restore this backup (devsk)?
devsk said:
why don't you mount /system/sd and /sdcard from recovery and do 'cd /system/sd && tar czpf /sdcard/ext-backup/`date +%F-%I.%M`.tar.gz *'. This backup will be much smaller than your 'dd' backup.
eventually, its needs to be built into nandroid backup.
Click to expand...
Click to collapse
Any reason we couldn't do this with a command from BetterTerminal or a script from GScript? Looks like you could backup without remounting, but would need to remount r/w to do a similar script to restore from the backup.
Could someone with some programming chops (devsk??) type out the necessary commands for the doing backup and restore from terminal? I would do it, but my skill with linux is not up to it.
Backup for Root Users does this really well. If you choose to, it will back up both the apks and the data associated with the applications so you don't lose any save game progress or preferences and will save it on Fat32 partition of your sdcard so you can just transfer it to your computer for a more secure backup.
Zappza said:
Seems lovely!
What are the commands to restore this backup (devsk)?
Click to expand...
Click to collapse
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/<gzip_file_to_restore>
You need to change <gzip_file_to_restore> to the actual file name which you want to restore e.g. if you want to restore 2009-07-23-06.04.tar.gz to your ext partition, you would do:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/2009-07-23-06.04.tar.gz
This will restore the ext partition backup I took at 6:04pm on 23rd Jul. This code assumes that you have your ext partition mounted on /system/sd and fat32 partition mounted on /sdcard already. If not, you need to say 'mount /sdcard' and 'mount /system/sd' before the above.
Remember that the safest way to backup and restore filesystems is through the recovery console. So, I do a nandroid backup followed by the above tar czpf ('c' is for create) command to backup. This puts my complete backup on the first fat32 partition. Then, I do the reverse (restore from nandroid backup, and fire the above xzpf ('x' is for extract) command to restore my ext partition) to restore a ROM to its working condition.
Thanks this does seem a far better approach . I'll try it and update
My_Name_Is_Neo said:
Thanks this does seem a far better approach . I'll try it and update
Click to expand...
Click to collapse
It is dog slow though! All because of the CPU not able to handle the compression from gzip. It compresses nicely and produces a smaller gzip file but takes a while.
I like where this thread is headed...
subscribed, can't wait to see where this goes.
devsk said:
It is dog slow though! All because of the CPU not able to handle the compression from gzip. It compresses nicely and produces a smaller gzip file but takes a while.
Click to expand...
Click to collapse
I noticed! At first I thought that it did not work at all. Is it possible to disable the compression?
I think removing the "z" from the command and naming the file .tar instead of .tar.gz will not compress it.
My_Name_Is_Neo said:
I think removing the "z" from the command and naming the file .tar instead of .tar.gz will not compress it.
Click to expand...
Click to collapse
that's right. Backup will be faster but bigger. I am looking at another command to see if we can pass a -fast option to gzip.
devsk said:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/<gzip_file_to_restore>
You need to change <gzip_file_to_restore> to the actual file name which you want to restore e.g. if you want to restore 2009-07-23-06.04.tar.gz to your ext partition, you would do:
Code:
cd /system/sd && tar xzpf /sdcard/ext-backup/2009-07-23-06.04.tar.gz
This will restore the ext partition backup I took at 6:04pm on 23rd Jul. This code assumes that you have your ext partition mounted on /system/sd and fat32 partition mounted on /sdcard already. If not, you need to say 'mount /sdcard' and 'mount /system/sd' before the above.
Remember that the safest way to backup and restore filesystems is through the recovery console. So, I do a nandroid backup followed by the above tar czpf ('c' is for create) command to backup. This puts my complete backup on the first fat32 partition. Then, I do the reverse (restore from nandroid backup, and fire the above xzpf ('x' is for extract) command to restore my ext partition) to restore a ROM to its working condition.
Click to expand...
Click to collapse
Okay, so I saw this thread and decided to repartition my card to resize my ext3 partition to a smaller size and add a swap partition just in case I want to use it in the future. I've been wanting to do this for a while, but have been putting it off because I didn't want to lose all my data on my ext3. So I followed your instructions and I kept getting 'tar: empty archive' errors no matter what I tried (czpf .tar.gz, cpf .tar, cd /system/sd then tar cpf, creating the backup folder beforehand, etc.). So I did some googling and this is what worked for me. This is just an FYI for others who are having trouble with this as I was.
To backup:
mount /system/sd
mount /sdcard
tar cpf /sdcard/ext-backup/backup.tar system/sd
No compression, so it was really quick. It made a ~180mb file in a few seconds. So I opened up the resulting file in winrar and it kept the folder structure and everything e.g. system->sd->contents of sd folder. So I'm guessing to restore, the command would be like this:
mount /system/sd
mount /sdcard
tar xpf /sdcard/ext-backup/backup.tar
I say I'm guessing because I ended up not needing to restore it. I was able to preserve the data on my ext3 partition after the resize. I did however end up having to format my fat32 partition, but I did a backup on that too.
BTW, I'm on Cyanogen's modded recovery.
you got "empty tar" error because you 1. Either forgot to mount /system/sd OR 2. you forgot the '*' towards the end of the cpf command.
You 'tar xpf ..." command is correct for the 'tar cpf ...' command that you typed above.
Note that you need to be in the right directory while creating the backup and restoring it.
test this last commands and it work well, forgot to mention that was made it thru recovery console, hitting the commands with my PC in CMD.
Thanks for the ideas and discussion in this thread... been wanting to set up something like this for a long time but was being lazy.
Have you guys had any luck with the '--exclude' switch on the tar binary that we've got (busybox link, looks like... at least with the Cyan mod that I'm using)?
I haven't done enough testing but it seems like the '--exclude' switch doesn't do anything/is ignored... I was trying to do something like this to ignore the dalvik-cache directory from my backups but it still includes it in the .tar.gz file:
Code:
cd /system/sd && tar czpf /sdcard/backup/systemsd_$NOW.tar.gz --exclude='/system/sd/dalvik-cache' *
(I am setting $NOW to the datestamp string I want with "NOW=`date +"%Y%m%d-%H%M"`" in my shell script)
I haven't tried the '-X' switch with an exclusion file list yet so I might give that a shot but was just trying to see if others played around some more with any of this stuff, etc.
rub1k said:
Thanks for the ideas and discussion in this thread... been wanting to set up something like this for a long time but was being lazy.
Have you guys had any luck with the '--exclude' switch on the tar binary that we've got (busybox link, looks like... at least with the Cyan mod that I'm using)?
I haven't done enough testing but it seems like the '--exclude' switch doesn't do anything/is ignored... I was trying to do something like this to ignore the dalvik-cache directory from my backups but it still includes it in the .tar.gz file:
Code:
cd /system/sd && tar czpf /sdcard/backup/systemsd_$NOW.tar.gz --exclude='/system/sd/dalvik-cache' *
(I am setting $NOW to the datestamp string I want with "NOW=`date +"%Y%m%d-%H%M"`" in my shell script)
I haven't tried the '-X' switch with an exclusion file list yet so I might give that a shot but was just trying to see if others played around some more with any of this stuff, etc.
Click to expand...
Click to collapse
You might be interested in this thread:
http://forum.xda-developers.com/showpost.php?p=4209412
Thanks much for that... nice job with the script.
I guess I need to do a bit more reading though and figure out if backing up the dalvik-cache is actually necessary (doesn't it get (re-)built at first bootup with a new ROM?)... because if not, I'd like to not bother backing it up (and make the backup smaller and quicker in the process).
rub1k said:
Thanks much for that... nice job with the script.
I guess I need to do a bit more reading though and figure out if backing up the dalvik-cache is actually necessary (doesn't it get (re-)built at first bootup with a new ROM?)... because if not, I'd like to not bother backing it up (and make the backup smaller and quicker in the process).
Click to expand...
Click to collapse
I think you have a point. But we may be looking at a very small %age of disk space compared to the overall backup of the phone. Keep in mind that the nandroid backups are not gzip'ed (because it take them forever to do), so there are bigger savings to be had than just saving on the dalvik cache. For example, data.img in nandroid backup can gzipped to 4MB compare to 12MB.
I have a good 2 GB of space that I am unlikely to use on the /data partition. So I created an 'sdcard' directory in there. What I'm trying to do is trick the system into believing that it's a second SD card. Can android support more than one? It's all good getting the directory to work as a secondary storage place, but the problem is, media scanner will not show pictures/music that are in that directory.
So my question is, is it possible to edit the ramdisk (init.rc) or vold.fstab etc or any other files, so the system is tricked into believing it's an actual storage card? I have tried making symlinks and doing directory bindings from /data/sdcard to /storage/sdcard1, but haven't had any luck.
Edit:
something like this maybe in init.rc??
symlink /storage/sdcard /sdcard
symlink /storage/sdcard1 /data/sdcard
export EXTERNAL_STORAGE /storage/sdcard
export SECONDARY_STORAGE /storage/sdcard1
I'm sure something is possible.
The nicest thing would be to have vold bind-mount a directory or loop-mount a filesystem image, but I'm not sure vold can do that at all and if it can I don't know what the syntax for that would be.
This would probably be a bit different between sense and aosp as it looks like vold is different.
You can easily bind-mount it yourself.
Either way, if you want to mount it on (say) /sdcard2 or anywhere on the root file system, you have to edit the ramdisk in the boot image.
But you can also mount it on top of /sdcard
mkdir /data/extra_sd
mkdir /sdcard/extra_sd
busybox mount --bind /data/extra_sd /sdcard/extra_sd
( ^^^-- I found that /system/bin/mount doesn't do --bind or -o loop and that busybox mount does.)
I tried this and it works. I have not yet experimented with putting it in an init.d script or so to mount it on boot and see if mediascanner scans it.
However, using this method you may corrupt stuff when you USB-mount your sdcard onto your PC. I'm not sure.
-Jobo
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
ardax said:
Well, you could try "partitioning" the phone with LVM.
Which would actually be really interesting. I've got an extra gig of space in each of /system and /data that I'm not using. Being able to span that with /sdcard would be handy.
Actually, with that in place, you could combine /data and /sdcard into a single large partition and then just have both directories on that.
Click to expand...
Click to collapse
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
djsubtronic said:
That would be the ideal solution, which I have been hoping since day 1 becomes available from our phone, but does it not require S-OFF?
Click to expand...
Click to collapse
I don't think it should, since it's not changing the partition layout of the internal memory itself, just globbing it together and slapping virtual volumes on top with LVM. The biggest things are making sure that the kernel has LVM support and binaries built in and that recovery can get to those LVM binaries.
Perhaps I'm wrong though.
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
I really like the idea using data to get some extra space.
I tried "busybox mount --bind" via console and it works. Now i will have a look at ScriptManager.
But what happens if you are installing/updating a new ROM. Do you lose all your things located in /data?
regards
If you format /data then yes, obviously. You are only creating a "shortcut" to /data/folder.
Also, if you run out of space in /data/app/ you can move apps to /system/app instead.
I did that on my blade with a way too big /system/ partition and way too small /data/ partition
djsubtronic said:
I've actually been trying numerous ways of mount bind all day. From init.d to repacking kernels with adjusted init.rc. Nothing worked.
The only way that works is using ScriptManager to run a busybox mount -o bind command at startup. It binds a subfolder in /sdcard/music to /data/media, where I've offloaded 1.5 GB of my music. I've rebooted many times and it seems to mount on time before messing up the media storage, and now I have 1.5 G extra SD space
Click to expand...
Click to collapse
Could I get a hold of that script by chance?
Daiskei said:
Could I get a hold of that script by chance?
Click to expand...
Click to collapse
+1. Yes, please share.
One S | Xparent Blue Tapatalk 2 | Viper 1.2.1 | Bricked Beastmode
So updating a ROM without formating data partition should be no problem.
But for installing a new ROM i have to backup the folder in the data partition.
I tried to use ScriptManager, but this app seems to be bit overloaded.
After this i installed GScriptsLite.
In there i made a new script with something like this:
busybox mount --bind /data/myfolder /sdcard/myfolder
The script is not started automatically after a reboot, but after running the script via GScriptsLite the folder is mounted.
Yeah I suppose it could be difficult if changing ROMs, but I use CM only so I never worry about changing the data partition. But if I do, I just copy the /data/media folder onto my PC using adb pull, then do the wiping/flashing, and finally push the media folder back before booting the ROM.
As for the script, it's essentially just this one line:
Code:
busybox mount -o bind /data/media /storage/sdcard0/Music/Music2
I've kept the script file itself on the /data partition as well. In script manager I've set it to run the script as SU and on boot, and that's it. I've mounted it into a sub folder within Music since I use PlayerPro and it only adds music found within /sdcard/Music.
Yes, ScriptManager is a lot more complicated than GScripts, but it always mounts it automatically on boot so saves the hassle of having to remember to manually run the script if you ever reboot. Plus you only have to sort it out once then never open the app again if you don't want to
I am exploring a bit on my Android device and I can't seem to figure out when `/data` is mounted.
My first guess what it'd be in `/init.rc`, and while that file creates the /data directory, it doesn't seem to actually mount it. I've also taken a look in `/system/etc/init.d`, but going from the files there, `/data` is already mounted at that point.
When is `/data` mounted, and where can I find the related script?
I have a Galaxy GIO, which is a fairly old low-end phone. On factory reset, I have about 100MB memory free for apps, and the phone seems to start complaining as soon as I hit the 50MB mark; that's about one or 2 installed applications.
Because I would like to actually be able to, well, use my phone for anything else than calling, I want to move the /data partition to my SD card. I know this'll be slow, but slow still is better than not working at all.
I have done a bit of research, and came around plenty of scripts which claim to mount the second partition of the sd card as /data; none of these scripts work. I have tried 'INT2EXT', 'D2EXT', and I've heard about something called 'A2SD' but I have yet to find a copy of it . To install these scripts I've extracted them, and copied the scripts to '/system/etc/init.d/', after mounting '/system', using ADB.
I for an instant thought maybe my second partition isn't formatted properly, but using adb I am able to successfully mount the ext2 partition as /sd-ext, so I don't see why mounting them as /data should be a problem.
I have also tried to symbollicly link /data to /sd-ext/data and automatically mount my /sd-ext on boot. Obviously this didn't work, because the symbolic link isn't actually saved to disk.
How would I go about moving my data partition to my sd card? I am not affraid of doing some dirty work manually. I am running Cyanogenmod 11.
Binero said:
I have a Galaxy GIO, which is a fairly old low-end phone. On factory reset, I have about 100MB memory free for apps, and the phone seems to start complaining as soon as I hit the 50MB mark; that's about one or 2 installed applications.
Because I would like to actually be able to, well, use my phone for anything else than calling, I want to move the /data partition to my SD card. I know this'll be slow, but slow still is better than not working at all.
I have done a bit of research, and came around plenty of scripts which claim to mount the second partition of the sd card as /data; none of these scripts work. I have tried 'INT2EXT', 'D2EXT', and I've heard about something called 'A2SD' but I have yet to find a copy of it . To install these scripts I've extracted them, and copied the scripts to '/system/etc/init.d/', after mounting '/system', using ADB.
I for an instant thought maybe my second partition isn't formatted properly, but using adb I am able to successfully mount the ext2 partition as /sd-ext, so I don't see why mounting them as /data should be a problem.
I have also tried to symbollicly link /data to /sd-ext/data and automatically mount my /sd-ext on boot. Obviously this didn't work, because the symbolic link isn't actually saved to disk.
How would I go about moving my data partition to my sd card? I am not affraid of doing some dirty work manually. I am running Cyanogenmod 11.
Click to expand...
Click to collapse
I will introduce how to COPY(NOT MOVING) /data partition to /sdcard.
1. You should ROOT First.
2. Use Rootexplorer to Copy /data to /sdcard (WARNING:If your sdcard emulated with /data, Data WON'T copy to SDCARD --You need external Sdcard!)
2-1. if you don't want to use RootExplorer, you can use Android Debugging Bridge(adb)
(Youshould download Android sdks from developer.android.com)
--Command : adb shell su -C cp /data /sdcard/data
3. That's all.
Jason Hyunwoo said:
I will introduce how to COPY(NOT MOVING) /data partition to /sdcard.
1. You should ROOT First.
2. Use Rootexplorer to Copy /data to /sdcard (WARNING:If your sdcard emulated with /data, Data WON'T copy to SDCARD --You need external Sdcard!)
2-1. if you don't want to use RootExplorer, you can use Android Debugging Bridge(adb)
(Youshould download Android sdks from developer.android.com)
--Command : adb shell su -C cp /data /sdcard/data
3. That's all.
Click to expand...
Click to collapse
Thanks, but that's not entirely what I meant. I can manage to move my data to the SD card no problem, but I want my phone to actually use my second partition on my sd card, as the /data partition.
Binero said:
Thanks, but that's not entirely what I meant. I can manage to move my data to the SD card no problem, but I want my phone to actually use my second partition on my sd card, as the /data partition.
Click to expand...
Click to collapse
Oops.. Sorry about that!
First, I am not sure that will work or not, maybe you should try to edit init.*.rc. Which is from boot.mg. I think, maybe mounting sdcard as data is impossible, but you may try editing init.rc(or init.*.rc, * is manufacture). You could unpack your boot img, and you could edit mounting point which is from init.rc!
I hope this thing will help you..
Jason Hyunwoo said:
Oops.. Sorry about that!
First, I am not sure that will work or not, maybe you should try to edit init.*.rc. Which is from boot.mg. I think, maybe mounting sdcard as data is impossible, but you may try editing init.rc(or init.*.rc, * is manufacture). You could unpack your boot img, and you could edit mounting point which is from init.rc!
I hope this thing will help you..
Click to expand...
Click to collapse
I have looked into init.rc, but that only seemed to create the /data mountpoint, but not actually mount to it. I've no idea how to edit the boot image, or what that even is. Is that the filesystem that is built into the kernel?
Binero said:
I have looked into init.rc, but that only seemed to create the /data mountpoint, but not actually mount to it. I've no idea how to edit the boot image, or what that even is. Is that the filesystem that is built into the kernel?
Click to expand...
Click to collapse
Umm.. You should download unpackbootimg or dsixda's Android Kitchen to edit boot.mg. You cannot edit init.rc on Root explore. Use unpack boot.img menu which is from Android Kitchen!
Jason Hyunwoo said:
Umm.. You should download unpackbootimg or dsixda's Android Kitchen to edit boot.mg. You cannot edit init.rc on Root explore. Use unpack boot.img menu which is from Android Kitchen!
Click to expand...
Click to collapse
I'll try that out. Still not sure where to look though. As I said, init.rc does not contain any commands mounting /data.
Binero said:
I'll try that out. Still not sure where to look though. As I said, init.rc does not contain any commands mounting /data.
Click to expand...
Click to collapse
or you could edit look at other *.rc files!
Isn't this what you're looking for?
http://forum.xda-developers.com/galaxy-s2/themes-apps/tool-directorybind-data-to-externalsd-t1410262
sndsnd said:
Isn't this what you're looking for?
http://forum.xda-developers.com/galaxy-s2/themes-apps/tool-directorybind-data-to-externalsd-t1410262
Click to expand...
Click to collapse
I want to mount my sd card to my /data. That simply creates a symbolic link.
Jason Hyunwoo said:
or you could edit look at other *.rc files!
Click to expand...
Click to collapse
There is only 2 rc files, and one of them is specific to my recovery image.
Right now I am backing up my files with adb and I have tried the following commands
adb pull /sdcard D:\[backupfolder]
adb pull /sdcard
But they just copy the internal storage folders, while what I want is to copy the stuff in the sdcard. I have tried
/storage/sdcard0
/storage/sdcard
/storage/0
/disk (it is how the folder is called in my phone)
but none of them exist.
Can anyone who has backed up their sd card on a Poco X3 tell me the actual storage path to use in adb? Thanks!
You can't.
Cuz SD card is always some strange digit number.
Try to enter ADB shell and then use the ls command to list all folders.
It should be in Mount or mnt
/sdcard is usually a chain of links that is not followed by ADB.
You need to:
Code:
$ stat /sdcard
And it will tell you where it points to. Then you stat that and keep on going until you stat something that is a real directory.