Restauration d’une image Linux depuis un live CD
Updated on 2009-04-08 by Kerim Teboulbi
Created on 2009-03-24 by Kerim Teboulbi
Restauration d’une image Linux depuis un live CD
[demarrage_du_liveCD]Démarrage du live cd et contrôle à distance :
[Formatage]Formatage du disque
[Restauration]Restauré l’image
[Premier_demarrage]Premier démarrage
Après avoir restaurer l’image du le système. Il faut réinstaller Grub sinon il y aura des problèmes d’installation.
Démarrer le serveur asterisk à partir du live cd allez dans puis changez de clavier en clavier suisse avec le code : 43
Ici nous sommes dans le prompt du live cd (linux)
Password que vous avez mis en haut, par exemple qwertz
root@sysresccd /root % passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
On attribut cette adresse a notre interface avec la commande :
root@sysresccd /root % dhclient eth0
Internet Systems Consortium DHCP Client V3.1.0-Gentoo
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:0d:b9:0d:63:80
Sending on LPF/eth0/00:0d:b9:0d:63:80
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPOFFER from 192.168.1.1
option_space_encapsulate: option space agent does not exist, but is configured.
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.xxx -- renewal in 34430 seconds.
Se connecter sur l'ALIX avec le ssh puty
Dans le cas précis nous allons travailler avec l'adresse : 192.168.1.xxx (adresse IP attribuée)
Login : root
Password que vous avez mis en haut, par exemple qwertz
sysresccd ~ # fdisk /dev/sda
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-971, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-971, default 971): 971
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
sysresccd cdrom # mkfs -t ext3 /dev/sda1
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
489600 inodes, 978760 blocks
48938 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1002438656
30 block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Se deplacé dans le repertoire CDROM du live cd, trouver le fichier qui servira à la restauration et restaurer ce fichier.
sysresccd ~ # cd /mnt/cdrom
sysresccd cdrom # ls *.000
090324-0225500125.000
sysresccd cdrom # partimage -b -f3 restore /dev/sda1 yymmdd-xxxxxxxxxx.000
sysresccd cdrom # mount /dev/sda1 /mnt/custom/
sysresccd cdrom # mount -o bind /dev /mnt/custom/dev
sysresccd cdrom # mount -o bind /proc /mnt/custom/proc
sysresccd cdrom # chroot /mnt/custom/ /bin/bash
sysresccd:/# sed -i.BAK 's/hda/sda/' /boot/grub/device.map
sysresccd:/# sed -i.BAK 's/hda1/sda1/' /etc/mtab
sysresccd:/# sed -i.BAK 's/hda1/sda1/' /etc/fstab
sysresccd:/# grub-install /dev/sda
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0) /dev/sda
sysresccd:/# mv /boot/grub/device.map.BAK /boot/grub/device.map
sysresccd:/# mv /etc/mtab.BAK /etc/mtab
sysresccd:/# mv /etc/fstab.BAK /etc/fstab
sysresccd:/# exit
exit
sysresccd cdrom # umount /mnt/custom/dev/
sysresccd cdrom # umount /mnt/custom/proc/
sysresccd cdrom # umount /mnt/custom
sysresccd cdrom # reboot
Maintenant vous pouvez enlever le lecteur DVD pour démarer normalement sur l'image qui vient d'être recréer.
Après s'être connecté la première fois avec le user root et le premier password root qui vous a été communiqué.
sysresccd cdrom # rm /etc/udev/rules.d/z25_persistent-net.rules
* * *