Copying one's home directory to an external hard disk

Kenneth Lee ken.lee at kennethlee.org
Thu Nov 29 21:23:23 UTC 2007


The best way - depends on what you need.

Here is what I do -

Each night, I have a cron job that mounts an external drive and I copy
files.  Here is a snippet:
#!/bin/bash
### backup to usb drive ###
# Ensure the device is plugged in
if [ ! -b /dev/USB-500GB-EXT ]; then
        exit 1
fi

# Mount the backup mount point
mount /backup


echo "*******************************">>/backup/backup.log
echo "Start Backup">>/backup/backup.log
date>>/backup/backup.log


echo "/home/klee/ - processing ...">>/backup/backup.log
# Copy data from /home/klee
cd /backup
mkdir /backup/home
mkdir /backup/home/klee
cd /backup/home/klee
cp -a -u -v --reply=yes /home/klee/ /backup/home/

date>>/backup/backup.log
echo "Backup Complete">>/backup/backup.log
cd /root

# unmount the backup mount point
umount -l /backup


###############################################

>From work, I use rsync.  With a windows laptop, I would use rsync and ssh
with cygwin.  Here's a sample of that script:
@echo off
setlocal

set PATH=c:\cygwin;%PATH%
set CYGWIN=binmode tty
set TERM=ansi
set USERNAME=klee
set HOME=c:\cygwin
set RSYNC_RSH=ssh.exe

@echo on
c:
cd "\My Documents"
rsync -e c:\cygwin\ssh -va ./ username at ipaddress:/home/klee/mydocuments/

endlocal


Hope that gives you some ideas.  For this to work, I have a dedicated server
at home and spend an extra 5 dollars a month for a static IP address.  This
way I can SSH to my Home PC anytime I need from just about anywhere I have
an internet connection.  This has really helped when I needed to get a hint
from sourcecode I had at home.  Just a quick SSH terminal session, and I had
what I needed.

Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071129/2daf8597/attachment-0001.htm>


More information about the fedora-list mailing list