Systemrettung

Aus Info-Theke
Zur Navigation springen Zur Suche springen


Grub restaurieren

  • Rettungssystem starten
BOOT_DISK=/dev/sdX
ROOT_PART=/dev/sdX5

setxkbmap de

test -d /trg || mkdir /trg
mount -o subvol=@ $ROOT_PART /trg

for dir in /sys /dev /proc ; do
   mount -o bind $dir /trg/$dir
done
chroot /trg
echo "we have entered the forign system (chroot)!"

cd /boot
dpkg-reconfigure initramfs-tools
oder
dpkg-reconfigure linux-image-4.4.5-towo.1-siduction-amd64
oder
initramdfs -v -u

grub-install $BOOT_DISK

echo "use 'exit' to leave the forign system"

Restaurierung Root-FS von tar-Archiv

BASE=
cp -a $BASE/bin $BASE/xbin ; mkdir /old 
FN=$BASE/M
cat <<EOS >$FN
#! $BASE/xbin/sh
MV=$BASE/xbin/mv
dir=\$1
if [ ! -d "/\$dir" ] ; then
        echo "+++ missing dir: $dir"
else
        \$MV $BASE/\$dir old
        \$MV $BASE/new/\$dir /
        ls -ld $BASE/\$dir $BASE/old/\$dir
fi 
EOS
chmod +x $FN
FN=/A
cat <<EOS >/$FN
#! $BASE/xbin/sh
$BASE/M usr
$BASE/M etc
$BASE/M sbin
$BASE/M var
$BASE/M home
$BASE/M media
$BASE/M opt
$BASE/M root
$BASE/M lib
$BASE/M lib64

echo "get $BASE/old/lib/modules/<kernel>"
echo "do manually: $BASE/M bin"
EOS
chmod +x $FN