[cochiselinux] dd and ssh for remote backups/default installations

  • From: "Prevett, Larry" <Prevettl@xxxxxxxxxxx>
  • To: <cochiselinux@xxxxxxxxxxxxx>
  • Date: Mon, 29 Mar 2004 17:56:52 -0700

We've been looking for a way to do remote backups and default =
installations
for the machines in the labs. This is important for getting the =
math/science software reinstalled after Linux is installed in the =
'Installing and Using' class. Common installations are also important =
for clustering because the programs and data all have to be in the same =
place on the hard drives.

We tried Norton Ghost and it copied everything but the boot loader ....
dd + ssh works great.

Use caution - try these commands out on some old hard drive you don't=20
need to make sure they do what you want first.

use dumpe2fs -h /dev/hda1, etc. to determine block sizes of partitions
(for this example bs=3D4096)
                                                                         =
                                        =20
# on all clients on private network
 boot with Quantian CD (or other Knoppix CD) which runs sshd.
 su -
 passwd (ssh config disallows empty pwd connection)
 ifconfig eth0 192.168.86.1
 route add default gw 192.168.86.1
                                                                         =
                                        =20
# on machine with master hard drive image
dd if=3D/dev/hda bs=3D4096 | (ssh2 root@xxxxxxxxxxxx dd of=3D/dev/hda =
obs=3D4096)
enter password, ctrl-z, bg 1, do the next one ...
                                                                         =
                                       (could automate this with public =
ssh keys)

Bad news: takes 6hrs to copy a 60Gb drive(!)
 (block size doesn't seem to make a difference
 to speed things up could skip free blocks - working on that)            =
             =20
                                                                         =
             =20
Good news: to copy to 10 machines only takes 13hrs
 So we could install FreeBSD on every machine on a Sunday night meeting,
 start the copy before we leave, machines would be ready to go in the =
morning.
 Since this is a binary image, no need to partition anything,
 even for dual/boot installations.

dd is very flexible. Other ideas from internet, O'Reilly books:

# go the other way: copy first partition from remote machine to local =
drive
ssh2 root@xxxxxxxxxxxx "dd if=3D/dev/hda1 bs=3D512" | cat - > /dev/hda1

# backup master boot record on remote machine to local file mbr.bin
ssh2 root@xxxxxxxxxxxx "dd if=3D/dev/hda bs=3D512" count=3D1 | cat - > =
mbr.bin

# copy mbr.bin back to remote machine
dd if=3Dmbr.bin bs=3D512 | (ssh root@xxxxxxxxxxxx dd of=3D/dev/hda =
obs=3D512)

stuff like that.

lp

--------------------------------------------------------------------
Cochise Linux Users Group Mailing List - cochiselinux@xxxxxxxxxxxxx
For more information:  http://www.cochiselinux.org
To unsubscribe: //www.freelists.org/list/cochiselinux

Other related posts: