1

is there some way to automatically move /data/log files to sdcard? may be some application or shell script that we can run with a click of a button with super user mode on rooted device? or may be some application I cant find?

or may be that folder could be linked directly to sdcard? how safe is that?

reason: free up internal space (yes, I already have link2sd and almost everything is already at sdcard, less critical apps; the focus is /data/log)

device model: samsung galaxy Y android: 2.3.6

  • 1
    Have you tried symlinking it? I.e. create a directory on your sdcard, move existing files over, delete /data/log and symlink the sdcard directory over (e.g. ln -s /mnt/sdcard/logs /data/log)? – Izzy Jul 9 '13 at 20:09
  • I wonder if there may have side effects, like in case I remove my sdcard, if I still will be able to make calls and run my critical apps? will the /data/log symlink be replaced by a real local folder automatically? – Aquarius Power Jul 10 '13 at 0:33
  • Well, you use Link2SD as you wrote. Same issue there, I'd say. Apart from that: I guess in the worst case you will lack some logs, and the "logging app" might crash when trying to log. I don't think the symlink will automatically be replaced by a directory, though it's not impossible. – Izzy Jul 10 '13 at 5:47
1

If your device is rooted, you can try creating symbolic link from the folder to SD Card (this is essentially what Link2SD does to apps, with prettier interface) using the Terminal Emulator.

Helpful Commands (disclaimer: untested, use at your own risk, make sure you understand exactly what the commands does before running them)

  1. Get root su
  2. Copy the folder to sdcard cp -r /data/log/ /path/to/new/folder
  3. remove the original folder rm -r /data/log/
  4. Create symbolic link use ln -s /path/to/new/folder /data/log
  5. Reboot and test. Until you reboot, old processes may still own a handle to the old files even though it had been removed from the filesystem.

Note though, /data/log generally should not use too much space, so moving this folder likely won't save too much space. If you have an unusually large log directory, you might want to investigate that instead of moving the log directory.

| improve this answer | |
  • my /data/log has 30MB, but my internal memory has 170MB, so that is a lot! I know what these commands do, but I wonder if there may have side effects, like in case I remove my sdcard, if I still will be able to make calls and run my critical apps? will the /data/log symlink be replaced by a real local folder automatically? – Aquarius Power Jul 9 '13 at 20:34
  • 1
    I don't know for sure about the contents of /data/log but I would recommend that when you start relocating any system partitions to the SD card that you resolve not to eject it with the phone on. – Mr. Buster Jul 10 '13 at 0:49
  • 1
    @AquariusPower: If you remove your SD card, some programs may still run for some time and be able to write to their own IO buffer but they will most likely crash if they tried to flush to disk. As far as I know, there is no way to swap file handles that are already opened by a process to a different file (doing such thing would be like pulling a rug under your feet), so you may need to restart processes that have open files in the directory. But as Mr. Buster said, if you want to move this directory to SD card, you really should commit to not ejecting the SD card while the phone is on. – Lie Ryan Jul 10 '13 at 5:05
  • @Mr.Buster I just thought, as I remember, writing to an umounted path will write on the local media (of that path), but as soon you mount it, the writing will happen on the mounted media; so I think, if we mount a loopback file from sdcard at /data/log apps will append to logs even when the sdcard is removed? I mean, even if logs get messed, at least apps will not crash? – Aquarius Power Feb 16 '15 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.