#!/bin/sh

PARTITIONS="
/dev/hda2
/dev/hda3
"
ROOTPARTITION=$(mount|awk '/^\/dev\/.* on \/ type/ { print $1}')
OTHERPARTITION=$(echo "$PARTITIONS"|egrep -v "^(|$ROOTPARTITION)$")

echo "other partition: $OTHERPARTITION"

e2fsck $OTHERPARTITION
mkdir -p /tmp/mnt
mount $OTHERPARTITION /tmp/mnt
rsync --one-file-system --sparse --recursive --links --perms     \
      --times --group --owner --devices --specials --hard-links  \
      --acls --xattrs --executability --delete --force --verbose \
      / /tmp/mnt
umount /tmp/mnt

