Shrikant Tudavekar
Shrikant Tudavekar

Reputation: 1509

How can I copy the contentsof data/ to sdcard/ without using adb?

Hi I need to copy/move the contents of data/tombstones to sdcard/tombstones

I'm using the command below:

mv data/tombstones /sdcard/tombstones

"failed on 'tombstones' - Cross-device link"

but I'm getting above error.

Upvotes: 26

Views: 24068

Answers (2)

Dheeraj Bhaskar
Dheeraj Bhaskar

Reputation: 19039

You have a SANE VERSION of the mv command

paraphrasing a few bits from lbcoder from xda and darkxuser from androidforums

"failed on 'tombstones' - Cross-device link"

It means that you can't create a hard link on one device (filesystem) that refers to a file on a different filesystem.

This is an age-old unix thing. You can NOT move a file across a filesystem using most implementations of mv. mv is not made to copy data from device to device, it simply changes a file's location within a partition. Since /data and /sdcard are different partitions, it's failing.

Consider yourself fortunate that you have a SANE VERSION of the mv command that doesn't try anyway -- some old versions will actually TRY to do this, which will result in a hard link that points to NOTHING, and the original data being INACCESSIBLE.

The mv command does NOT MOVE THE DATA!!! It moves the HARDLINK TO THE DATA.

If you want to move the file to a different filesystem, you need to use the "cp" command. Copy the file to create a SECOND COPY of it on a different filesystem, and then DELETE the OLD one with the "rm" command.

A simple move command:

#!/bin/bash
dd if="$1" of="$2"
rm -f "$1"

You will note that the "cp" command returns true or false depending on the successful completion of the copy, therefore the original will only be removed IF the file copied successfully.

OR

#!/bin/bash
cat data/tombstones > sdcard/tombstones
rm data/tombstones

These script can be copied into some place referenced by the PATH variable and set executable.


Different Interface

If you need a different interface from adb you may move files using the FileExplorer in DDMS View.

Side note:

You can move a file into a folder when:

  • You're root;
  • It is your app directory;
  • You've used chmod from adb or elsewhere to change permissions

Upvotes: 37

samuel.zzy220
samuel.zzy220

Reputation: 113

Basically you don't have permission to access /data/tombstones in a production version . It seems we have to 'root' the device first. But I failed to root my Samsung S4 which is using Android 4.3

Upvotes: -4

Related Questions