fix
This commit is contained in:
parent
1d813fee61
commit
855c5f711e
3 changed files with 127 additions and 2 deletions
114
debian-lvm-reinstall-script.sh
Normal file
114
debian-lvm-reinstall-script.sh
Normal file
|
@ -0,0 +1,114 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Simon Rieger
|
||||
|
||||
#\\10.1.1.12\Email\srieger
|
||||
#
|
||||
set -ex
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
sudo "$0" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
exit 0
|
||||
fi
|
||||
echo "Als root Angemeldet"
|
||||
#
|
||||
|
||||
#device=$1
|
||||
#target=$2
|
||||
|
||||
while (( "$#" ))
|
||||
do
|
||||
for wort in ${1}
|
||||
do
|
||||
echo "$wort"
|
||||
export ${wort%=*}=${wort#*=}
|
||||
echo "Parameter ${wort%=*} = ${wort#*=}"
|
||||
done
|
||||
shift
|
||||
done
|
||||
|
||||
sleep 5
|
||||
|
||||
aptitude install lvm2
|
||||
sudo modprobe dm-mod
|
||||
sudo modprobe dm-mirror # Lädt den "mirror"-Treiber welcher für pvmove notwendig ist
|
||||
|
||||
|
||||
function makebackup() {
|
||||
mkdir tmpstorage
|
||||
mount ${device} tmpstorage
|
||||
mkdir target
|
||||
mount ${target} target
|
||||
tar -czf tmpstorage/backup.tar.gz target/*
|
||||
umount target
|
||||
umount tmpstorage
|
||||
}
|
||||
|
||||
function makelvm() {
|
||||
pvcreate ${device}
|
||||
pvcreate ${device1}
|
||||
pvdisplay
|
||||
vgcreate server0 ${device}
|
||||
lvcreate -L50G --name=ext4 server0
|
||||
lvcreate -L50G --name=xzf server0
|
||||
|
||||
parted /dev/server0/ext4 set 1 raid on
|
||||
parted /dev/server1/ext4 set 1 raid on
|
||||
|
||||
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/ext4 /dev/server1/ext4
|
||||
|
||||
vgcreate server1 ${device1}
|
||||
lvcreate -L50G --name=ext4 server1
|
||||
lvcreate -L50G --name=xfs server1
|
||||
|
||||
parted /dev/server0/xfs set 1 raid on
|
||||
parted /dev/server1/xfs set 1 raid on
|
||||
|
||||
mdadm --create /dev/md0 --auto md --level=1 --raid-devices=2 /dev/server0/xfs /dev/server1/xfs
|
||||
|
||||
mkfs -L p_debian_ext4 -t ext4 /dev/md0
|
||||
|
||||
mkfs -L p_debian_xfs -t xfs /dev/md1
|
||||
|
||||
}
|
||||
|
||||
function bindsym() {
|
||||
mount /dev/md0 target
|
||||
cd target
|
||||
mkdir boot
|
||||
mount ${device} boot
|
||||
mkdir sys proc dev
|
||||
mount --bind /sys sys
|
||||
mount --bind /dev dev
|
||||
mount --bind /proc proc
|
||||
}
|
||||
|
||||
function restorebackup() {
|
||||
tar -xzf backup.tar.gz -C target
|
||||
}
|
||||
|
||||
function repairbootloader() {
|
||||
deviceuuid=$(blkid -s UUID -o value ${device})
|
||||
echo ${deviceuuid} >> target/etc/fstab
|
||||
echo "Bitte nochmal nachschauen ob noch alte Einträge entfernt werden müssen!!!"
|
||||
echo "SystemD suckt total sonst rum ^^"
|
||||
echo "/etc/mkinitcpio.conf in Hooks einfügen lvm2 vor filesystem"
|
||||
|
||||
chroot target aptitude install lvm2
|
||||
chroot target grub-install ${device%?}
|
||||
chroot target update-grub
|
||||
chroot target dpkg-reconfigure linux-image-mylinuxversion
|
||||
}
|
||||
|
||||
|
||||
makebackup
|
||||
sleep 5
|
||||
makelvm
|
||||
sleep 5
|
||||
bindsym
|
||||
sleep 5
|
||||
restorebackup
|
||||
sleep 5
|
||||
repairbootloader
|
||||
lsblk
|
14
sgit
14
sgit
|
@ -14,14 +14,24 @@ fi
|
|||
push="${3}"
|
||||
[[ -z "${push}" ]] && push="origin"
|
||||
|
||||
branch="${4}"
|
||||
[[ -z "${branch}" ]] && branch="master"
|
||||
|
||||
git config --global core.editor "nano"
|
||||
git config --global user.email "${1}"
|
||||
git config --global user.name "${1}"
|
||||
git config --global push.default simple
|
||||
git config --local core.sshCommand "/usr/bin/ssh -i $HOME/.ssh/id_rsa"
|
||||
git branch --set-upstream-to=origin/master master
|
||||
git status
|
||||
git add --all
|
||||
git commit --all -m "${2}"
|
||||
git pull
|
||||
git show
|
||||
git push "${push}"
|
||||
if ! GIT_TRACE=1 GIT_SSH="$PWD/ssh" git pull "${push}" "${branch}"; then
|
||||
echo "Konnte keine neuen Daten vom Server hollen!!!"
|
||||
fi
|
||||
if ! GIT_TRACE=1 GIT_SSH="$PWD/ssh" git push "${push}" "${branch}"; then
|
||||
echo "Konnte keine neuen Daten zum Server pushen!!!"
|
||||
fi
|
||||
git status
|
||||
git pull
|
||||
|
|
1
ssh
Normal file
1
ssh
Normal file
|
@ -0,0 +1 @@
|
|||
ssh -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $HOME/.ssh/id_rsa $*
|
Loading…
Reference in a new issue