How to Backup & Cloning Gentoo Linux with mkBackup (and make clones)
ISSUES
Due to Gentoo Linux is so hard to build and compile for X86/32/64 platform, we offer a how to about making clones copies. This is related to help final users and friens with our experience because they may be doesn't have a hi-speed DSL or a good processor to run the gcc all the time, then we use to build on a distcc cluster or a much power PC for generic installations, they don't have that kind of hardware.
The script should be modified, on the versions of Gentoo I ever build I have a special folder where gentoo stores the source code tarballs of almost the whole system, it is on
/usr/portage/distfiles I use to move up to root folder
/distfiles and placing a symlink to replace them, we suposse we have the root folder and
/usr/portage folder on the same partition, we need to do that:
cd /usr/portage
ls -lsh distfiles
if you see a symlink to /distfiles leave it there if you don't see distfiles folder then may be your gentoo is a new one based on 2005.X. if you still having a real and big folder, move them to root folder:
mv distfiles /
ln -s /distfiles distfiles
that's all about the sources, you can back up this folder without compressing them, cause is already compressed.
The next steep is installing
this script, you should copy it on the root folder
[download] and places on /, to write on / you may need root access.
WARN: you can not backup your running system, cause special folders like /proc or /sys, or /dev have special nodes, this special nodes should not be stored cause this information is generated by Linux Kernel. You'll got garbage.
Go to your GentooLiveCD and make two folders on root
mkdir /mygentoo
mkdir /mystore
mount the system onto /mygentoo folder, you don't need to chroot your system we will use the LiveCD, mount your second partition where you wish to put the tarballs or the network shared onto /mystore folder, if you have files ordered you may be want to place all tarballs in a separated gentoo folder, make them:
mount /dev/mysys /mygentoo
mount /dev/mystore /mystore
mkdir /mystore/gentoo
go to /mygentoo folder, remember you already have mkBackup in the root folder.
modify with nano if it's neccesary, there is the header of the script:
#!/bin/bash
#FOLDER CONFIG
export FOLDERS="bin sbin boot etc root media tmp proc compartir dev mnt server srv sys cdrom dvd floppy"
export BIGFOLDERS="usr opt home lib var"
export REALLYBIGFOLDERS="usr/portage lib/modules usr/local usr/src usr/share usr/X11R6 usr/loki opt/kde3 usr/kde usr/lib"
export DEST="/mystore/gentoo"
...
...
As we see, we have 3 kind of folders:
- FOLDERS:Normal and small folders, that folders will be compressed in one single tarball called folder.tgz
- BIGFOLDERS:Second level folders on this main ones ar going onto a unique tarball for example, if we have 3 users folders on home, called gus, madgus and ftp you'll get the 3 tarballs home-gus.tgz, home-madgus.tgz and home-ftp.tgz
- REALLYBIGFOLDERS:This kind of folders will be ignored in the BIGFOLDERS, then as a BIGFOLDER each internal folder will be stored as a separated one, and if we have files and symlinks they will be stored onto special tarballs for example the usr/lib folder use to have folders for each type of lib, but 70% of files resides on the usr/lib folder, then we makes difference between static libraries and shared ones, you'll get files like this: usr-lib-AbiWord-2.2.tgz, usr-lib-ImageMagick-6.2.0.tgz, etc. for each subfolder and usr-lib-1-files-links-static.tgz for .a objects and usr-lib-1-files-links-shared.tgz for anything less.
If you see you don't need to backup another folder than listed ones, then procced to execute the script:
cd /mygentoo
./mkBackup
WARN: you need to go inside cause is a requirement, if you don't you'll got garbage+GentooLiveCD.
We have now the tarballs of our Gentoo Linux system on the network or a hard drive or a DVD drive on the system, run your LiveCD again in the empty computer, part your hard drive as required, mount your new root partition onto /mygentoo folder and the tarballs patition or network shared onto /mystore folder.
mkdir /mygentoo
mkdir /mystore
mount /dev/empty /mygentoo
mount /dev/store /mystore
cd /mygentoo
then we are ready to install the packaged tarballs one by one with this single line:
find /mystore/gentoo | while read tarball; do tar -xzvf "$tarball" ; done
that's all, or if you prefer more quiet and with an unpack test:
find /mystore/gentoo -type f | while read tarball
do echo -n "$tarball"; if tar -xzf "$tarball"
then echo ":Ok"
else echo "$tarball" > /error.txt
echo ":Fail"
fi; done
you can check the file error.txt to see if some tarball are corrupted
(you can have corrupted tarballs even you have new hard drives, if you get some XFS crash or NVIDIA crash some times I got a lot of corrupted tarballs). Then now you can chroot the new system you can copy the /distfiles folder and reinstall following the
Gentoo Manual the lilo or grub as you did the 1st time, chapter 10, Installing the boot loader.
WARN: You should never put distfiles on the same folders you put the tarballs of gentoo, if you do so, then you got every source package uncompressed on root folder uhhh :P
|Contrate Nuestra asesoría, instalación y cursos en Sistemas Linux, Redes, etc. Acerca de este sitio web Webmaster | Volver Al Inicio | Compunauta Micro Linux (uLinux) El servidor en CD, sin innstalación. |