I was trying to recover files from android phone using adb shell and test disk. But I am getting a read only filesystem error, even though the permissions to write is granted to the user.
adb deviceslist the device attached. After I ran the following commands
adb shellInside the shell I did the following
user:/ $ su
user:/ # adb shell "stty raw; cat </dev/block/mmcblk0p56" > data.img
sh: can't create data.img: Read-only file systemHow to solve this?
Update
Trying the proposed solutions:
$ sudo adb shell "stty raw; cat /dev/block/mmcblk0p56" > /home/user/android-backup/data.img
stty: tcgetattr standard input: Not a typewriter
cat: /dev/block/mmcblk0p56: Permission deniedMounting code:
$ sudo mount -o remount,rw /dev/block/mmcblk0p56 /tmp
mount: /tmp: mount point not mounted or bad option. 2 Answers
You can try to remount the file system with read and write permissions (source):
sudo mount -o remount,rw /partition/identifier /mount/pointOr in your case you just can tray to redirect the output to a file located in a directory where you must be able to write:
adb shell "stty raw; cat </dev/block/mmcblk0p56" > /tmp/data.img 5 Are you trying to copy the block device to an image file on your local computer? If so, try:
adb shell su -c '"stty raw; cat < /dev/block/mmcblk0p56"' > data.img