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

From Funtoo Linux
Jump to: navigation, search
(Why using Tar or Rsync)
(French version)
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= How To Backup Your Funtoo With SystemRescueCD =
 
 
 
With this little Wiki, you will be able to backup your Funtoo box in no time.
 
With this little Wiki, you will be able to backup your Funtoo box in no time.
  
Line 17: Line 15:
 
== Why using Tar or Rsync ==
 
== Why using Tar or Rsync ==
  
One of the main reasons I use Rsync, it's because it's fast and you can make a snapshot in no time.
+
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.  
 
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.  
Line 23: Line 21:
 
In that case, your daily snapshot will only use the space of your diff from that day.
 
In that case, your daily snapshot will only use the space of your diff from that day.
  
I 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.
+
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.
  
 
== The TAR method ==
 
== 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.
+
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, I use this method to backup :
+
To do so, you can use this method to backup :
  
 
This is the famous Stage 5.
 
This is the famous Stage 5.
Line 36: Line 34:
 
   1. Boot from the LiveCD
 
   1. Boot from the LiveCD
 
   2. mkdir /mnt/funtoo
 
   2. mkdir /mnt/funtoo
   3. mkdir /mnt/backup
+
   3. mkdir /mnt/backup (this mountpoint may already exist if using a newer version of SystemRescueCD)
 
   4. mount /dev/sda8 /mnt/funtoo
 
   4. mount /dev/sda8 /mnt/funtoo
 
   5. mount /dev/sda7 /mnt/funtoo/boot
 
   5. mount /dev/sda7 /mnt/funtoo/boot
Line 42: Line 40:
  
 
   7. cd /mnt/funtoo
 
   7. cd /mnt/funtoo
   8. time tar -cvvjpf /mnt/backup/stage5F20101026.tar.bz2 .   
+
   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  
+
   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 /
 
   10. cd /
 
   11. umount /mnt/funtoo/boot /mnt/funtoo /mnt/backup
 
   11. umount /mnt/funtoo/boot /mnt/funtoo /mnt/backup
 
</pre>
 
</pre>
  
I use this method to restore :
+
You use this method to restore :
  
 
<pre>
 
<pre>
Line 66: Line 64:
  
 
   12. cd /mnt/rescue/
 
   12. cd /mnt/rescue/
   13 time tar xvjpf stage5F20101026.tar.bz2 -C /mnt/funtoo/  
+
   13. time tar xvjpf stage5F20101026.tar.bz2 -C /mnt/funtoo/  
  
 
   14. cd /
 
   14. cd /
Line 75: Line 73:
 
== The Rsync method ==
 
== The Rsync method ==
  
I use this method to backup :
+
When you want to backup :
  
 
<pre>
 
<pre>
Line 96: Line 94:
 
</pre>
 
</pre>
  
I use this method to restore :
+
When you want to restore :
  
 
<pre>
 
<pre>
Line 124: Line 122:
 
== The Rsync method + daily snapshot ==
 
== The Rsync method + daily snapshot ==
  
I use this method to backup :
+
When you want to backup :
  
 
<pre>
 
<pre>
Line 143: Line 141:
 
   12. umount /mnt/funtoo/boot /mnt/funtoo /mnt/backup  
 
   12. umount /mnt/funtoo/boot /mnt/funtoo /mnt/backup  
 
</pre>
 
</pre>
 +
 +
When you want to restore :
 +
 +
<pre>
 +
  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
 +
</pre>
 +
  
 
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.
 
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.
Line 149: Line 174:
  
 
That's it :P
 
That's it :P
 +
 +
== French version ==
 +
 +
If you want the French version, you can go here :
 +
 +
* [https://gentooquebec.org/gwiki/index.php/Sauvegarde_Rsync_avec_Btrfs_et_SystemRescueCD Sauvegarde BTRFS avec rsync et SystemRescueCd ]  at Gentoo Québec.
 +
* [https://www.funtoo-quebec.org/wiki/index.php/Sauvegarde_Rsync_avec_SystemRescueCD Sauvegarde avec rsync et SystemRescueCD]  at Funtoo Québec.
 +
[[Category:HOWTO]]

Revision as of 01:38, 3 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

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.

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.

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

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 

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

French version

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

Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff