LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-20-2004, 07:46 AM   #1
PurpleMotion
LQ Newbie
 
Registered: Jun 2003
Distribution: Slackware & Gentoo
Posts: 15

Rep: Reputation: 0
Making complete image of installation


Hi!

I'm looking for a program that can take a complete image of the whole harddrive incl. swap space partitions etc.
This image can then be used to "install" on another computer, with the same hardware. So you would get the same setup on the new computer.
What program is capatble of doing this?
 
Old 02-20-2004, 08:13 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
There are a couple of commercial $$$$ products out there or you can use a couple of Linux products together to get this done.

Partimage doesn't copy or restore the swap partitions as it is a waste of time. That is to say it's a ( empty partition ) and partimage is only interested in copying the used portitions of a partition.
No problem! The scriptable version of fdisk ( sfdisk ) does this very nicely. In fact, sfdisk can make an exact copy of your partition table so the new hard drive does get set up the same as the original.

The command to save partitions in batch mode would look like this...
partimage save -b -z2 -f3 /dev/hda2 /mnt/images/backup/linux
You could put that in another script for making the images.

If you are going to clone an NTFS partition, you may want to run defrag and scandisk first.

Get a cd bootable version of linux like system rescue at http://www.sysresccd.org and bootup with that cd.

Mount the partition where the images are going to be saved to.
mount /dev/hdb1 /mnt/images/backup -t ext3

Run partimage to make the images and save it to the backup directory which was created in the previous step.

In this example, I have a dual boot system so I backed up both operating systems with partimage.

Save the ENTIRE PARTITION TABLE to a file using sfdisk.
sfdisk Ėd /dev/hda > /mnt/images/backup/partfile
Save the MBR to a file...
dd if=/dev/hda of=/mnt/images/backup/mbrfile bs=512 count=1

The clone script will restore that partition table and MBR from files to the new hard drive using the commands:
sfdisk /dev/hda < /mnt/images/backup/partfile
dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1


After you have saved the images and the partition table, install the new hard drive, make sure that bios sees it as the /dev/hda ( Primary Master ) so you donít accidently zap your backup images which are saved on the /dev/hdb ( Primary Slave ) .

Bootup with the rescue cd and run the clone script to restore the images to your new hard drive.


#!/bin/bash
#
clear
echo
echo "********************************************************************"
echo " Caution!!! This program will erase your hard drive"
echo
echo -n " Do you want to proceed (Y/N)?"
read answer
if test "$answer" != "Y" -a "$answer" != "y";
then exit 0;
fi
#
clear
#
#Erase the old boot sector
dd if=/dev/zero if=/dev/hda bs=512 count=1
#
#Restore the partition table from file
sfdisk /dev/hda < /mnt/images/backup/partfile
#
#Restore the MBR from file
dd if=/mnt/images/backup/mbrfile of=/dev/hda bs=512 count=1
clear
#
#Restore the images with Partimage
partimage restore -b -z2 -f3 /dev/hda1 /mnt/images/backup/windows.000
#
partimage restore -b -z2 -f3 /dev/hda2 /mnt/images/backup/linux.000
#
clear
echo "Image restore is complete"
echo
#
#End
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Making image of harddrive crxgames SUSE / openSUSE 2 04-11-2005 07:13 AM
Making a drive image pcdude Linux - General 3 01-05-2005 09:20 PM
Making a partition image PhuckFonix Linux - General 6 06-27-2004 01:06 PM
Making an iso image?? Peppercorn Linux - General 9 09-29-2003 08:23 AM
making an image of my drive antken Linux - General 1 07-16-2003 01:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration