Cela m'a d�j� bien servi (sauvetage de l'installation d'origine pour r�f�rence en cas de doute de hacking, migration ...).
3 phases :
1- list : cr�ation de la liste des fichiers et �tablissement du contenu de chaque paquet
2- build : sauvetage des paquets
2bis- gavure d'un CD ou DVD (archive)
3- restore : choix du paquet � r�cup�rer, en absolu ou relatif
REM: en g�n�ral je ne g�re pas les backups de /home de cette mani�re car c'est un autre probl�me (beaucoup plus dynamique que le syst�me); je lance ghost apr�s une installation ou juste avant de faire une migration importante.
Tu peux toujours monter en NFS la machine de r�f�rence et copier directement de /home � /home
Il y a aussi des produits plus �labor�s (mais qui prennent plus de 7KB...) comme mkCDrec.
Bon amusement ;-)
Alain
Fabian Vilers wrote:
Bonjour � tous,
J'aimerais d�plac� un syst�me d'une machine vers une autre. Quel pourrais etre la meilleure technique? Je sais que ce genre de question � d�j� �t� d�battue mais je ne retrouve plus le mail.
A savoir, les disques n'ont pas la m�me g�om�trie et il me sera impossible de d�placer physiquement les disques d'une machine l'autre.
Merci pour vos conseils avis�s, Fabian _______________________________________________________ Linux Mailing List - http://www.unixtech.be Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux Archives: http://www.mail-archive.com/[email protected] IRC: chat.unixtech.be:6667 - #unixtech NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech
-- ------------------------------------------------------------ Dr Alain EMPAIN <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Bioinformatics, Molecular Genetics, Fac. Med. Vet., University of LIEGEe, Belgium Bd de Colonster, B43 B-4000 LIEGEe (Sart-Tilman) WORK: +32 4 366 4159 FAX: +32 4 366 4122 HOME: rue des Martyrs,7 B- 4550 Nandrin +32 85 51 2341 GSM: +32 497 70 1764 ------------------------------------------------------------------------------- What's your favorite Linux program? That's like asking a poet what his favorite word is; it's all in how they go together. (Michael Stutz, author of The Linux Cookbook) -------------------------------------------------------------------------------
#!/bin/sh # $Version$ ################################### A.EMPAIN'1999-2000 ######## # GHOST : build seperate pack of every main directories # /var /home /usr /usr/X11R6 /opt... # WARNING : Take every dir, even mounted, # except on /mnt and /alt (usual target for ghost tgz) # so umount what you don't want ... # VERSION=1.0 2002-06-06 # ############################################################# # TITLE="GHOST v1.0 A.Empain'2002" # TITLE="GHOST v1.1 20030527 A.Empain'2003" TITLE="GHOST v1.2 20030714 A.Empain'2003"
LOC=/etc/flists
if [ ! -d $LOC ]
then mkdir $LOC
fi
TM=`date +%y%m%d`
NAME=`hostname`
BASE="$LOC/$NAME"
ALL=${BASE}_ALL
CONF=${BASE}_CONF # fixed list of config files (hand edited)
WORK=/tmp/work_ghost
TMP=/tmp/tmp_ghost
# -------------------------------------------------------------
function filterlist() {
ID=$1
LIST="$LIST $ID" # add it the the list
echo "..$ID"
PATT=$2
egrep "$PATT" < $WORK > ${BASE}_${ID} # extract
egrep -v "$PATT" < $WORK > $TMP; # remain
mv $TMP $WORK # ready for the next selection
}
# -------------------------------------------------------------
function help() {
echo "#
--------------------------------------------------------------A.Empain'2003"
echo
echo "GHOST : save the system as well defined compressed packages"
echo
echo "0: be sure to umount remote servers etc. ;-) "
echo "1: build the collection of file lists /etc/flist/* : BUILD-LIST"
echo "2: create compressed cpio packs of any sublist"
echo " ALL is particular : every packs except HOME (system backup)"
echo " HOME : user's DATA backup, better done with on-the-fly file
list & tar..."
echo "3: list the 'table of content' of one compressed pack"
echo "4: extract localy one CPZ pack"
echo "5: extract in place (absolute path) one CPZ pack"
echo
"-----------------------------------------------------------------------------"
echo
}
# -------------------------------------------------------------
function buildlist() {
echo "First, building the main list $ALL "
TM0=`date +%s`
## find / -mount | egrep -v "^/proc/" | egrep -v "^/mnt/" |
find / | egrep -v "^/proc/" | egrep -v "^/mnt/" |
egrep -v "^/tmp/" | grep -v "/.cache/ | grep -v /log/ " > $ALL
echo "ALL: `wc -l $ALL` lines"
TM1=`date +%s`
echo "ALL: `expr $TM1 - $TM0` sec"
echo "--------------------------------------"
echo "Now, filtering it into sublists HOME, USR, OPT..."
echo " ALL: `wc -l $ALL` lines"
cp $ALL $WORK # will be parsed to produce the many sub lists
TM1=`date +%s`
# -----------------------------------------
filterlist OPT "^/opt/"
filterlist X11 "^/usr/X11R6/"
filterlist BIN "^/bin|^/sbin|^/usr/sbin"
filterlist LIB "^/lib|^/usr/lib"
filterlist DOC "^/usr/share/doc|^/usr/doc"
filterlist SHARE "^/usr/share"
filterlist LOCAL "^/usr/local"
filterlist USR "^/usr"
filterlist MYSQL "^/var/lib/mysql"
filterlist VAR "^/var"
filterlist BOOT "^/boot"
filterlist ROOT "^/root"
filterlist HOME "^/home"
filterlist EXP "^/export"
filterlist DBS "^/dbs"
filterlist DEV "^/dev"
# last step, discard the /alt/ refs from the remaining items
grep -v "^/alt/" $WORK > ${BASE}_BASE
rm $WORK
}
# -------------------------------------------------
function makeimages() {
echo $BAR$BAR
echo "The images will be rebuilt (cpio + gzip)"
echo ""
echo "=========== ALL = everything EXCEPTED the /home ============="
cd $LOC
LIST=`ls -1 $NAME_* | cut -d_ -f2 ` # palm_VAR .. VAR
select CHOICE in $LIST
do
break
done
if [ $CHOICE = "ALL" ]
then CHOICE=`echo $LIST | sed 's/HOME//' | sed 's/ALL//' `
fi
echo "..CHOICE is set to $CHOICE"
sleep 3
echo ----------------------
echo Disk free :
echo ----------------------
df
echo ----------------------
echo -n "Enter the destination path [/tmp] : "
read PTH
if [ -z $PTH ]
then PTH=/tmp
fi
header
echo "..path set to $PTH, choice to $CHOICE"
echo
echo " REM: the next steps will take a while ;-)"
echo
# --------------------
for ITEM in $CHOICE
do
FILE=`ls /etc/flists/*$ITEM`
DEST=$PTH/${NAME}_${TM}_${ITEM}
echo "Creating $DEST ($FILE) (" `date` ")"
cat $FILE | cpio -o 2>> /tmp/cpz.log | gzip > $DEST.cpz
done
date
}
# -------------------------------------------------------------
function header() {
clear
BAR="======================================="
echo $BAR$BAR
echo $TITLE
echo
mount
}
# -------------------------------------------------------------
function selcpz() {
LIST=`ls -1 *cpz`
if [ -z "$LIST" ]
then
echo "<E> no CPZ files in the current directory"
echo "Please move to the correct ghost repository [/alt] and
try again"
help
exit
fi
select CPZ in $LIST
do
break
done
}
# ==========================================================
# MAIN
#===========================================================
header
echo "---------------------------------------------------------------------"
echo "Select the main mode (based on lists of file systems) : "
select MODE in HELP BUILD_LIST MAKE_IMAGES TABLE LOCAL-EXTRACT ROOT-EXTRACT
do echo "..mode is set to $MODE"
break
done
# -----------------------------------------
if [ $MODE = HELP ]
then
help
exit
fi
# -----------------------------------------
if [ $MODE = BUILD_LIST ]
then
header
buildlist
exit
fi
# -----------------------------------------
if [ $MODE = MAKE_IMAGES ]
then
header
makeimages
fi
# -----------------------------------------
if [ $MODE = TABLE ]
then
selcpz
zcat $CPZ | cpio -itv | less
exit
fi
# -----------------------------------------
if [ $MODE = LOCAL-EXTRACT ]
then
selcpz
zcat $CPZ |
cpio -iv --make-directories --unconditional
--no-absolute-filenames
exit
fi
# -----------------------------------------
if [ $MODE = ROOT-EXTRACT ]
then
selcpz
zcat $CPZ |
cpio -iv --make-directories --unconditional
exit
fi
_______________________________________________________ Linux Mailing List - http://www.unixtech.be Subscribe/Unsubscribe: http://www.unixtech.be/mailman/listinfo/linux Archives: http://www.mail-archive.com/[email protected] IRC: chat.unixtech.be:6667 - #unixtech NNTP: news.gname.org - gmane.org.user-groups.linux.unixtech

