RelocatingTemp

From MLDonkey
Jump to: navigation, search

Contents

problem

it's not always the easiest to move your current temp dir from one partition to another. this is because unix/linux filesystem doesn't reserve 700MB of the disc just because a movie download begins, but writes bytes only as they come in. this means that you can start a lot more downloads than would actually fit on you disc, as long as you monitor disc usage and move completed files to another partition.

moreover, this means that you cannot move/copy the temp directory without ensuring that the destination temp files will not be created as big as the completely downloaded files would be, i.e. filled up with zeros to 700MB.

method 1

Using GNU cp

cp --sparse SOURCE DEST

or

cp --sparse=always SOURCE DEST

method 2

Using rsync

rsync -avS SOURCE DEST

method 3

if method 1 and 2 aren't available or generate strange results, try this

linux (didn't test it, maybe you also need the --sparse flag here):

cd /to/your/temp
find . -depth -print | cpio --pass-though --make-directories --unconditional --preserve-modification-time --verbose --reset-access-time /your/new/temp

unix (tested it):

cd /to/your/temp
find -d . -print | cpio -pdumva /your/new/temp

_find -d . -print_ is supposed to do a listing of the files in current dir (.) and print it to stdout. the -d/-depth flag is probably not necessary if you don't have subdirs in the current dir.

_cpio -pdumva newtemplocation_ reads the listing and copies the files in the specified order

the -d Create any intermediate directories as needed to write the files at the new location.

this means that that this switch prevents original permissions from interfering, since directories are created new as needed.

method 4

if your new temp drive is larger or equal to the old one, as a last resort you could try something like:

dd if="/dev/old_temp_device" of="/dev/new_temp_device"

(You may later need to resize the filesystem to benefit from all available disk space... That's really a "if everything else fails" method)

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox