I am using Carbon Copy Cloner to clone my hard drive in preparation for a Mountain Lion fresh install. The process seems to be stuck on copying bands from the robottinosino.sparsebundle image.
To check that “something” is moving, I am resorting to this very crude CLI script:
rsync -n -avv --delete /Users/robottinosino/robottinosino.sparsebundle/ /Volumes/AppleSSD_Clone_2012-09-03/Users/robottinosino/robottinosino.sparsebundle/ | grep -v ' is uptodate$' | grep bands | wc -l
I simulate an rsync but don’t run it (-n option), I filter out the lines which confirm bands are the same, select only lines describing bands which still need to be copied and count the number of bands still pending.
Now I’d like to know how fast the process is making progress, say “how many bands per second” as it has been a couple of days now… and I don’t want to stop it if it can finish before the week-end. If it can’t finish before the week-end, I had better stop it now as I’ll have to abort anyway.
Say I define the hack above as function x() { … } and use this abomination to count the “bands/second”:
start_seconds=$(date +%s); bands_at_start=$(x); sleep 6; bands_at_end=$(x); end_seconds=$(date +%s); total_seconds=$((end_seconds-start_seconds)); total_bands=$((bands_at_start-bands_at_end)); bands_per_second=$((total_bands/total_seconds)); echo $bands_per_second
which gives rubbish results.
Is the problem the fact that I am doing integer division? Can I do float/double division in Bash? Is there a more normal way of doing this using shell scripting?
I am beginner, don’t put me down. Thanks in advance for your help.
EDIT: I am trying this to circumvent the integer division:
bands_per_second=$(echo "scale=10; $total_bands/$total_seconds" | bc);
but there must be a better way to do this timing in Bash/shell scripting or with some other scripting tools? You know, with so many (thousands, if the count above is correct) bands remaining, I really can’t estimate whether it’s worth continuing…
That sparsebundle is your FileVault encrypted home directory. If you happen to be logged in as that user while you try this, things might go wrong. If this is what you’re doing, you might try something along these lines:
1) Create a new user with admin access but no encryption. Log out, log in as the new user, and try again.
2) Undo the filevault encryption. Possibly not a good idea, since you would then be backing up the unencrypted versions of the files.
3) Boot from an OS X install disk / USB drive rather than the hard disk before running your backup, so that the hard disk isn’t in use at all.
Note that Mountain Lion supports full disk encryption, which requires turning off your home directory encryption first. Might want to turn that on when you get the install done.