Title: Clone Linux Subject: It's so easy to clone linux, disk to disk. Since writing this doc, I have switched to System Imager, which uses rsync to clone systems. # The cool people at Road Warrior made this possible # 2/9/2000 by: John Stile #==================================================== # Clone disk using bullet drive: #==================================================== # # Partition new disk fdisk to crate a 6Gb partition of ext2 file system. # I don't have the details. # Make sure the drive is empty # ** If you have to restart this process, start here ** /sbin/mke2fs /dev/hde1 # create a place to mount the drive. mkdir /mnt/harddrive2 # mount the drive mount /dev/hde /mnt/harddrive2 -t ext2 # Now shut off some basic things that drag on cpu kill -9 `ps -el |grep xlock |awk '{print $4}'` kill -9 `ps -el |grep x-scereensaver |awk '{print $4}'` # setup a monitor: gdiskfree or use a while loop # gdiskfree is a graphical display of drive space gdiskfree # while loop runs in a terminal, displaying disk usage # once you hit after end, the loop begins. # If you want, also add ls /mnt/harddrive2 while ((1)) do df -k /mnt/harddrive2 sleep 1 done # In another window change directory to / and start rsync cd / # options a is archive to preserves attributes, v is verbose # [!mpl]* means everything that does not start with m, p, or l in current dir. # rsync -avz "^[!mpl].*" lib /mnt/harddrive2 # if you are getting your data from a remote system: rsync -avz -e ssh root@remote.com:/source_directory/[!mpl].* # when this process is over, make a proc and mnt directory mkdir /mnt/harddrive2/proc mkdir /mnt/harddrive2/mnt # now you need to make the new drive bootable. cd /mnt/harddrive2 chroot . lilo -v -v -v # if not errors, you should be able boot from that drive -------------------------------------------------------------- I recently started a regular backup. this is the start of it. rsync -avz -e ssh [deorsuv]* lib root@bakup_server_name:/mnt/hda1/machine_name/ ------------------ Changing it a little: PATH=/usr/local/bin:$PATH files=`ls |grep "^[hbeorsu].*"` rsync -avz -e ssh $files root@bakup_server_name:/mnt/hda1/machine_name_20010515/ In a different terminal, keep an eye on the backup drive. while [ 1 ]; do df -k; sleep 5; done --------------------------------------------------------------- scp hangs, freezes, stops working: It seems that rsync hangs. I don't know why, but it's not on every machine. I'll bet its a memory, clock cycle, or process flow problem because I don't know anything about those areas. To get around this problem, I had to run it from a faster workstation rsync -avz -e ssh root@host:/[bdehorsuv]* root@host:/lib root@backupserver:/mnt/hda1/host/ (Next time, I'll try the --exclude-from=FILE option i.e. make a file called FILE, containing the words proc and lost+found. rsync -avz -e ssh --exclude-from=FILE root@host:/ root@backupserver:/mnt/hda1/host/ ) keeping track of rsync progress: -------------------------------- while [ 1 ] do First=`df -k |grep /dev/hda1 |awk '{print $4}'` diff=`expr $Second - $First` Second=$First echo "Transfer Rate = $diff Mb" echo "Data Transered = $First Mb" sleep 2 done