Difference between revisions of "How To Backup Your Funtoo With SystemRescueCD"

From Funtoo Linux
Jump to: navigation, search
(The TAR method)
 
(One intermediate revision by one user not shown)
Line 5: Line 5:
 
* TAR
 
* TAR
 
* Rsync
 
* Rsync
* Rsync + daily snapshot
+
* Rsync + daily snapshot  
  
 
== Why backup your box ==
 
== Why backup your box ==
Line 179: Line 179:
 
If you want the French version, you can go here :  
 
If you want the French version, you can go here :  
  
* [[funtoo-quebec:Sauvegarde_Rsync_avec_SystemRescueCD|Sauvegarde Rsync avec SystemRescueCD]] at funtoo-quebec.
+
* [https://gentooquebec.org/gwiki/index.php/Sauvegarde_Rsync_avec_Btrfs_et_SystemRescueCD Sauvegarde BTRFS avec rsync et SystemRescueCd ] at Gentoo Québec.
* [[funtoo-quebec:Sauvegarde_stage5_avec_SystemRescueCD|Sauvegarde stage5 avec SystemRescueCD]] at funtoo-quebec.
+
* [https://www.funtoo-quebec.org/wiki/index.php/Sauvegarde_Rsync_avec_SystemRescueCD Sauvegarde avec rsync et SystemRescueCD] at Funtoo Québec.
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Latest revision as of 04:22, 6 December 2012

With this little Wiki, you will be able to backup your Funtoo box in no time.

You will learn how to do it using 3 methods.

  • TAR
  • Rsync
  • Rsync + daily snapshot

Contents

[edit] Why backup your box

Because we can have some major hardware problems and a good backup can save a lot of time too.

Also, make sure to backup your box on an another HDD too and if you can use an external USB HDD just to be sure.

[edit] Why using Tar or Rsync

One of the main reasons we should use Rsync, it's because it's fast and you can make a snapshot in no time.

There's also a cool stuff about rsync is that you can hardlink your daily snapshot to your current rsync backup and it will save a lot of backup space.

In that case, your daily snapshot will only use the space of your diff from that day.

We also recommend Tar, because since it's an archive, you can burn it or move it inside an another partition or even on a USB stick. You can use Bzip2 or LZMA to compress your archive too.

[edit] The TAR method

First, when we you want to backup your box, we should always use SystemRescueCD because you don't want to backup your system when it's running.

To do so, you can use this method to backup :

This is the famous Stage 5.

   1. Boot from the LiveCD
   2. mkdir /mnt/funtoo
   3. mkdir /mnt/backup (this mountpoint may already exist if using a newer version of SystemRescueCD)
   4. mount /dev/sda8 /mnt/funtoo
   5. mount /dev/sda7 /mnt/funtoo/boot
   6. mount /dev/sda10 /mnt/backup

   7. cd /mnt/funtoo
   8. time tar -cvvjpf /mnt/backup/stage5F20101026.tar.bz2 .  (note the ' . ' at the end of the line is required, same as ' * ')
   9. time bzip2 -tv /mnt/backup/stage5F20101026.tar.bz2 (this compresses the .tar created in the previous step.  Skip if compression is not needed)
  10. cd /
  11. umount /mnt/funtoo/boot /mnt/funtoo /mnt/backup

You use this method to restore :

   1. Boot from the LiveCD
   2. mkdir /mnt/rescue
   3. mkdir /mnt/funtoo/
   4. cd /mnt/funtoo
   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/funtoo
  11. mount /dev/sda7  /mnt/funtoo/boot 

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

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

[edit] The Rsync method

When you want to backup :

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

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

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

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

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

When you want to restore :

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

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

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

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

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

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

[edit] The Rsync method + daily snapshot

When you want to backup :

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

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

   7. time rsync -aHA --del --force --stats --progress /mnt/funtoo /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/funtoo/boot /mnt/funtoo /mnt/backup 

When you want to restore :

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

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

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

  12. time rsync -aHA --del --force --stats --progress /mnt/rescue/snap-20101026/ /mnt/funtoo 

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

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


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

[edit] French version

If you want the French version, you can go here :

Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff