Fwd: undelete bookmark folder

Matt Graham danceswithcrows at usa.net
Sat Jun 29 12:45:37 MST 2013


> Brian Cluff wrote:
>> In a nutshell, I hope you have a backup of it somewhere because if not,
>> it's pretty much gone.

MAKING BACKUPS EASY ON LINUX:

0. Buy a USB2 disk that has enough space to hold all the stuff in your home
dir plus at least a few G more (data tends to get bigger with time, of
course)

1. Plug this disk in.  Usually, removable disks have 1 partition of type FAT32
or NTFS covering their whole space.  (Check that this is the case, if not,
something weird may be going on.)

2. Make a filesystem with a label on this partition.  "mke2fs -j -L MY_BACKUPS
/dev/sdN1" .  Find what N is by looking at the output of dmesg | tail.

3. Make an entry for the partition you made in your /etc/fstab :

LABEL=MY_BACKUPS  /mnt/backup  ext3  noauto,users,noatime  0  0

4. As root, mkdir /mnt/backup if it doesn't exist, then mount this partition
on /mnt/backup , mkdir /mnt/backup/USER , and chown USER /mnt/backup/USER .

5. Make a shell script sort of like this:

#!/bin/bash
if [[ $1 == '--help' || $1 == '-h' ]] ; then
    echo "backs up ~USER to backup drive."
    exit;
fi

if mount | grep /mnt/backup > /dev/null ; then
    rsync -av --delete-after /home/USER/ /mnt/backup/USER
else
    echo "backup disk not mounted.  Trying to mount it."
    mount /mnt/backup
    if mount | grep /mnt/backup > /dev/null ; then
         echo "Is the disk plugged in?  Can't mount, bailing."
         exit 1
    fi
    rsync -av --delete-after /home/USER/ /mnt/backup/USER
    umount /mnt/backup
fi

6. Any time you want to make a backup, plug your disk in, and run that shell
script.  The initial rsync will take some time.  Subsequent rsyncs will take a
couple of minutes.

This is AFAICT a reasonably good way to do things, because it doesn't take a
lot of time to keep your backup up to date, and restoring is as simple as
mounting the backup disk and copying things over.  Since there is only 1
backup, though, you could delete something, make a backup, then realize you
needed that thing.  I have 2 backup disks and rotate them every few days to
make that less likely.

You could even get fancy and use dm-crypt to back up your stuff to an
encrypted disk, which is useful in some situations like when you want to leave
the disk somewhere that's not under your direct control like a friend's house.
 Using dm-crypt makes things a bit more complex, but I can write another
message about that.

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see



More information about the PLUG-discuss mailing list