Friday, July 25, 2014

i smile when my iphone or laptop gets stolen, damaged or paralyzed by a virus

update 8/25/17:

i now use the apple icloud to backup my contacts and notes.

i now use lenovo t540p which cost $200 in ebay and iphone 6s which cost $50 in ebay.

with the ultra light linux ubuntu you can now put the entire graphical OS suite in a bootable flash or dvd together with your pristine system setup (windows, documents and settings and program files) so all you have to do is boot to the flash drive or cd, delete the system files in c:\ and then copy the pristine  copy (i also keep a backup of the system in c:\system-backup and copy from there if possible because it's much faster).  this is a big deal for me who has a many additional tedious setups to support my geeky needs. this even eliminates the need for me to have an anti-virus software which can be unreliable, and sometimes cause more problems like slowing down the computer and accidentally restricting or causing  some programs and features to stop working. also, the windows system recovery does not always work.  the caveat of course is it requires more technical expertise.

----------------- original article -----------------

nowadays, losing a smart phone or laptop can be like losing an arm or a leg. not just the cost of the gadget but also the precious and sometimes irreplaceable data in them and the long and tedious installations and settings you have to do again. but as usual i'm the only one in this world weird enough to smile when my iphone or laptop gets stolen or damaged.

in ebay, lenovo t61 is just $100 (P4.3k) and iphone 4s is just $75(P3.7k) . it’s got everything i need. plus i can buy extra spares for backup and gifts to my scholars. there really is no feature in the newer iphones or laptops that i want or need. and.with my quick backup and recovery system, i just smile if my laptop or iphone is lost or broken.

the downside is that hot chics get turned off when they see my dinosaur laptop and iphone.

the lenovo laptops are fun and easy to fix. almost all parts are easily replaceable – cheap and available parts in ebay. you can find instructions and help guides all over the internet. it’s almost like there is an underground subculture of lenovo users worldwide. i always bring with me a single dvd containing all the sofware and the OS install cd when i travel in case i have to re-install from scratch. although so far i never had to re-install. re-install is needed only when the laptop is stolen or hard drive crashed which has not happened. usually it’s the screen that wears out and needs to be replaced. i also had to replace the motherboard and fan once. i posted a youtube video about tips on t61 repair - http://ian-crystal.blogspot.com/2015/03/t61-repair-tips-and-techniques.html

i keep an organized CENTRAL directory (folder) TREE for important or precious files that need to be backed up to my flash drive. so that you don't have to keep copying files to this location, just change the default DATA file (not program file) location settings in your software so that it automatically saves files in the correct location under your central tree. example, here’s mine (with sizes of the subtrees):

audio_books     700mb
bin 2mb (scripts and small utilities)
contacts 1mb
ebooks 900mb
finance 92mb
iphone-backup 32mb
music 2.8gb
notes 37mb
pictures 2.2gb
projects 960mb
videos 1.1gb
-------------------------
total: 9GB

note that in spite of being a geek or techie, my precious files total only 9GB. note my video folder is only1gb. that is because i summarize my video recordings into 5 minute medium resolution music videos and store the gigabytes of original footage in dvds and put them in the storage room. no need to carry them around in your laptop or backup flashdrive when you travel. i also clean my pictures directory by deleting redundant pictures.

after backing up my iphone, i delete the free apps and only retain the paid apps - it makes a huge difference on the size of the backup file and makes recovery time much faster. i backup paid apps because sometimes the version that works for my old iphone is not available anymore in itunes. apple expects you to be buying the newest iphone.

i also post all my summarized videos in youtube - (search @oplok-videos in youtube and go to "ian crystal" channel)

keep your flash drive backup and laptop in different places in case your house burns down you don’t loose both. example, keep the flash drive in your office or in your car. when travelling keep the flash drive in your pocket not in the same bag as your laptop.

use rsync instead of just copying all the files to your flash drive (which could take forever). rsync copies only new files and files that changed. it can also delete files in the flash drive that were removed in your laptop (mirror backup). example, if you only have a few small files that got added or changed, rsync on a 9gb directory tree could only take 2 minutes. but if you have to copy the entire 9gb tree it could take an hour.

for windows, download rsync here: http://www.rsync.net/resources/howto/windows_rsync.html

Example, if your central precious files directory in your laptop is c:\my, and the drive of your flash drive  is g:\,  just put these commands in a bat file (e.g. rsync-my.bat) or .sh file for macs or unix:

rm -f c:/tmp/rsync-my.log
c:/my/bin/cwrsync/bin/rsync -av --delete --exclude="thumbs.db" --exclude="~*.tmp" /cygdrive/c/my/ /cygdrive/g/my

that’s it. this is the end of this blog article. the text below is just and anecdote:

because i want more tailored and interactive control of my backups, i wrote my own rsync. first i run compare-my to view new files and files that were deleted. then i ran sync-my to execute the actual updates. then i ran dir-cmp to update the files that changed.

here are  the codes:

compare-my.bat:

@rem 2>nul ; rem='
@echo off
set batpath=%0
IF NOT EXIST %0 set batpath=%0.bat
sh %batpath% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto :end'

g=g

if [ -d e:/my ]
then
  g=e
fi

echo "removing $g:/my thumbs.db ..."
find $g:/my -name thumbs.db -exec rm -f {} \;
echo "removing c:/my thumbs.db ..."
find c:/my -name thumbs.db -exec rm -f {} \;

echo "listing $g:/my ..."
cd $g:/my
find . \( \( -name configs/.heroku -o -name iphone-backup -o -name data2.cab/ini/favorites  \) -prune \) -o -name '*' | sort > c:/tmp/$g-my.tmp
echo "listing c:/my ..."
cd c:/my
find . \( \( -name configs/.heroku -o -name iphone-backup -o -name data2.cab/ini/favorites  \) -prune \) -o -name '*' | sort > c:/tmp/c-my.tmp

echo "comparing lists ..."
diff c:/tmp/$g-my.tmp c:/tmp/c-my.tmp > c:/tmp/my.diff

vi c:/tmp/my.diff

rem='
:end'

sync-my.bat:

@rem 2>nul ; rem='
@echo off
set batpath=%0
IF NOT EXIST %0 set batpath=%0.bat
sh %batpath% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto :end'

g=g

if [ -d e:/my ]
then
  g=e
fi

grep \> c:/tmp/my.diff | sed "s/^....//" > c:/tmp/sync-my.tmp
cat c:/tmp/sync-my.tmp
read enter?"These will be copied from c:/my to $g:/my (press enter to continue)"

i=1
lc=`wc -l c:/tmp/sync-my.tmp | awk '{print $1}'`
while [ "$i" -le "$lc" ]
do
  line=`sed -n "${i}p" c:/tmp/sync-my.tmp`
  echo $line
  file=`echo $line | sed "s/.*\///"`
  dir=`echo $line | sed "s/\/$file$//"`
  echo dir=$dir
  mkdir -p $g:/my/$dir
  cp -rpf "c:/my/$line" "$g:/my/$line"
  i=`expr $i + 1`
done

echo ""
echo ""
echo ""
echo ""

grep \< c:/tmp/my.diff | sed "s/^....//" > c:/tmp/sync-my.tmp
cat c:/tmp/sync-my.tmp
read enter?"These will be removed from $g:/my (press enter to continue)"
i=1
lc=`wc -l c:/tmp/sync-my.tmp | awk '{print $1}'`
while [ "$i" -le "$lc" ]
do
  line=`sed -n "${i}p" c:/tmp/sync-my.tmp`
  echo $line
  rm -f "$g:/my/$line"
  i=`expr $i + 1`
done

read enter?"press enter to sync iphone backup. ctrl-c to quit"
echo removing $g:/my/iphone-backup  ...
rm -rf $g:/my/iphone-backup/*
echo copying c:/my/iphone-backup to $g:/my
cp -rf c:/my/iphone-backup to $g:/my


rem='
:end'

dircmp-my.bat:

@rem 2>nul ; rem='
@echo off
set batpath=%0
IF NOT EXIST %0 set batpath=%0.bat
sh %batpath% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto :end'

g=g

if [ -d e:/my ]
then
  g=e
fi

echo copying c:/my/finance/data/ian.\* to g:/my/finance/data
cp -pf c:/my/finance/data/ian.*  g:/my/finance/data

for i in bin notes contacts finance projects
#for i in contacts finance projects
do
  echo "dircmp $i ..."
  dircmp -s c:/my/$i $g:/my/$i | grep " differ$" | sed "s/^Files //" | sed "s/ and .*//" | tr 'A-Z' 'a-z' | sed "s/^c//" | sed "s/\(.*\)/cp -f c\1 $g\1/" > c:/tmp/sync-my.sh
  cat c:/tmp/sync-my.sh
  read continue?"press enter to continue:"
  sh c:/tmp/sync-my.sh
done


rem='
:end'



(for more of my knowledge bombs, click the "ian's knowledge bombs" banner at the top of this article and choose any article in the table of contents that piques your interest)


No comments:

Post a Comment