« April 2007 | Main | August 2007 »

June 14, 2007

HOWTO: Backup your Mac OS X to nfs

First, you need to set up a nfs sharing.
I'm using a Solaris server.
Here're my steps.
Create a user with uid 501 (it's the default uid for first user on Mac OS X).
Create /export/home/mac, chmod 777 /export/home/mac
You can figure out how to give a proper mod/owner for /export/home/mac.
Since I'm restricting nfs access from certain machine, I don't care.

su
sharemgr create mygroup
sharemgr add-share -s /export/home/mac/ -r MAC mygroup
sharemgr set -P nfs -S sys -p root=macbookpro -p rw=macbookpro mygroup
sharemgr show
svcadm enable svc:/network/nfs/server:default

macbookpro is hostname of the Mac OS X client.

Then, try to mount it on Mac OS X
create /private/mnt/

sudo mount_nfs -o -P your_Solaris_machine:/export/home/mac /private/mnt/

create MBP_BACKUP directory in /private/mnt for a test.

Now, use rsync to backup your Mac OS X.
I assuming you're using Mac OS X 10.4, your rsync supports -E.

Create backup_excludes.txt to exclude some files.
Here's my version: (may not need to be that long)

automount/*
proc/*
dev/*
.Spotlight-V100/*
.Spotlight-V100/.*
.Trash/*
.Trashes/*/*
.hotfiles.btree
.journal
.journal_info_block
.vol
Desktop DB
Desktop DF
Library/Caches
System/Library/Caches
System/Library/Extensions.kextcache
Temporary Items
Users/*/Library/Caches/*
Volumes/*
cores/*
mach
mach.sym
private/Network/*
private/_Network_/*
private/automount/*
private/var/automount/*
private/var/db/BootCache.playlist
private/var/db/NetworkInterfaces.xml
private/var/db/volinfo.database
private/var/run
private/var/tmp/*
private/tmp/*
private/var/run/*
private/var/spool/postfix/*
private/var/vm/*
private/mnt/*

Here we go!

sudo rsync -E -a -x -S --delete --progress --exclude-from=backup_excludes.txt / /private/mnt/MBP_BACKUP/

You may want add "-u" for update.
Check rsync manpage for details.
It took my several hours for the first time sync.

Good luck!

BTW: How to sync back?

Update: It crashed to 4 Languages (system hang, kernel panic) when I tried to re-sync my disk. Might be a bug of rsync or nfs? I don't know how to solve it yet. Don't use -E and don't sync large files (>2G) seems fine.

Posted by ginn at 4:29 PM | Comments (2)