Buffer

From Essential
Revision as of 09:57, 13 November 2017 by Tcepo (talk | contribs) (Created page with "== Fix RedHat boot == === hostDestination === <pre> diskMy=sda backupDir=~/$(hostname).$(date -u +"%Y-%m-%dT%H_%M_%SZ") mkdir "${backupDir}" cd "${backupDir}" dd if=/dev/${di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Fix RedHat boot

hostDestination

diskMy=sda

backupDir=~/$(hostname).$(date -u +"%Y-%m-%dT%H_%M_%SZ")
mkdir "${backupDir}"
cd "${backupDir}"
dd if=/dev/${diskMy}1 |gzip >${diskMy}1.dd.gz
dd if=/dev/${diskMy} of=${diskMy}.mbr bs=512 count=1

hostSource

hostDestination=
diskMy=sda

backupDir=~/$(hostname).$(date -u +"%Y-%m-%dT%H_%M_%SZ")
mkdir "${backupDir}"
cd "${backupDir}"
dd if=/dev/${diskMy}1 |gzip >${diskMy}1.dd.gz
dd if=/dev/${diskMy} of=${diskMy}.mbr bs=512 count=1

ssh root@${hostDestination} -c 'mkdir '"${backupDir}"

scp -p * root@${hostDestination}:"${backupDir}"/.

hostDestination

diskMy=sda

backupDir=~/$(hostname).$(date -u +"%Y-%m-%dT%H_%M_%SZ")
mkdir "${backupDir}"
cd "${backupDir}"
dd if=/dev/${diskMy}1 |gzip >${diskMy}1.dd.gz
dd if=/dev/${diskMy} of=${diskMy}.mbr bs=512 count=1

restoreDir=
cd "${restoreDir}"
dd if=/dev/${diskMy} of=${diskMy}.mbr bs=512 count=1
dd if=/dev/${diskMy}1 |gzip >${diskMy}1.dd.gz

cd $(ls -1td ~/* |head -1)

zcat $(ls -1t *.dd.gz |head -1) |dd of=/dev/${diskMy}