Baudisch system clone: Unterschied zwischen den Versionen

Aus metasec wiki
Wechseln zu: Navigation, Suche
Zeile 88: Zeile 88:
 
=udev anpassen=
 
=udev anpassen=
 
  rm /sicher/etc/udev/rules.d/70-persistent-net.rules
 
  rm /sicher/etc/udev/rules.d/70-persistent-net.rules
 +
 +
=GRUB Debug=
 +
GRUB's normal start-up procedure involves setting the ‘prefix’ environment variable to a value set in the core image by grub-install, setting the ‘root’ variable to match, loading the ‘normal’ module from the prefix, and running the ‘normal’ command (see normal). This command is responsible for reading /boot/grub/grub.cfg, running the menu, and doing all the useful things GRUB is supposed to do.
 +
 +
If, instead, you only get a rescue shell, this usually means that GRUB failed to load the ‘normal’ module for some reason. It may be possible to work around this temporarily: for instance, if the reason for the failure is that ‘prefix’ is wrong (perhaps it refers to the wrong device, or perhaps the path to /boot/grub was not correctly made relative to the device), then you can correct this and enter normal mode manually:
 +
 +
    # Inspect the current prefix (and other preset variables):
 +
    set
 +
    # Find out which devices are available:
 +
    ls
 +
    # Set to the correct value, which might be something like this:
 +
    set prefix=(hd0,1)/grub
 +
    set root=(hd0,1)
 +
    insmod normal
 +
    normal
  
  
 
=Weiterführende Links=
 
=Weiterführende Links=
 
Allgemeines Vorgehen und Optimierungen beim Umgang mit SSD oder CF Medien http://o-o-s.de/?p=1742
 
Allgemeines Vorgehen und Optimierungen beim Umgang mit SSD oder CF Medien http://o-o-s.de/?p=1742

Version vom 1. Oktober 2011, 15:03 Uhr

Setup

Aktives System klonen

Alle aktiven Dienste bis auf SSH beenden
Dieses wird über /etc/init.d/* gemacht.
CF Karte formatieren
Die meisten Karten kommen als VFAT formatierte Datenträger. Diese müssen auf EXT3 geändert werden
Entweder über fdisk
oder kompfortabler über cfdisk

(Gesamt)System Sichern

 tar --exclude=/proc/* --exclude=/sys/* --exclude=/sicher/* --exclude=/tmp/* --exclude=/dev/shm/* -cvzf /sicher/name_von_sicherung.tar.gz /

Livekopie abziehen

Es besteht die Möglichkeit ein System quasi live abzuziehen. Dabei wird das Gesamte System vom Hauptdatenträger auf einen zweiten kopiert. Dieses wird am besten mit dem Tool "rsync" gmacht. Wir gehen davon aus, dass das Ziel unter /mnt eingehängt ist. Dabei ist es egal, ob das ein USB Stick oder eine weitere CF Karte ist!

cd /mnt
rsync --exclude=/proc/* --exclude=/mnt/* --exclude=/sys/* --exclude=/sicher/* --exclude=/tmp/* --exclude=/dev/shm/* -av / .

System entpacken

Wir gehen davon aus, dass das Archiv unter /sicher liegt und dass die neue CF Karte unter /mnt/ eingehängt ist

tar -numeric-owner -xvzf /sicher/name_von_sicherung.tar.gz -C /mnt/ziel

Bootloader installieren

grub-install /dev/sdc

Dateisystem UID checken

root@em-master:/# tune2fs -l /dev/sdc
tune2fs 1.41.12 (17-May-2010)
tune2fs: Bad magic number in super-block beim Versuch, /dev/sdc zu öffnen
Kann keinen gültigen Dateisystem-Superblock finden.
root@em-master:/# tune2fs -l /dev/sdc1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          3ca4da71-4e59-40b6-85c6-e3c836b4ae15
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              128256
Block count:              512560
Reserved block count:     25628
Free blocks:              194480
Free inodes:              96868
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      125
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8016
Inode blocks per group:   501
Filesystem created:       Sat Oct  1 12:52:34 2011
Last mount time:          Sat Oct  1 12:53:28 2011
Last write time:          Sat Oct  1 14:19:00 2011
Mount count:              1
Maximum mount count:      35
Last checked:             Sat Oct  1 12:52:34 2011
Check interval:           15552000 (6 months)
Next check after:         Thu Mar 29 12:52:34 2012
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      9444ed0c-209c-494d-adac-c7b5ad5fb535
Journal backup:           inode blocks

Dateisystem UID setzen und System anpassen

Die UID kann beliebig sein.

tune2fs -U 3ca4da71-4e59-40b6-85c6-e3c836b4a666 /dev/sdc1

udev anpassen

rm /sicher/etc/udev/rules.d/70-persistent-net.rules

GRUB Debug

GRUB's normal start-up procedure involves setting the ‘prefix’ environment variable to a value set in the core image by grub-install, setting the ‘root’ variable to match, loading the ‘normal’ module from the prefix, and running the ‘normal’ command (see normal). This command is responsible for reading /boot/grub/grub.cfg, running the menu, and doing all the useful things GRUB is supposed to do.

If, instead, you only get a rescue shell, this usually means that GRUB failed to load the ‘normal’ module for some reason. It may be possible to work around this temporarily: for instance, if the reason for the failure is that ‘prefix’ is wrong (perhaps it refers to the wrong device, or perhaps the path to /boot/grub was not correctly made relative to the device), then you can correct this and enter normal mode manually:

    # Inspect the current prefix (and other preset variables):
    set
    # Find out which devices are available:
    ls
    # Set to the correct value, which might be something like this:
    set prefix=(hd0,1)/grub
    set root=(hd0,1)
    insmod normal
    normal


Weiterführende Links

Allgemeines Vorgehen und Optimierungen beim Umgang mit SSD oder CF Medien http://o-o-s.de/?p=1742