2009年4月7日

利用dd指令遠端備份為ISO檔及還原成硬碟 (Linux, Unix, Solaris等適用)

遠端備份A(主機)的硬碟為ISO檔並儲存到B(File Server)的/backup目錄下

備份成ISO檔並丟到File Server:
Step1:SSH進入到欲備份的A主機下指令 (Linux)
Step2:dd if=/dev/hda | gzip -9 -c | ssh taiwanwolf@fileserver_ip dd of=/backup/hda.img.gz

Solaris 大概像以下的語法
/usr/local/bin/dd if=/dev/dsk/c1t0d0s2 | /usr/local/bin/gzip -9 -c | /usr/local/bin/ssh taiwanwolf@fileserver_ip /bin/dd of=/backup/c1t0d0s2.img.gz

從遠端File Server的ISO檔還原到本機硬碟
Step1:從一台裝上硬碟的Server, SSH進入到B(File Server)
Step2:ssh taiwanwolf@fileserver_ip zcat /backup/hda.img.gz | dd of=/dev/hda


如果該還原主機沒有作業系統,可採用 knoppix 之類的LiveCD來開機, 再綁上IP即可進行還原或備份

沒有留言: