Open kaueraal opened 7 years ago
AFAIK the right thing here would be to use $TMPDIR instead (likely /var/tmp) which normally doesn't go into RAM...
Even when it goes onto a HDD I don't really want to cache 64+ GiB.
That might be doable by removing the temporary file on release
. Not entirely sure, would need to investigate in more detail.
This seems to be the underlying problem behind Issue #8, where the "volume" that's out of room is /tmp
and not the device.
I wrote a (very kludgy) script as a workaround that moves the adbfs temp dir somewhere else and points a symlink from the original location to the new one.
#!/bin/bash
## Hardcoded variables that need changing
dir="/where/you/want/it/mounted"
target="/where/you/want/it/cached"
## Unmount and mount
fusermount -u "$dir"
adbfs "$dir"
## Kludge for the adbfs kludge needing to write all accessed data:
cd /tmp || (echo "Cannot cd!" && exit 1)
tmp=(adbfs*)
x="${tmp[0]}" # assumes that there's at least one adbfs dir and that you want the first
source="/tmp/$x"
mv "$source" "$target/"
ln -s "$target/$x" "$source"
Would it really be impossible to transfer only part of file instead of whole file at once? Like, using dd installed somewhere on sdcard instead of /bin so no root required?
Hi. Since I found adbfs
issue #8 kept me from using it efficiently and in a larger scale (e.g. for decentralized file synchronization). Basically, temporary files in /tmp/adbfs-XXXXXX
filled my up hard disk until my system became unusable.
I followed the suggestion of @spion above and changed adb_release()
to the following snippet. Compiled, executed, worked. Not sure about side effects, but >100 files of >600MB were copied with matching checksums and without obvious errors.
static int adb_release(const char *path, struct fuse_file_info *fi) {
// just like in the other functions
string path_string;
string local_path_string;
path_string.assign(path);
local_path_string = tempDirPath;
string_replacer(path_string,"/","-");
local_path_string.append(path_string);
path_string.assign(path);
// untouched
int fd = fi->fh;
filePendingWrite.erase(filePendingWrite.find(fd));
close(fd);
// remove local copy
unlink(local_path_string.c_str());
return 0;
}
@funnyflowerpot can you submit a pull request? I'll try it out and merge it.
I confirm this issue. This is really pain in the a** on machines with little disk space free. Every time free disk space is almost used, large operations (copying) are failing.
Usually /tmp is in a tmpfs, so in ram. adbfs seems to cache data in /tmp without limit, so it fills my 16GiB of ram completly during a backup of my 64GiB internal memory of my phone. adbfs should limit the data in /tmp somehow.