Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Howto] Backup your box with a SystemRescueCD
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Tue Oct 26, 2010 1:53 pm    Post subject: [Howto] Backup your box with a SystemRescueCD Reply with quote

Hi everyone, this little howto is about how to backup your box with SystemRescueCD.

I'm gonna use 3 differents methods :

1. TAR
2. Rsync
3. Rsync + daily snapshot




1. The TAR method

First, when I backup my box, I always use SystemRescueCD because I don't want to backup my system when it's running.

To do so, I use this method to backup :

This is the famous Stage 5.

Code:

   1. Boot from the LiveCD
   2. mkdir /mnt/gentoo
   3. mkdir /mnt/backup
   4. mount /dev/sda8 /mnt/gentoo
   5. mount /dev/sda7 /mnt/gentoo/boot
   6. mount /dev/sda10 /mnt/backup

   7. cd /mnt/gentoo
   8. time tar -cvvjpf /mnt/backup/stage5F20101026.tar.bz2 . 
   9. time bzip2 -tv /mnt/backup/stage5F20101026.tar.bz2
  10. cd /
  11. umount /mnt/gentoo/boot /mnt/gentoo /mnt/backup


I use this method to restore :

Code:

   1. Boot from the LiveCD
   2. mkdir /mnt/rescue
   3. mkdir /mnt/gentoo/
   4. cd /mnt/gentoo
   5. mkdir boot
 
   6. mkfs.ext4 /dev/sda7
   7. mkfs.ext4 /dev/sda8

   8. cd /
   9. mount /dev/sda10 /mnt/rescue
  10. mount /dev/sda8  /mnt/gentoo
  11. mount /dev/sda7  /mnt/gentoo/boot

  12. cd /mnt/rescue/
  13 time tar xvjpf stage5F20101026.tar.bz2 -C /mnt/gentoo/

  14. cd /
  15. umount /mnt/rescue /mnt/gentoo/boot /mnt/gentoo
  16. Reboot my box and I'm good to go :P



2. The Rsync method :

I use this method to backup :

Code:

   1. Boot from the LiveCD
   2. mkdir /mnt/gentoo
   3. mkdir /mnt/backup

   4. mount /dev/sda8 /mnt/gentoo
   5. mount /dev/sda7 /mnt/gentoo/boot
   6. mount /dev/sda10 /mnt/backup

   7. time rsync -aHA --del --force --stats --progress /mnt/gentoo /mnt/backup

   8. cd /mnt/backup
   9. ls -la

   10. cd /
   11. umount /mnt/gentoo/boot /mnt/gentoo /mnt/backup



I use this method to restore :

Code:

   1. Boot from the LiveCD
   2. mkdir /mnt/rescue
   3. mkdir /mnt/gentoo/
   4. cd /mnt/gentoo
   5. mkdir boot

   6. mkfs.ext4 /dev/sda7
   7. mkfs.ext4 /dev/sda8

   8. cd /
   9. mount /dev/sda8 /mnt/gentoo
  10. mount /dev/sda7 /mnt/gentoo/boot
  11. mount /dev/sda10 /mnt/rescue

  12. time rsync -aHA --del --force --stats --progress /mnt/rescue/gentoo/ /mnt/gentoo

  13. cd /mnt/gentoo
  14. ls -la

  15. cd /
  16. umount /mnt/gentoo/boot /mnt/gentoo /mnt/rescue


3. The Rsync method + daily snapshot :

I use this method to backup :

Code:

   1. Boot from the LiveCD
   2. mkdir /mnt/gentoo
   3. mkdir /mnt/backup

   4. mount /dev/sda8 /mnt/gentoo
   5. mount /dev/sda7 /mnt/gentoo/boot
   6. mount /dev/sda10 /mnt/backup

   7. time rsync -aHA --del --force --stats --progress /mnt/gentoo /mnt/backup/current

   8. cd /mnt/backup/current
   9. ls -la
  10. cd /
  11. cp -al /mnt/backup/current /mnt/backup/snap-20101026
  12. umount /mnt/gentoo/boot /mnt/gentoo /mnt/backup


This method is really great, since all the files that didn't change will have a hardlink to it, so basically the size of the snap-20101026 will be really small if the rsync didn't change that much files between your last snapshot.

But, the downside, is that instead of using a lot of spaces, it will use a lot of Inodes, so be careful to check your inode status on the backup partition.

That's it :P
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Sat Oct 30, 2010 2:08 am    Post subject: Reply with quote

Anyone use something else to backup his box ?
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Sat Oct 30, 2010 4:36 am    Post subject: Reply with quote

d2_racing wrote:
Anyone use something else to backup his box ?
I backup my home directory. I don't bother with backing up /. This is what I use (part of a script):
Code:
$RSYNC -abRv -hh --delete --exclude-from=$EXCLUDE_FILE \
    --backup-dir="${MOUNT_DIR}${BACKUP_DIR}"/home.old --suffix="-$(date +%F)" \
    $SOURCE_DIR "${MOUNT_DIR}${BACKUP_DIR}"

_________________
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum